This commit is contained in:
2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

BIN
Kreta.IntezmenyLetrehozo/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kreta.IntezmenyLetrehozo", "Kreta.IntezmenyLetrehozo\Kreta.IntezmenyLetrehozo.csproj", "{E7E26041-059A-4A58-92FA-AA0C82F92210}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E7E26041-059A-4A58-92FA-AA0C82F92210}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7E26041-059A-4A58-92FA-AA0C82F92210}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7E26041-059A-4A58-92FA-AA0C82F92210}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7E26041-059A-4A58-92FA-AA0C82F92210}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = http://sda-tfs-as:8080/tfs/sda
SccLocalPath0 = .
SccProjectUniqueName1 = Kreta.IntezmenyLetrehozo\\Kreta.IntezmenyLetrehozo.csproj
SccProjectName1 = Kreta.IntezmenyLetrehozo
SccLocalPath1 = Kreta.IntezmenyLetrehozo
EndGlobalSection
EndGlobal

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,105 @@
namespace Kreta.IntezmenyLetrehozo
{
partial class ListItem
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.IblMessage = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(77, 47);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// IblMessage
//
this.IblMessage.AutoEllipsis = true;
this.IblMessage.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.IblMessage.Location = new System.Drawing.Point(87, 0);
this.IblMessage.Name = "IblMessage";
this.IblMessage.Size = new System.Drawing.Size(446, 61);
this.IblMessage.TabIndex = 2;
this.IblMessage.Text = "szöveg";
this.IblMessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.IblMessage.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.ListItem_MouseDoubleClick);
this.IblMessage.MouseEnter += new System.EventHandler(this.ListItem_MouseEnter);
this.IblMessage.MouseLeave += new System.EventHandler(this.ListItem_MouseLeave);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.panel1.Controls.Add(this.panel2);
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Location = new System.Drawing.Point(4, 6);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(77, 47);
this.panel1.TabIndex = 3;
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Silver;
this.panel2.Location = new System.Drawing.Point(3, 57);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(871, 1);
this.panel2.TabIndex = 4;
//
// ListItem
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.panel1);
this.Controls.Add(this.IblMessage);
this.Name = "ListItem";
this.Size = new System.Drawing.Size(536, 61);
this.MouseEnter += new System.EventHandler(this.ListItem_MouseEnter);
this.MouseLeave += new System.EventHandler(this.ListItem_MouseLeave);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label IblMessage;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
}
}

View File

@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Kreta.IntezmenyLetrehozo
{
public partial class ListItem : UserControl
{
public ListItem()
{
InitializeComponent();
}
#region Properties
private Color _iconBackground;
private string _message;
private string _value;
private Image _icon;
[Category("Custom Props")]
public Color IconBackground
{
get { return _iconBackground; }
set { _iconBackground = value; panel1.BackColor = value; }
}
[Category("Custom Props")]
public string Message
{
get { return _message; }
set { _message = value; IblMessage.Text = value; }
}
[Category("Custom Props")]
public string Value
{
get { return _value; }
set { _value = value; IblMessage.Name = value; }
}
[Category("Custom Props")]
public Image Icon
{
get { return _icon; }
set { _icon = value; pictureBox1.Image = value; }
}
#endregion
private void ListItem_MouseEnter(object sender, EventArgs e)
{
this.BackColor = Helper.MetroBlue();
}
private void ListItem_MouseLeave(object sender, EventArgs e)
{
this.BackColor = Color.White;
}
private void ListItem_MouseDoubleClick(object sender, MouseEventArgs e)
{
new SelectEnvirnomentWindow().doubleClickItem(sender);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,62 @@
namespace Kreta.IntezmenyLetrehozo
{
partial class SelectEnvirnomentWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel1.AutoScroll = true;
this.flowLayoutPanel1.Location = new System.Drawing.Point(10, 33);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(341, 532);
this.flowLayoutPanel1.TabIndex = 6;
//
// SelectEnvirnomentWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(365, 585);
this.Controls.Add(this.flowLayoutPanel1);
this.DisplayHeader = false;
this.Name = "SelectEnvirnomentWindow";
this.Padding = new System.Windows.Forms.Padding(20, 30, 20, 20);
this.Text = "Környezetetek";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
}
}

View File

@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Drawing;
using System.Windows.Forms;
using Kreta.IntezmenyLetrehozo.Ablakok.KezdoAblak;
using Kreta.IntezmenyLetrehozo.Properties;
using Kreta.IntezmenyLetrehozo.TelepitoAblak;
namespace Kreta.IntezmenyLetrehozo
{
public partial class SelectEnvirnomentWindow : MetroFramework.Forms.MetroForm
{
public SelectEnvirnomentWindow()
{
InitializeComponent();
this.Icon = Properties.Resources.intezmeny_kdU_icon;
populateItems(ConfigurationManager.AppSettings["kornyezet"].ToString());
}
private void populateItems(string kornyezet)
{
Dictionary<string, string> fenntartokList = new Dictionary<string, string>();
fenntartokList = Helper.GetFenntartokList(kornyezet);
int listItemsCount = 0;
flowLayoutPanel1.Controls.Clear();
ListItem[] listItems = new ListItem[fenntartokList.Count];
foreach (KeyValuePair<string, string> fenntarto in fenntartokList)
{
listItems[listItemsCount] = new ListItem();
listItems[listItemsCount].Width = flowLayoutPanel1.Width;
listItems[listItemsCount].Icon = Resources.intezmeny_blue;
listItems[listItemsCount].IconBackground = Color.Azure;
listItems[listItemsCount].Message = fenntarto.Key;
listItems[listItemsCount].Value = fenntarto.Value;
flowLayoutPanel1.Controls.Add(listItems[listItemsCount]);
listItemsCount++;
}
listItemsCount = 0;
}
public void doubleClickItem(object sender)
{
if (MetroFramework.MetroMessageBox.Show(SelectEnvirnomentWindow.ActiveForm, $"{(sender as Label).Text} a beállított DB? ", $"A választott szerver {(sender as Label).Name}!", MessageBoxButtons.YesNo, MessageBoxIcon.Question, 100) == DialogResult.Yes)
{
new UpdateConfig().UpdateMSSQLConnectionString((sender as Label).Name, (sender as Label).Text);
SelectAndValidateExcelWindow child = new SelectAndValidateExcelWindow();
child.FormClosed += new FormClosedEventHandler(childWindow_FormClosed);
child.Show();
this.Hide();
}
}
void childWindow_FormClosed(object sender, FormClosedEventArgs e)
{
this.Close();
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,278 @@
namespace Kreta.IntezmenyLetrehozo.TelepitoAblak
{
partial class SelectAndValidateExcelWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.panel1 = new System.Windows.Forms.Panel();
this.EGYMICheckbox = new MetroFramework.Controls.MetroCheckBox();
this.KoliCheckBox = new MetroFramework.Controls.MetroCheckBox();
this.AMICheckbox = new MetroFramework.Controls.MetroCheckBox();
this.newCommand = new MetroFramework.Controls.MetroButton();
this.telepitesEllenorzesButton = new MetroFramework.Controls.MetroButton();
this.installButton = new MetroFramework.Controls.MetroButton();
this.Open_excelFile = new MetroFramework.Controls.MetroButton();
this.label1 = new System.Windows.Forms.Label();
this.TBLog = new System.Windows.Forms.TextBox();
this.metroGrid = new MetroFramework.Controls.MetroGrid();
this.progressBar = new MetroFramework.Controls.MetroProgressBar();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.metroGrid)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.panel1.Controls.Add(this.EGYMICheckbox);
this.panel1.Controls.Add(this.KoliCheckBox);
this.panel1.Controls.Add(this.AMICheckbox);
this.panel1.Controls.Add(this.newCommand);
this.panel1.Controls.Add(this.telepitesEllenorzesButton);
this.panel1.Controls.Add(this.installButton);
this.panel1.Controls.Add(this.Open_excelFile);
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(20, 60);
this.panel1.MinimumSize = new System.Drawing.Size(0, 400);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(165, 422);
this.panel1.TabIndex = 0;
//
// EGYMICheckbox
//
this.EGYMICheckbox.AutoSize = true;
this.EGYMICheckbox.Cursor = System.Windows.Forms.Cursors.Hand;
this.EGYMICheckbox.Location = new System.Drawing.Point(34, 161);
this.EGYMICheckbox.Name = "EGYMICheckbox";
this.EGYMICheckbox.Size = new System.Drawing.Size(96, 15);
this.EGYMICheckbox.TabIndex = 6;
this.EGYMICheckbox.Text = "EGYMI modul";
this.EGYMICheckbox.UseCustomBackColor = true;
this.EGYMICheckbox.UseSelectable = true;
//
// KoliCheckBox
//
this.KoliCheckBox.AutoSize = true;
this.KoliCheckBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.KoliCheckBox.Location = new System.Drawing.Point(34, 128);
this.KoliCheckBox.Name = "KoliCheckBox";
this.KoliCheckBox.Size = new System.Drawing.Size(118, 15);
this.KoliCheckBox.TabIndex = 5;
this.KoliCheckBox.Text = "Kollégiumi modul";
this.KoliCheckBox.UseCustomBackColor = true;
this.KoliCheckBox.UseSelectable = true;
//
// AMICheckbox
//
this.AMICheckbox.AutoSize = true;
this.AMICheckbox.Cursor = System.Windows.Forms.Cursors.Hand;
this.AMICheckbox.Location = new System.Drawing.Point(34, 97);
this.AMICheckbox.Name = "AMICheckbox";
this.AMICheckbox.Size = new System.Drawing.Size(83, 15);
this.AMICheckbox.TabIndex = 4;
this.AMICheckbox.Text = "AMI modul";
this.AMICheckbox.UseCustomBackColor = true;
this.AMICheckbox.UseSelectable = true;
//
// newCommand
//
this.newCommand.Cursor = System.Windows.Forms.Cursors.Hand;
this.newCommand.Location = new System.Drawing.Point(3, 63);
this.newCommand.Name = "newCommand";
this.newCommand.Size = new System.Drawing.Size(159, 32);
this.newCommand.TabIndex = 3;
this.newCommand.Text = "Újabb parancs futtatása";
this.newCommand.UseSelectable = true;
this.newCommand.Visible = false;
this.newCommand.Click += new System.EventHandler(this.newCommand_Click);
//
// telepitesEllenorzesButton
//
this.telepitesEllenorzesButton.BackColor = System.Drawing.Color.LimeGreen;
this.telepitesEllenorzesButton.Cursor = System.Windows.Forms.Cursors.Hand;
this.telepitesEllenorzesButton.Dock = System.Windows.Forms.DockStyle.Top;
this.telepitesEllenorzesButton.ForeColor = System.Drawing.Color.White;
this.telepitesEllenorzesButton.Location = new System.Drawing.Point(0, 0);
this.telepitesEllenorzesButton.Name = "telepitesEllenorzesButton";
this.telepitesEllenorzesButton.Size = new System.Drawing.Size(165, 35);
this.telepitesEllenorzesButton.TabIndex = 2;
this.telepitesEllenorzesButton.Text = "Telepítés ellenőrzése!";
this.telepitesEllenorzesButton.Theme = MetroFramework.MetroThemeStyle.Light;
this.telepitesEllenorzesButton.UseCustomBackColor = true;
this.telepitesEllenorzesButton.UseSelectable = true;
this.telepitesEllenorzesButton.Visible = false;
this.telepitesEllenorzesButton.Click += new System.EventHandler(this.telepitesEllenorzesButton_Click);
//
// installButton
//
this.installButton.Cursor = System.Windows.Forms.Cursors.Hand;
this.installButton.Dock = System.Windows.Forms.DockStyle.Bottom;
this.installButton.FontSize = MetroFramework.MetroButtonSize.Medium;
this.installButton.Location = new System.Drawing.Point(0, 381);
this.installButton.Name = "installButton";
this.installButton.Size = new System.Drawing.Size(165, 41);
this.installButton.TabIndex = 1;
this.installButton.Text = "Telepít";
this.installButton.Theme = MetroFramework.MetroThemeStyle.Light;
this.installButton.UseCustomBackColor = true;
this.installButton.UseCustomForeColor = true;
this.installButton.UseSelectable = true;
this.installButton.Click += new System.EventHandler(this.installButton_Click);
//
// Open_excelFile
//
this.Open_excelFile.Cursor = System.Windows.Forms.Cursors.Hand;
this.Open_excelFile.Location = new System.Drawing.Point(34, 29);
this.Open_excelFile.Name = "Open_excelFile";
this.Open_excelFile.Size = new System.Drawing.Size(98, 37);
this.Open_excelFile.TabIndex = 0;
this.Open_excelFile.Text = "Excel megnyitása";
this.Open_excelFile.UseSelectable = true;
this.Open_excelFile.Click += new System.EventHandler(this.Open_excelFile_Click);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.Transparent;
this.label1.Location = new System.Drawing.Point(185, 386);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(689, 19);
this.label1.TabIndex = 8;
this.label1.Text = "Műveleti loggok:";
//
// TBLog
//
this.TBLog.AccessibleRole = System.Windows.Forms.AccessibleRole.Text;
this.TBLog.AutoCompleteCustomSource.AddRange(new string[] {
""});
this.TBLog.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.TBLog.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.TBLog.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.TBLog.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.TBLog.HideSelection = false;
this.TBLog.Location = new System.Drawing.Point(185, 405);
this.TBLog.MaxLength = 0;
this.TBLog.Multiline = true;
this.TBLog.Name = "TBLog";
this.TBLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.TBLog.Size = new System.Drawing.Size(689, 77);
this.TBLog.TabIndex = 7;
this.TBLog.TabStop = false;
this.TBLog.WordWrap = false;
//
// metroGrid
//
this.metroGrid.AllowUserToResizeRows = false;
this.metroGrid.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.metroGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.metroGrid.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
this.metroGrid.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(174)))), ((int)(((byte)(219)))));
dataGridViewCellStyle1.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
dataGridViewCellStyle1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(247)))));
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.metroGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.metroGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
dataGridViewCellStyle2.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
dataGridViewCellStyle2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(136)))), ((int)(((byte)(136)))), ((int)(((byte)(136)))));
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(247)))));
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.metroGrid.DefaultCellStyle = dataGridViewCellStyle2;
this.metroGrid.EnableHeadersVisualStyles = false;
this.metroGrid.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
this.metroGrid.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.metroGrid.Location = new System.Drawing.Point(185, 60);
this.metroGrid.Name = "metroGrid";
this.metroGrid.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(174)))), ((int)(((byte)(219)))));
dataGridViewCellStyle3.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
dataGridViewCellStyle3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(198)))), ((int)(((byte)(247)))));
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.metroGrid.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
this.metroGrid.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
this.metroGrid.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.metroGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.metroGrid.Size = new System.Drawing.Size(689, 324);
this.metroGrid.TabIndex = 1;
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(260, 27);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(614, 27);
this.progressBar.TabIndex = 2;
this.progressBar.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.progressBar.Visible = false;
//
// SelectAndValidateExcelWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(894, 502);
this.Controls.Add(this.TBLog);
this.Controls.Add(this.label1);
this.Controls.Add(this.progressBar);
this.Controls.Add(this.metroGrid);
this.Controls.Add(this.panel1);
this.Name = "SelectAndValidateExcelWindow";
this.Text = "Intézmények telepítése";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.metroGrid)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel panel1;
private MetroFramework.Controls.MetroButton Open_excelFile;
private MetroFramework.Controls.MetroGrid metroGrid;
private MetroFramework.Controls.MetroButton installButton;
private MetroFramework.Controls.MetroProgressBar progressBar;
private MetroFramework.Controls.MetroButton telepitesEllenorzesButton;
private MetroFramework.Controls.MetroButton newCommand;
private MetroFramework.Controls.MetroCheckBox EGYMICheckbox;
private MetroFramework.Controls.MetroCheckBox KoliCheckBox;
private MetroFramework.Controls.MetroCheckBox AMICheckbox;
private System.Windows.Forms.TextBox TBLog;
private System.Windows.Forms.Label label1;
}
}

View File

@@ -0,0 +1,365 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.IO;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using Kreta.IntezmenyLetrehozo.Dal;
using OfficeOpenXml;
using OfficeOpenXml.Style;
namespace Kreta.IntezmenyLetrehozo.TelepitoAblak
{
public partial class SelectAndValidateExcelWindow : MetroFramework.Forms.MetroForm
{
public SelectAndValidateExcelWindow()
{
InitializeComponent();
this.Icon = Properties.Resources.install;
}
List<IntezmenyAdatok> intezmenyek = new List<IntezmenyAdatok>();
List<IntezmenyAdatok> telepitendoIntezmenyek = new List<IntezmenyAdatok>();
private void Open_excelFile_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Title = "Open .xlsx file";
openFileDialog.Filter = "Xlsx File (*.xlsx)|*.xlsx";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
Helper.UpdateLogText(TBLog, "Fájl beolvasása elkezdődött!");
try
{
using (var fileStream = File.OpenRead(openFileDialog.FileName))
{
var import = new ExcelImport(fileStream);
Helper.UpdateLogText(TBLog, "Excel importálása elkezdődött!");
intezmenyek = import.Import();
Helper.UpdateLogText(TBLog, "Excel importálása befejeződött!");
}
Helper.UpdateLogText(TBLog, "Táblázat feltöltése elkezdődött!");
metroGrid.DataSource = Helper.ConvertListToDataTable(intezmenyek);
Helper.UpdateLogText(TBLog, "Táblázat feltöltése befejeződött!");
}
catch (SecurityException ex)
{
Helper.UpdateLogText(TBLog, ex.Message);
MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
$"Details:\n\n{ex.StackTrace}");
}
Helper.UpdateLogText(TBLog, "Fájl beolvasása befejeződött!");
}
string validateInfo = ValidateIntezmenyAdatok(intezmenyek);
if (!string.IsNullOrEmpty(validateInfo))
{
Helper.UpdateLogText(TBLog, validateInfo);
int lineCount = validateInfo.Split('\n').Length;
MetroFramework.MetroMessageBox.Show(this, validateInfo, $"Hibás sor és oszlopok az excelben!", MessageBoxButtons.OK, MessageBoxIcon.Error, height: lineCount > 4 ? lineCount * 30 : 300);
}
}
private void installButton_Click(object sender, EventArgs e)
{
Dictionary<string, string> IntezmenyAdminJelszavak = new Dictionary<string, string>();
int status = 0;
SQLCommand dal = new SQLCommand();
DataTable dt = (DataTable)(metroGrid.DataSource);
if (dt != null)
{
Helper.UpdateLogText(TBLog, "A táblázatból az intézménylista készítése elkezdődött!");
telepitendoIntezmenyek = Helper.ConvertDataTableToIntemenyAdatokList(dt);
Helper.UpdateLogText(TBLog, "A táblázatból az intézménylista készítése befejeződött!");
string validateInfo = ValidateIntezmenyAdatok(telepitendoIntezmenyek);
if (!string.IsNullOrEmpty(validateInfo))
{
int lineCount = validateInfo.Split('\n').Length;
Helper.UpdateLogText(TBLog, "Hibás sor a bevitt adatokban!");
Helper.UpdateLogText(TBLog, validateInfo);
MetroFramework.MetroMessageBox.Show(this, validateInfo, "Hibás sor a bevitt adatokban!", MessageBoxButtons.OK, MessageBoxIcon.Error, height: lineCount > 4 ? lineCount * 30 : 300);
}
else
{
Thread backgroundThread = new Thread(
new ThreadStart(() =>
{
Helper.UpdateStatusBar(progressBar, 1, true);
foreach (var telepitendoIntezmeny in telepitendoIntezmenyek)
{
Helper.UpdateLogText(TBLog, string.Format("{0}. intézmény [{1} ({2})] létrehozása elkezdődött ({3} tanévre)!", telepitendoIntezmeny.Sorszam, telepitendoIntezmeny.IntezmenyNev, telepitendoIntezmeny.IntezmenyKod, telepitendoIntezmeny.AktivTanev));
var adminJelszo = Helper.CreatePassword(8);
dal.Install(telepitendoIntezmeny, adminJelszo);
IntezmenyAdminJelszavak.Add(telepitendoIntezmeny.IntezmenyKod, adminJelszo);
status++;
Helper.UpdateStatusBar(progressBar, 1 + (int)((status * 98.0) / telepitendoIntezmenyek.Count), true);
Helper.UpdateLogText(TBLog, string.Format("{0}. intézmény [{1} ({2})] létrehozása befejeződött ({3} tanévre)!", telepitendoIntezmeny.Sorszam, telepitendoIntezmeny.IntezmenyNev, telepitendoIntezmeny.IntezmenyKod, telepitendoIntezmeny.AktivTanev));
}
Helper.UpdateLogText(TBLog, "Excel létrehozása az asztalon elkezdődött");
CreateExcelOnDesktop(IntezmenyAdminJelszavak);
Helper.UpdateLogText(TBLog, "Excel létrehozása az asztalon befejeződött");
if (AMICheckbox.Checked)
{
Helper.UpdateLogText(TBLog, string.Format("AMIModul telepítése elkezdődött a következő intézményekre: {0}! ", telepitendoIntezmenyek));
dal.AMIModulOn(Helper.TelepitettIntezmenyAzonositokString(telepitendoIntezmenyek));
Helper.UpdateLogText(TBLog, string.Format("AMIModul telepítése befejeződött a következő intézményekre: {0}! ", telepitendoIntezmenyek));
}
if (KoliCheckBox.Checked)
{
Helper.UpdateLogText(TBLog, string.Format("KoliModul telepítése elkezdődött a következő intézményekre: {0}! ", telepitendoIntezmenyek));
dal.KoliModulOn(Helper.TelepitettIntezmenyAzonositokString(telepitendoIntezmenyek));
Helper.UpdateLogText(TBLog, string.Format("KoliModul telepítése befejeződött a következő intézményekre: {0}! ", telepitendoIntezmenyek));
}
if (EGYMICheckbox.Checked)
{
Helper.UpdateLogText(TBLog, string.Format("EGYMIModul telepítése elkezdődött a következő intézményekre: {0}! ", telepitendoIntezmenyek));
dal.EGYMIModulOn(Helper.TelepitettIntezmenyAzonositokString(telepitendoIntezmenyek));
Helper.UpdateLogText(TBLog, string.Format("EGYMIModul telepítése befejeződött a következő intézményekre: {0}! ", telepitendoIntezmenyek));
}
Helper.UpdateStatusBar(progressBar, 100, true);
this.Invoke(new MethodInvoker(delegate
{
Open_excelFile.Visible = false;
installButton.Visible = false;
Helper.UpdateLogText(TBLog, "Sikeres telepítés! ");
if (MetroFramework.MetroMessageBox.Show(this, "\n\nSzeretne újabb sql -t futtatni?", "Sikeres telepítés!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
OpenAnotherFile();
}
telepitesEllenorzesButton.Visible = true;
newCommand.Visible = true;
}));
}
));
backgroundThread.Start();
}
AMICheckbox.Visible = false;
KoliCheckBox.Visible = false;
EGYMICheckbox.Visible = false;
}
}
void OpenAnotherFile()
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Title = "Open .sql file";
dialog.Filter = "SQL File (*.sql)|*.sql";
if (dialog.ShowDialog() == DialogResult.OK)
{
Helper.UpdateLogText(TBLog, "Sqlfájl futtatása elkezdődött! ");
try
{
if (new SQLCommand().ReadAndRunSqlFile(dialog.FileName))
{
MessageBox.Show("Sql művelet sikeresen végrehajtódott!");
}
}
catch (Exception ex)
{
Helper.UpdateLogText(TBLog, ex.Message);
throw;
}
Helper.UpdateLogText(TBLog, "Sqlfájl futtatása befejeződött! ");
}
else
{
return;
}
}
string ValidateIntezmenyAdatok(List<IntezmenyAdatok> intezmenyAdatok)
{
Helper.UpdateLogText(TBLog, "Intézményadatok validálása elkezdődött! ");
const string validateSpace = @"^[^\s]+$";
const string validateTanev = @"^([0-9]{4,4}[/][0-9]{4,4})+$";
string errorMsg = string.Empty;
foreach (var adat in intezmenyAdatok)
{
if (adat.Sorszam == 0)
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található Sorszám hibás";
}
if (string.IsNullOrEmpty(adat.OMKod))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található OMkod hibás";
}
if (string.IsNullOrEmpty(adat.IntezmenyNev))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorszámnál található IntezmenyNev hibás";
}
if (string.IsNullOrEmpty(adat.IntezmenyVezeto))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található IntezmenyVezeto hibás";
}
if (string.IsNullOrEmpty(adat.EmailCim))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található EmailCim hibás";
}
if (string.IsNullOrEmpty(adat.Tagintezmenykod))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban Tagintezmenykod sorszám hibás";
}
if (string.IsNullOrEmpty(adat.Megye))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található Megye hibás";
}
if (string.IsNullOrEmpty(adat.Iranyitoszam)) //karakterhosszúság?
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található Iranyitoszam hibás";
}
if (string.IsNullOrEmpty(adat.Telepules))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található Telepules hibás";
}
if (string.IsNullOrEmpty(adat.Kozterulet))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található Kozterulet hibás";
}
if (string.IsNullOrEmpty(adat.KozteruletJellege))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található KozteruletJellege hibás";
}
if (string.IsNullOrEmpty(adat.Hazszam))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található Hazszam hibás";
}
if (string.IsNullOrEmpty(adat.FenntartoAzonosito))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található FenntartoAzonosito hibás";
}
if (!string.IsNullOrEmpty(adat.IntezmenyKod) && !Regex.IsMatch(adat.IntezmenyKod, validateSpace))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található IntezmenyKod hibás";
}
if (!string.IsNullOrEmpty(adat.IntezmenyKod) && !Regex.IsMatch(adat.AktivTanev, validateTanev))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található AktivTanev hibás";
}
/*
if (string.IsNullOrEmpty(adat.KovetkezoTanev))
{
errorMsg += Environment.NewLine + $"{adat.Sorszam} sorban található KovetkezoTanev hibás";
}
*/
Helper.UpdateLogText(TBLog, "Intézményadatok validálása befejeződött! ");
}
return errorMsg;
}
private void newCommand_Click(object sender, EventArgs e)
{
OpenAnotherFile();
}
private void telepitesEllenorzesButton_Click(object sender, EventArgs e)
{
Helper.UpdateLogText(TBLog, "Telepítés ellenőrzése elkezdődött! ");
var sb = new StringBuilder();
Dictionary<string, bool> ellenorzottIntezmenyek = new Dictionary<string, bool>();
var ds = new DataSet();
foreach (var intezmeny in telepitendoIntezmenyek)
{
ds = new SQLCommand().TelepitesEllenorzes(intezmeny.IntezmenyKod);
if (ds.Tables[0].Rows.Count > 0)
{
ellenorzottIntezmenyek.Add(intezmeny.IntezmenyNev, true);
}
else
{
ellenorzottIntezmenyek.Add(intezmeny.IntezmenyNev, false);
}
}
foreach (var item in ellenorzottIntezmenyek)
{
string isLetrejott = item.Value ? "helyesen létrejött!" : "nem jött létre helyessen!";
Helper.UpdateLogText(TBLog, string.Format("{0} -> {1}", item.Key, isLetrejott));
sb.Append(Environment.NewLine + item.Key + " -> " + isLetrejott);
}
int lineCount = sb.ToString().Split('\n').Length;
MetroFramework.MetroMessageBox.Show(this, sb.ToString(), "Telepítés eredménye:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, height: lineCount > 4 ? lineCount * 30 : 300);
Helper.UpdateLogText(TBLog, "Telepítés ellenőrzése befejeződött! ");
}
void CreateExcelOnDesktop(Dictionary<string, string> adminJelszavak)
{
var desktop = Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory);
DataSet ds = new SQLCommand().LetrehozottIntemenyExcel(Helper.TelepitettIntezmenyAzonositokString(telepitendoIntezmenyek));
ds.Tables[0].Columns.Add("Admin jelszó", typeof(string));
foreach (KeyValuePair<string, string> item in adminJelszavak)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
if (ds.Tables[0].Rows[i].Field<string>("Intézmény azonosítója") == item.Key.ToString())
{
ds.Tables[0].Rows[i].SetField("Admin jelszó", item.Value.ToString());
}
}
}
using (var ms = new MemoryStream())
{
using (var excel = new ExcelPackage(ms))
{
ExcelWorksheet workSheet = excel.Workbook.Worksheets.Add("Létrehozott intézmények");
workSheet.Cells[1, 1].LoadFromDataTable(ds.Tables[0], true);
workSheet.Cells.AutoFitColumns();
for (int colum = 1; colum < ds.Tables[0].Columns.Count + 1; colum++)
{
workSheet.Cells[1, colum].Style.Font.Bold = true;
workSheet.Cells[1, colum].Style.Font.Size = 12;
workSheet.Cells[1, colum].Style.Fill.PatternType = ExcelFillStyle.Solid;
workSheet.Cells[1, colum].Style.Fill.BackgroundColor.SetColor(Color.Gray);
}
for (int row = 2; row < ds.Tables[0].Rows.Count + 1; row++)
{
workSheet.Cells[row, 3].Hyperlink = new Uri(workSheet.Cells[row, 3].Text, UriKind.Absolute);
}
excel.Save();
}
ms.Position = 0;
using (FileStream file = new FileStream($"{desktop}\\Létrehozott intezmenyek_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.xlsx", FileMode.Create, FileAccess.Write))
{
ms.WriteTo(file);
}
}
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<connectionStrings>
<add name="default" connectionString="Data Source=kretalocal;User ID=kreta;Password=Porcica1.;Initial Catalog=Kreta;Connection Timeout=30000;"/>
</connectionStrings>
<appSettings>
<add key="letrehozoszalakszama" value="1"/>
<add key="jelszogeneralas" value="true"/>
<add key="dbjelszo" value="Porcica1."/>
<add key="bindinghozzaadas" value="false"/>
<add key="bindinghost" value="e-kreta.hu"/>
<add key="bindingport" value="80"/>
<add key="bindingprotocol" value="http"/>
<add key="bindingsites" value="Kreta.Web"/>
<add key="kornyezet" value="KK"/>
</appSettings>
</configuration>

View File

@@ -0,0 +1,281 @@
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Windows.Forms;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
namespace Kreta.IntezmenyLetrehozo.Dal
{
public class SQLCommand
{
readonly string connectionString;
public SQLCommand()
{
this.connectionString = ConfigurationManager.ConnectionStrings["default"].ConnectionString;
}
public DataSet GetData(string query)
{
DataSet ds = new DataSet();
using (var sqlConnection = new SqlConnection(connectionString))
{
sqlConnection.Open();
var sqlServer = new Server(new ServerConnection(sqlConnection));
var database = sqlServer.Databases[sqlServer.ConnectionContext.DatabaseName];
SqlDataAdapter da = new SqlDataAdapter();
SqlCommand command = sqlConnection.CreateCommand();
command.CommandText = query;
da.SelectCommand = command;
da.Fill(ds);
sqlConnection.Close();
return ds;
}
}
bool ExecuteSqlCommand(string command)
{
using (SqlConnection sqlConnection = new SqlConnection(connectionString))
{
using (SqlCommand com = new SqlCommand(command, sqlConnection))
{
sqlConnection.Open();
com.CommandTimeout = 30000;
var sqlServer = new Server(new ServerConnection(sqlConnection));
var database = sqlServer.Databases[sqlServer.ConnectionContext.DatabaseName];
try
{
int? result = com.ExecuteNonQuery();
return result.HasValue;
}
catch (Exception ex)
{
MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
$"Details:\n\n{ex.StackTrace}");
throw;
}
}
}
}
public DataSet LetrehozottIntemenyExcel(string intezmenyAzonositok)
{
string query = $@"SELECT
intezemenyAdatok.C_NEV as 'Intézmény neve'
,intezemeny.C_AZONOSITO as 'Intézmény azonosítója'
,'https://' + intezemeny.C_AZONOSITO +'.e-kreta.hu' as 'Intézmény URL-je'
FROM T_INTEZMENY_OSSZES intezemeny
JOIN T_INTEZMENYADATOK_OSSZES intezemenyAdatok ON intezemeny.ID = intezemenyAdatok.C_INTEZMENYID
JOIN T_FELHASZNALOBELEPES_OSSZES fb ON fb.C_INTEZMENYID = intezemeny.ID AND C_BEJELENTKEZESINEV = 'admin'
WHERE
intezemeny.C_AZONOSITO in ({intezmenyAzonositok})";
return GetData(query);
}
public bool ReadAndRunSqlFile(string path)
{
bool isSucsess;
FileInfo file = new FileInfo(path);
string script = file.OpenText().ReadToEnd();
using (var sqlConnection = new SqlConnection(connectionString))
{
using (SqlCommand command = new SqlCommand(script, sqlConnection))
{
var sqlServer = new Server(new ServerConnection(sqlConnection));
var database = sqlServer.Databases[sqlServer.ConnectionContext.DatabaseName];
try
{
command.ExecuteNonQuery();
isSucsess = true;
}
catch (Exception ex)
{
MessageBox.Show($"\n\nError message: {ex.Message}\n\n");
throw;
}
}
}
return isSucsess;
}
public void Install(IntezmenyAdatok intezmeny, string adminJelszo)
{
string letrehozoSP = IntezmenyLetrehozoSpString(intezmeny, adminJelszo);
using (SqlConnection sqlConnection = new SqlConnection(connectionString))
{
using (SqlCommand installSP = new SqlCommand(letrehozoSP, sqlConnection))
{
installSP.CommandTimeout = 30000;
sqlConnection.Open();
var sqlServer = new Server(new ServerConnection(sqlConnection));
var database = sqlServer.Databases[sqlServer.ConnectionContext.DatabaseName];
SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
installSP.Transaction = sqlTransaction;
try
{
installSP.ExecuteNonQuery();
sqlTransaction.Commit();
sqlConnection.Close();
}
catch (Exception ex)
{
Helper.SaveLog(ex.Message, intezmeny.IntezmenyKod);
sqlTransaction.Rollback();
MessageBox.Show($"Hiba az intézmény létrehozásakor! Nézze meg az asztalon létrehozott log_{intezmeny.IntezmenyKod}_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.txt fájlt! \n\nError message: {ex.Message}\n\n");
throw;
}
}
}
}
public DataSet TelepitesEllenorzes(string intezmenyKod)
{
string sql = $@"SELECT
top(1) intezmeny.ID
FROM T_INTEZMENY intezmeny
JOIN (select ID, C_INTEZMENYID from T_TANEV) tanev ON tanev.C_INTEZMENYID = intezmeny.ID
JOIN (select ID, C_ALINTEZMENYID from T_CSOPORTTIPUS) csoportTipus ON C_ALINTEZMENYID = intezmeny.ID
JOIN (select ID, C_TANEVID from T_TANEVRENDJE) tanevRendje ON C_TANEVID = tanev.ID
JOIN (select ID, C_INTEZMENYID from T_CSOPORTTIPUS_FOGLALKOZASTIPU) csopFoglTip ON csopFoglTip.C_INTEZMENYID = intezmeny.ID
JOIN (select ID, C_INTEZMENYID from T_LICENCE) licence ON licence.C_INTEZMENYID = intezmeny.ID
JOIN (select ID, C_INTEZMENYID from T_FELHASZNALOBELEPES) fb ON fb.C_INTEZMENYID = intezmeny.ID
WHERE
C_AZONOSITO like '{intezmenyKod}'";
return GetData(sql);
}
string IntezmenyLetrehozoSpString(IntezmenyAdatok intezmeny, string adminJelszo)
{
const string scriptName = "[dev].[uspIntezmenyLetrehozas]";
var dbJelszo = ConfigurationManager.AppSettings["dbjelszo"];
return string.Format(@"
EXEC {0}
@fenntartoAzonosito = N'{1}',
@intezmenyAzonosito = N'{2}',
@tanevNeve = N'{3}',
@kovetkezoTanevNeve = N'{4}',
@intezmenyNeve = N'{5}',
@intezmenyIranyitoSzam = N'{6}',
@intezmenyVaros = N'{7}',
@intezmenyKozteruletNev = N'{8}',
@intezmenyKozteruletJellegNev = N'{9}',
@intezmenyHazszam = N'{10}',
@intezmenyEmelet = null,
@intezmenyAjto = null,
@intezmenyOMKod = N'{11}',
@intezmenyIgazgato = N'{12}',
@intezmenyTagkod = N'{13}',
@intezmenyEmail = N'{14}',
@adminJelszo = N'{15}',
@kellABHet = {16},
@teljesKreta = {17},
@dbJelszo = N'{18}'",
scriptName,
intezmeny.FenntartoAzonosito,
intezmeny.IntezmenyKod,
intezmeny.AktivTanev,
intezmeny.KovetkezoTanev,
intezmeny.IntezmenyNev,
intezmeny.Iranyitoszam,
intezmeny.Telepules,
intezmeny.Kozterulet,
intezmeny.KozteruletJellege,
intezmeny.Hazszam,
intezmeny.OMKod,
intezmeny.IntezmenyVezeto,
intezmeny.Tagintezmenykod,
intezmeny.EmailCim,
adminJelszo,
intezmeny.KellABHet ? 1 : 0,
intezmeny.TeljesKreta ? 1 : 0,
dbJelszo);
}
public void AMIModulOn(string intezmenyAzonosito)
{
string command = $@"UPDATE OktKat
SET
OktKat.C_FELADATCSOPORTTANULOOSZTALYK = 4
FROM T_OKTNEVELESIKATEGORIA OktKat
INNER JOIN T_TANEV tanev ON OktKat.C_ALTANEVID = tanev.ID AND tanev.TOROLT = 'F' AND tanev.C_AKTIV = 'T'
WHERE OktKat.ID = 7555
AND OktKat.C_ALINTEZMENYID IN (SELECT ID FROM T_INTEZMENY WHERE C_AZONOSITO IN ({intezmenyAzonosito}))
UPDATE OktFel
SET
OktFel.C_FELADATKATEGORIAID = 7555
FROM T_OKTATASINEVELESIFELADAT OktFel
INNER JOIN T_TANEV tanev ON OktFel.C_ALTANEVID = tanev.ID AND tanev.TOROLT = 'F' AND tanev.C_AKTIV = 'T'
WHERE OktFel.ID IN(1159,7664)
AND OktFel.C_ALINTEZMENYID IN (SELECT ID FROM T_INTEZMENY WHERE C_AZONOSITO IN ({intezmenyAzonosito}))";
ExecuteSqlCommand(command);
}
public void KoliModulOn(string intezmenyAzonosito)
{
string command = $@"UPDATE OktKat
SET
OktKat.C_FELADATCSOPORTTANULOOSZTALYK = 1
FROM T_OKTNEVELESIKATEGORIA OktKat
INNER JOIN T_TANEV tanev ON OktKat.C_ALTANEVID = tanev.ID AND tanev.TOROLT = 'F' AND tanev.C_AKTIV = 'T'
WHERE OktKat.ID = 7556
AND OktKat.C_ALINTEZMENYID IN (SELECT ID FROM T_INTEZMENY WHERE C_AZONOSITO IN ({intezmenyAzonosito}))
UPDATE OktFel
SET
OktFel.C_FELADATKATEGORIAID = 7556
FROM T_OKTATASINEVELESIFELADAT OktFel
INNER JOIN T_TANEV tanev ON OktFel.C_ALTANEVID = tanev.ID AND tanev.TOROLT = 'F' AND tanev.C_AKTIV = 'T'
WHERE OktFel.ID IN (1165,1166)
AND OktFel.C_ALINTEZMENYID IN (SELECT ID FROM T_INTEZMENY WHERE C_AZONOSITO IN ({intezmenyAzonosito}))";
ExecuteSqlCommand(command);
}
public void EGYMIModulOn(string intezmenyAzonosito)
{
string command = $@"UPDATE OktKat
SET
OktKat.C_FELADATCSOPORTTANULOOSZTALYK = 1
FROM T_OKTNEVELESIKATEGORIA OktKat
INNER JOIN T_TANEV tanev ON OktKat.C_ALTANEVID = tanev.ID AND tanev.TOROLT = 'F' AND tanev.C_AKTIV = 'T'
WHERE OktKat.ID = 7717
AND OktKat.C_ALINTEZMENYID IN (SELECT ID FROM T_INTEZMENY WHERE C_AZONOSITO IN ({intezmenyAzonosito}))
UPDATE OktFel
SET
OktFel.C_FELADATKATEGORIAID = 7717
FROM T_OKTATASINEVELESIFELADAT OktFel
INNER JOIN T_TANEV tanev ON OktFel.C_ALTANEVID = tanev.ID AND tanev.TOROLT = 'F' AND tanev.C_AKTIV = 'T'
WHERE OktFel.ID = 6711
AND OktFel.C_ALINTEZMENYID IN (SELECT ID FROM T_INTEZMENY WHERE C_AZONOSITO IN ({intezmenyAzonosito}))";
ExecuteSqlCommand(command);
}
}
}

View File

@@ -0,0 +1,63 @@
using System.Collections.Concurrent;
using System.Linq;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
namespace Kreta.IntezmenyLetrehozo
{
public class ExcelExport
{
private Worksheet worksheet;
private SharedStringTable sharedStringTable;
private SharedStringTablePart sharedStringTablePart;
public void Export(string excelPath, ConcurrentDictionary<string, string> adminJelszavak, ConcurrentDictionary<string, string> fenntartoJelszavak)
{
// excel fájl létrehozása
using (var spreadSheet = SpreadsheetDocument.Open(excelPath, true))
{
OpenExcelWorkbook(spreadSheet);
InsertDataIntoCells(adminJelszavak, fenntartoJelszavak);
}
}
void OpenExcelWorkbook(SpreadsheetDocument spreadSheet)
{
WorkbookPart workbookPart = spreadSheet.WorkbookPart;
if (workbookPart.GetPartsOfType<SharedStringTablePart>().Any())
{
sharedStringTablePart = workbookPart.GetPartsOfType<SharedStringTablePart>().First();
sharedStringTable = sharedStringTablePart.SharedStringTable;
}
var sheet = workbookPart.Workbook.Descendants<Sheet>().First();
var worksheetPart = (WorksheetPart)workbookPart.GetPartById(sheet.Id);
worksheet = worksheetPart.Worksheet;
}
private void InsertDataIntoCells(ConcurrentDictionary<string, string> adminJelszavak, ConcurrentDictionary<string, string> fenntartoJelszavak)
{
for (var sorIndex = 2; sorIndex < adminJelszavak.Count + 2; sorIndex++)
{
// intézmény kód (N)
var intezmenyKod = ExcelUtils.GetCellValue(worksheet, sharedStringTable, "N" + sorIndex);
// admin jelszó
if (adminJelszavak.ContainsKey(intezmenyKod))
{
var adminJelszo = adminJelszavak[intezmenyKod];
var cellReference = "U" + sorIndex;
Cell adminJelszoCell = ExcelUtils.CreateSpreadsheetCellIfNotExist(worksheet, cellReference);
int sharedIndex = ExcelUtils.InsertSharedStringItem(adminJelszo, sharedStringTablePart);
adminJelszoCell.CellValue = new CellValue(sharedIndex.ToString());
adminJelszoCell.DataType = CellValues.SharedString;
}
}
worksheet.Save();
}
}
}

View File

@@ -0,0 +1,216 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
namespace Kreta.IntezmenyLetrehozo
{
public class ExcelImport : IDisposable
{
protected Worksheet sheet;
protected SharedStringTablePart shareStringPart;
protected SpreadsheetDocument oDocument;
protected WorksheetPart worksheetPart;
protected SharedStringTable sharedstringtable;
public ExcelImport(Stream excelFileContent)
{
oDocument = SpreadsheetDocument.Open(excelFileContent, false);
WorkbookPart workbookPart = oDocument.WorkbookPart;
Sheet sheet1 = workbookPart.Workbook.Descendants<Sheet>().First();
worksheetPart = (WorksheetPart)workbookPart.GetPartById(sheet1.Id);
if (workbookPart.GetPartsOfType<SharedStringTablePart>().Any())
{
shareStringPart = workbookPart.GetPartsOfType<SharedStringTablePart>().First();
}
sharedstringtable = shareStringPart.SharedStringTable;
sheet = worksheetPart.Worksheet;
}
/// <summary>
/// Excel fájl (xlsx) import.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public List<IntezmenyAdatok> Import()
{
var result = new List<IntezmenyAdatok>();
using (var reader = OpenXmlReader.Create(worksheetPart))
{
var rowIndex = 1;
var item = new IntezmenyAdatok();
bool empty = true;
while (reader.Read())
{
if (reader.ElementType == typeof(Row))
{ // sorok
var currRowIndex = 0;
do
{
if (reader.HasAttributes)
currRowIndex = int.Parse(reader.Attributes.First(a => a.LocalName == "r").Value);
if (currRowIndex > 1 && reader.HasAttributes)
{
break;
}
} while (reader.ReadNextSibling());
if (currRowIndex > 1)
{
if (empty == false)
{
result.Add(item);
item = new IntezmenyAdatok();
}
empty = true;
}
rowIndex = currRowIndex;
}
if (reader.ElementType == typeof(Cell))
{ // cellák
var cell = reader.LoadCurrentElement() as Cell;
var cellValue = ExcelUtils.GetCellValue(sharedstringtable, cell);
if (string.IsNullOrEmpty(cellValue) == false)
empty = false;
var column = cell.CellReference.InnerText.Replace(rowIndex.ToString(), null);
if (string.IsNullOrEmpty(cellValue) && column == "A")
break;
switch (column)
{
case "A":
// Sorszám
item.Sorszam = Convert.ToInt32(cellValue.Replace(".", null));
break;
case "B":
// OM kód
item.OMKod = cellValue;
break;
case "C":
// Intézmény név
item.IntezmenyNev = cellValue;
break;
case "D":
// Intézményvezető
item.IntezmenyVezeto = cellValue;
break;
case "E":
// E-mail cím
item.EmailCim = cellValue;
break;
case "F":
// Tagintézmény kód
item.Tagintezmenykod = cellValue;
break;
case "G":
// Megye neve
item.Megye = cellValue;
break;
case "H":
// Irányítószám
item.Iranyitoszam = cellValue;
break;
case "I":
// Település neve
item.Telepules = cellValue;
break;
case "J":
// Cím közterület
item.Kozterulet = cellValue;
break;
case "K":
// Közterület jellege
item.KozteruletJellege = cellValue;
break;
case "L":
// Házszám
item.Hazszam = cellValue;
break;
case "M":
// Fenntartó azonosító
item.FenntartoAzonosito = cellValue;
break;
case "N":
// Intézmény kód
item.IntezmenyKod = cellValue;
break;
case "O":
// Aktív tanév
item.AktivTanev = cellValue;
break;
case "P":
// Következő tanév
item.KovetkezoTanev = cellValue;
break;
case "Q":
// Kell AB hét?
item.KellABHet = !string.IsNullOrWhiteSpace(cellValue) && cellValue.ToLower() == "igen";
break;
case "R":
// Teljes Kréta?
item.TeljesKreta = !string.IsNullOrWhiteSpace(cellValue) && cellValue.ToLower() == "igen";
break;
default:
break;
}
}
}
if (empty == false)
{
result.Add(item);
}
}
return result;
}
~ExcelImport()
{
Dispose();
}
public void Dispose()
{
oDocument.Dispose();
oDocument = null;
}
}
public class IntezmenyAdatok
{
public int Sorszam { get; set; }
public string OMKod { get; set; }
public string IntezmenyNev { get; set; }
public string IntezmenyVezeto { get; set; }
public string EmailCim { get; set; }
public string Tagintezmenykod { get; set; }
public string Megye { get; set; }
public string Iranyitoszam { get; set; }
public string Telepules { get; set; }
public string Kozterulet { get; set; }
public string KozteruletJellege { get; set; }
public string Hazszam { get; set; }
public string FenntartoAzonosito { get; set; }
public string IntezmenyKod { get; set; }
public string AktivTanev { get; set; }
public string KovetkezoTanev { get; set; }
public bool KellABHet { get; set; }
public bool TeljesKreta { get; set; }
}
}

View File

@@ -0,0 +1,295 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
namespace Kreta.IntezmenyLetrehozo
{
public static class ExcelUtils
{
#region Tulajdonságok
public const string ExcelVersion = "0.1";
const string versionNumberReference = "ZZ1";
public static string[] ColumnName = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
"AA", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AK", "AL", "AM", "AN", "AO", "AP", "AQ", "AR", "AS", "AT", "AU", "AV", "AW", "AX", "AY", "AZ",
"BA", "BB", "BC", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BK", "BL", "BM", "BN", "BO", "BP", "BQ", "BR", "BS", "BT", "BU", "BV", "BW", "BX", "BY", "BZ",
"CA", "CB", "CC", "CD", "CE", "CF", "CG", "CH", "CI", "CJ", "CK", "CL", "CM", "CN", "CO", "CP", "CQ", "CR", "CS", "CT", "CU", "CV", "CW", "CX", "CY", "CZ",
"DA", "DB", "DC", "DD", "DE", "DF", "DG", "DH", "DI", "DJ", "DK", "DL", "DM", "DN", "DO", "DP", "DQ", "DR", "DS", "DT", "DU", "DV", "DW", "DX", "DY", "DZ",
"EA", "EB", "EC", "ED", "EE", "EF", "EG", "EH", "EI", "EJ", "EK", "EL", "EM", "EN", "EO", "EP", "EQ", "ER", "ES", "ET", "EU", "EV", "EW", "EX", "EY", "EZ",
"FA", "FB", "FC", "FD", "FE", "FF", "FG", "FH", "FI", "FJ", "FK", "FL", "FM", "FN", "FO", "FP", "FQ", "FR", "FS", "FT", "FU", "FV", "FW", "FX", "FY", "FZ"};
#endregion
#region GetColumnNameIndex
public static uint GetColumnNameIndex(string colname)
{
uint index = 1;
foreach (var cname in ColumnName)
{
if (cname.Equals(colname))
{
break;
}
index++;
}
return index;
}
#endregion
#region GetColumnIndex
public static int GetColumnIndex(string reference)
{
int ci = 0;
reference = reference.ToUpper();
for (int ix = 0; ix < reference.Length && reference[ix] >= 'A'; ix++)
ci = (ci * 26) + ((int)reference[ix] - 64);
return ci;
}
#endregion
#region create cell in worksheet
// Given a column name, a row index, and a WorksheetPart, inserts a cell into the worksheet.
// If the cell already exists, returns it.
// Given a Worksheet and a cell name, verifies that the specified cell exists.
// If it does not exist, creates a new cell.
public static Cell CreateSpreadsheetCellIfNotExist(Worksheet worksheet, string cellName)
{
string columnName = GetColumnName(cellName);
uint rowIndex = GetRowIndex(cellName);
Cell cell = new Cell();
IEnumerable<Row> rows = worksheet.Descendants<Row>().Where(r => r.RowIndex.Value == rowIndex);
// If the Worksheet does not contain the specified row, create the specified row.
// Create the specified cell in that row, and insert the row into the Worksheet.
if (rows.Count() == 0)
{
Row row = new Row() { RowIndex = new UInt32Value(rowIndex) };
cell = new Cell() { CellReference = new StringValue(cellName) };
row.Append(cell);
worksheet.Descendants<SheetData>().First().Append(row);
}
else
{
Row row = rows.First();
IEnumerable<Cell> cells = row.Elements<Cell>().Where(c => c.CellReference.Value == cellName);
// If the row does not contain the specified cell, create the specified cell.
if (cells.Count() == 0)
{
cell = new Cell() { CellReference = new StringValue(cellName) };
row.Append(cell);
}
}
return cell;
}
#endregion
#region InsertSharedStringItem
// Given text and a SharedStringTablePart, creates a SharedStringItem with the specified text
// and inserts it into the SharedStringTablePart. If the item already exists, returns its index.
public static int InsertSharedStringItem(string text, SharedStringTablePart shareStringPart)
{
// If the part does not contain a SharedStringTable, create one.
if (shareStringPart.SharedStringTable == null)
{
shareStringPart.SharedStringTable = new SharedStringTable();
}
int i = 0;
// Iterate through all the items in the SharedStringTable. If the text already exists, return its index.
foreach (SharedStringItem item in shareStringPart.SharedStringTable.Elements<SharedStringItem>())
{
if (item.InnerText == text)
{
return i;
}
i++;
}
// The text does not exist in the part. Create the SharedStringItem and return its index.
shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new DocumentFormat.OpenXml.Spreadsheet.Text(text)));
shareStringPart.SharedStringTable.Save();
return i;
}
#endregion
#region GetColumnName
// Given a cell name, parses the specified cell to get the column name.
public static string GetColumnName(string cellName)
{
// Create a regular expression to match the column name portion of the cell name.
Regex regex = new Regex("[A-Za-z]+");
Match match = regex.Match(cellName);
return match.Value;
}
#endregion
#region GetRowIndex
// Given a cell name, parses the specified cell to get the row index.
public static uint GetRowIndex(string cellName)
{
// Create a regular expression to match the row index portion the cell name.
Regex regex = new Regex(@"\d+");
Match match = regex.Match(cellName);
return uint.Parse(match.Value);
}
#endregion
#region GetCell
/// <summary>
/// Visszaadja oszlop nev es sor index alapjan az adott cellat.
/// </summary>
/// <param name="worksheet"></param>
/// <param name="columnName"></param>
/// <param name="rowIndex"></param>
/// <returns></returns>
public static Cell GetCell(Worksheet worksheet,
string columnName, uint rowIndex)
{
Row row = GetRow(worksheet, rowIndex);
if (row == null)
return null;
IEnumerable<Cell> cells = row.Elements<Cell>().Where(c => string.Compare
(c.CellReference.Value, columnName +
rowIndex, StringComparison.OrdinalIgnoreCase) == 0);
if (cells.Count() == 0)
return null;
return cells.First();
}
#endregion
#region GetCellValue
public static string GetCellValue(Worksheet worksheet, SharedStringTable table, string reference)
{
var cell = worksheet.Descendants<Cell>().Where(c => string.Compare(c.CellReference.Value, reference, StringComparison.OrdinalIgnoreCase) == 0).FirstOrDefault();
if (cell == null)
return null;
if (cell.DataType == CellValues.SharedString)
return table.ElementAt(int.Parse(cell.InnerText)).InnerText;
return cell.InnerText;
}
#endregion
#region GetRow
/// <summary>
/// Visszaadja a sor indexe alapjan az adott sor referenciajat.
/// </summary>
/// <param name="worksheet"></param>
/// <param name="rowIndex"></param>
/// <returns></returns>
public static Row GetRow(Worksheet worksheet, uint rowIndex)
{
IEnumerable<Row> myRows = worksheet.GetFirstChild<SheetData>().
Elements<Row>().Where(r => r.RowIndex == rowIndex);
if (myRows.Count() == 0)
return null;
return myRows.First();
}
#endregion
#region GetCellValue2
/// <summary>
/// Visszaadja a cella alapjan a hozza tartozo erteket a sharedstring tablabol.
/// </summary>
/// <param name="table"></param>
/// <param name="cell"></param>
/// <returns></returns>
public static string GetCellValue(SharedStringTable table, Cell cell)
{
int index = -1;
if (cell.CellValue == null)
return "";
if (cell.DataType != null && cell.DataType == CellValues.SharedString && Int32.TryParse(cell.CellValue.Text, out index))
{
return table.Elements<SharedStringItem>().ElementAt(index).InnerText;
}
return cell.CellValue.InnerText;
}
#endregion
#region SetColumns
/// <summary>
/// beallitja az oszlopokat, elso korben a bestfitet.
/// </summary>
public static void SetColumns(Worksheet sheet, int colindex, double maxcolcharacter, bool hidden)
{
// ha nem letezik hozza oszlopok tulajdonsag
Columns cols;
if (sheet.Descendants<Columns>().Count() == 0)
{
cols = new Columns();
sheet.Append(cols);
}
else
{
cols = sheet.Descendants<Columns>().First();
}
// oszlop letrehozasa, ahol elrejtjuk a validacios listat
double maxcolwidth = Math.Truncate(((maxcolcharacter * 7 + 5) / 7 * 256) / 256) + 2;
Column col = new Column()
{
Min = new UInt32Value((uint)colindex),
Max = new UInt32Value((uint)colindex),
Width = new DoubleValue(maxcolwidth),
Hidden = new BooleanValue(hidden),
BestFit = new BooleanValue(true),
CustomWidth = new BooleanValue(true)
};
cols.Append(col);
}
#endregion
#region Excel columns count
public static int GetColumnCount(Worksheet sheet)
{
var row = sheet.Descendants<Row>().FirstOrDefault();
if (row != null)
return row.Descendants<Cell>().Count();
return 0;
}
#endregion
#region SetVersion
public static void SetVersion(Worksheet sheet, string versionNumber)
{
// verzió
// uj cella
Cell newVersionCell = CreateSpreadsheetCellIfNotExist(sheet, versionNumberReference);
// majd index alapjan referenciat adok ra
var version = string.IsNullOrEmpty(versionNumber) == false ? versionNumber : ExcelVersion;
newVersionCell.CellValue = new CellValue(version);
// ez bizony egy sharedstring tipus
newVersionCell.DataType = new EnumValue<CellValues>(CellValues.String);
SetColumns(sheet, GetColumnIndex(versionNumberReference), 0, true);
}
#endregion
}
}

View File

@@ -0,0 +1,133 @@
{
"KK": {
"KRETA_KLIK_00_AMITEST": "KAKH-KFEAAG002",
"KRETA_KLIK_01_GYORI": "KAKH-KFEAAG002",
"KRETA_KLIK_02_SOPRONI": "KAKH-KFEAAG010",
"KRETA_KLIK_03_SZOMBATHELYI": "KAKH-KFEAAG001",
"KRETA_KLIK_04_SARVARI": "KAKH-KFEAAG002",
"KRETA_KLIK_05_KECSKEMETI": "KAKH-KFEAAG013",
"KRETA_KLIK_06_KISKOROSI": "KAKH-KFEAAG010",
"KRETA_KLIK_07_BAJAI": "KAKH-KFEAAG002",
"KRETA_KLIK_08_SZEGEDI": "KAKH-KFEAAG010",
"KRETA_KLIK_09_HODMEZOVASARHELYI": "KAKH-KFEAAG012",
"KRETA_KLIK_10_SZEKSZARDI": "KAKH-KFEAAG001",
"KRETA_KLIK_11_TAMASI": "KAKH-KFEAAG011",
"KRETA_KLIK_12_KAPOSVARI": "KAKH-KFEAAG003",
"KRETA_KLIK_13_SIOFOKI": "KAKH-KFEAAG013",
"KRETA_KLIK_14_ZALAEGERSZEGI": "KAKH-KFEAAG001",
"KRETA_KLIK_15_NAGYKANIZSAI": "KAKH-KFEAAG011",
"KRETA_KLIK_16_GYULAI": "KAKH-KFEAAG003",
"KRETA_KLIK_17_BEKESCSABAI": "KAKH-KFEAAG012",
"KRETA_KLIK_18_SZOLNOKI": "KAKH-KFEAAG001",
"KRETA_KLIK_19_KARCAGI": "KAKH-KFEAAG003",
"KRETA_KLIK_20_ERDI": "KAKH-KFEAAG003",
"KRETA_KLIK_21_VACI": "KAKH-KFEAAG012",
"KRETA_KLIK_22_DUNAKESZI": "KAKH-KFEAAG012",
"KRETA_KLIK_23_NYIREGYHAZI": "KAKH-KFEAAG002",
"KRETA_KLIK_24_KISVARDAI": "KAKH-KFEAAG013",
"KRETA_KLIK_25_MATESZALKAI": "KAKH-KFEAAG002",
"KRETA_KLIK_26_DEBRECENI": "KAKH-KFEAAG003",
"KRETA_KLIK_27_BERETTYOUJFALUI": "KAKH-KFEAAG012",
"KRETA_KLIK_28_HAJDUBOSZORMENYI": "KAKH-KFEAAG001",
"KRETA_KLIK_29_EGRI": "KAKH-KFEAAG011",
"KRETA_KLIK_30_HATVANI": "KAKH-KFEAAG011",
"KRETA_KLIK_31_SZEKESFEHERVARI": "KAKH-KFEAAG013",
"KRETA_KLIK_32_DUNAUJVAROSI": "KAKH-KFEAAG003",
"KRETA_KLIK_33_VESZPREMI": "KAKH-KFEAAG010",
"KRETA_KLIK_34_BALATONFUREDI": "KAKH-KFEAAG013",
"KRETA_KLIK_35_PAPAI": "KAKH-KFEAAG001",
"KRETA_KLIK_36_ESZAK_BUDAPESTI": "KAKH-KFEAAG002",
"KRETA_KLIK_37_KELET_PESTI": "KAKH-KFEAAG001",
"KRETA_KLIK_38_BELSO_PESTI": "KAKH-KFEAAG010",
"KRETA_KLIK_39_ESZAK_PESTI": "KAKH-KFEAAG002",
"KRETA_KLIK_40_KOZEP_PESTI": "KAKH-KFEAAG011",
"KRETA_KLIK_41_KOZEP_BUDAI": "KAKH-KFEAAG011",
"KRETA_KLIK_42_KULSO_PESTI": "KAKH-KFEAAG003",
"KRETA_KLIK_43_DEL_PESTI": "KAKH-KFEAAG012",
"KRETA_KLIK_44_DEL_BUDAI": "KAKH-KFEAAG001",
"KRETA_KLIK_45_SZIGETSZENTMIKLOSI": "KAKH-KFEAAG013",
"KRETA_KLIK_46_MONORI": "KAKH-KFEAAG001",
"KRETA_KLIK_47_CEGLEDI": "KAKH-KFEAAG013",
"KRETA_KLIK_48_SALGOTARJANI": "KAKH-KFEAAG002",
"KRETA_KLIK_49_BALASSAGYARMATI": "KAKH-KFEAAG013",
"KRETA_KLIK_50_TATABANYAI": "KAKH-KFEAAG012",
"KRETA_KLIK_51_MOHACSI": "KAKH-KFEAAG003",
"KRETA_KLIK_52_SZIGETVARI": "KAKH-KFEAAG012",
"KRETA_KLIK_53_PECSI": "KAKH-KFEAAG011",
"KRETA_KLIK_54_MISKOLCI": "KAKH-KFEAAG010",
"KRETA_KLIK_55_SZERENCSI": "KAKH-KFEAAG010",
"KRETA_KLIK_56_SAROSPATAKI": "KAKH-KFEAAG010",
"KRETA_KLIK_57_KAZINCBARCIKAI": "KAKH-KFEAAG010",
"KRETA_KLIK_58_MEZOKOVESDI": "KAKH-KFEAAG011",
"KRETA_KLIK_59_JASZBERENYI": "KAKH-KFEAAG001",
"KRETA_KLIK_60_ESZTERGOMI": "KAKH-KFEAAG011",
"KRETA_LEP_1": "KAKH-KFEAAG008",
"KRETA_LEP_2": "KAKH-KFEAAG008",
"KRETA_LEP_3": "KAKH-KFEAAG008",
"KRETA_LEP_4": "KAKH-KFEAAG008"
},
"NSZFH": {
"NSZFH_01_BAJAI": "KRETA-SQL7\\INST7",
"NSZFH_02_BEKESCSABAI": "KRETA-SQL9\\INST9",
"NSZFH_03_BERETTYOUJFALUI": "KRETA-SQL9\\INST9",
"NSZFH_04_BPGAZDASAGI": "KRETA-SQL1\\INST1",
"NSZFH_05_BPGEPESZETI": "KRETA-SQL1\\INST1",
"NSZFH_06_BPKOMPLEX": "KRETA-SQL2\\INST2",
"NSZFH_07_BPMUSZAKI": "KRETA-SQL2\\INST2",
"NSZFH_08_BPVENDEGLATO": "KRETA-SQL2\\INST2",
"NSZFH_09_CEGLEDI": "KRETA-SQL6\\INST6",
"NSZFH_10_DEBRECENI": "KRETA-SQL10\\INST10",
"NSZFH_11_DUNAUJVAROSI": "KRETA-SQL6\\INST6",
"NSZFH_12_EGRI": "KRETA-SQL7\\INST7",
"NSZFH_13_ERDI": "KRETA-SQL6\\INST6",
"NSZFH_14_GYORIMUSZAKI": "KRETA-SQL3\\INST3",
"NSZFH_15_GYORISZOLGALTATASI": "KRETA-SQL3\\INST3",
"NSZFH_16_GYULAI": "KRETA-SQL10\\INST10",
"NSZFH_17_HODMEZOVASARHELYI": "KRETA-SQL9\\INST9",
"NSZFH_18_KAPOSVARI": "KRETA-SQL5\\INST5",
"NSZFH_19_KARCAGI": "KRETA-SQL8\\INST8",
"NSZFH_20_KECSKEMETI": "KRETA-SQL7\\INST7",
"NSZFH_21_KISKUNHALASI": "KRETA-SQL7\\INST7",
"NSZFH_22_KISVARDAI": "KRETA-SQL10\\INST10",
"NSZFH_23_MATESZALKAI": "KRETA-SQL10\\INST10",
"NSZFH_24_MISKOLCI": "KRETA-SQL8\\INST8",
"NSZFH_25_NAGYKANIZSAI": "KRETA-SQL4\\INST4",
"NSZFH_26_NYIREGYHAZI": "KRETA-SQL10\\INST10",
"NSZFH_27_OZDI": "KRETA-SQL8\\INST8",
"NSZFH_28_PAPAI": "KRETA-SQL4\\INST4",
"NSZFH_29_PECSI": "KRETA-SQL5\\INST5",
"NSZFH_30_SALGOTARJANI": "KRETA-SQL7\\INST7",
"NSZFH_31_SIOFOKI": "KRETA-SQL5\\INST5",
"NSZFH_32_SOPRONI": "KRETA-SQL3\\INST3",
"NSZFH_33_SZEGEDI": "KRETA-SQL9\\INST9",
"NSZFH_34_SZEKESFEHERVARI": "KRETA-SQL6\\INST6",
"NSZFH_35_SZEKSZARDI": "KRETA-SQL5\\INST5",
"NSZFH_36_SZERENCSI": "KRETA-SQL8\\INST8",
"NSZFH_37_SZOLNOKIMUSZAKI": "KRETA-SQL8\\INST8",
"NSZFH_38_SZOLNOKISZOLGALTATASI": "KRETA-SQL8\\INST8",
"NSZFH_39_SZOMBATHELYIMUSZAKI": "KRETA-SQL4\\INST4",
"NSZFH_40_SZOMBATHELYISZOLGALTATASI": "KRETA-SQL4\\INST4",
"NSZFH_41_TATABANYAI": "KRETA-SQL3\\INST3",
"NSZFH_42_VACI": "KRETA-SQL6\\INST6",
"NSZFH_43_VESZPREMI": "KRETA-SQL4\\INST4",
"NSZFH_44_ZALAEGERSZEGI": "KRETA-SQL4\\INST4"
},
"HOI": {
"KRETA": "WSFC-HOI-NODE1"
},
"AZURE": {
"KRETA_AZURE_111": "KRETASQL1",
"KRETA_AZURE_200A": "KRETASQL1",
"KRETA_AZURE_660_GYOR": "KRETASQL1",
"KRETA_AZURE_700_TISZANINNEN": "KRETASQL1",
"KRETA_AZURE_710_PANNONHALMA": "KRETASQL1",
"KRETA_AZURE_200": "KRETASQL2",
"KRETA_AZURE_200B": "KRETASQL2",
"KRETA_AZURE_200C": "KRETASQL2",
"KRETA_AZURE_670_KECSKEMET": "KRETASQL2",
"KRETA_AZURE_712_GOROG": "KRETASQL2",
"KRETA_AZURE_650": "KRETASQL3",
"KRETA_AZURE_701": "KRETASQL3",
"KRETA_AZURE_702": "KRETASQL3"
}
}

View File

@@ -0,0 +1,251 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using MetroFramework.Controls;
using Newtonsoft.Json;
namespace Kreta.IntezmenyLetrehozo
{
internal static class Helper
{
internal static Dictionary<string, string> GetFenntartokList(string kornyezet)
{
string JSONFile = "fenntartokJSON_set";
FileInfo executingAssembly = new FileInfo(Assembly.GetExecutingAssembly().Location);
string jsonString = File.ReadAllText(Path.Combine(executingAssembly.DirectoryName, "Fenntartok_JSON_set", $"{JSONFile}.json"));
Dictionary<string, Dictionary<string, string>> fenntartokListak = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(jsonString);
Dictionary<string, string> kornyezetLista = new Dictionary<string, string>();
fenntartokListak.TryGetValue(kornyezet, out kornyezetLista);
return kornyezetLista;
}
internal static Color MetroBlue()
{
Color myRgbColor = new Color();
myRgbColor = Color.FromArgb(0, 195, 227);
return myRgbColor;
}
internal static object GetPropertyValue(this object T, string PropName)
{
return T.GetType().GetProperty(PropName) == null ? null : T.GetType().GetProperty(PropName).GetValue(T, null);
}
internal static bool AreCellIsEmpty(this DataRow row)
{
bool isNullValue = false;
for (int i = 0; i < row.ItemArray.Length; i++)
{
if (row.ItemArray[i] == null || string.IsNullOrEmpty(row.ItemArray[i].ToString()) && i != 15)
{
isNullValue = true;
break;
}
}
return isNullValue;
}
internal static void SaveLog(string log, string intezemnyKod)
{
string strPath = Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory);
using (var logFile = new StreamWriter($"{strPath}\\log_{intezemnyKod}_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.txt"))
{
logFile.Write(log);
}
}
internal static string TelepitettIntezmenyAzonositokString(List<IntezmenyAdatok> intezmenyek)
{
StringBuilder sb = new StringBuilder();
foreach (var intezmeny in intezmenyek)
{
sb.Append("'" + intezmeny.IntezmenyKod + "'" + ",");
}
return sb.ToString().TrimEnd(',');
}
internal static string CreatePassword(int length)
{
var jelszoGeneralas = Convert.ToBoolean(ConfigurationManager.AppSettings["jelszogeneralas"]);
if (jelszoGeneralas)
{
const string valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var res = new StringBuilder();
while (0 < length--)
{
res.Append(valid[RandomGeneretator.Next(valid.Length)]);
}
return res.ToString();
}
return "a";
}
static class RandomGeneretator
{
private static readonly Random globalRandom = new Random(Environment.TickCount);
[ThreadStatic]
private static Random localRandom;
public static int Next(int maxValue)
{
if (localRandom == null)
{
int seed;
lock (globalRandom)
{
seed = globalRandom.Next();
}
localRandom = new Random(seed);
}
return localRandom.Next(maxValue);
}
}
internal static int GetKozteruletJellegId(string kozteruletJellege)
{
int kozteruletJellegId = 911; //Na
switch (kozteruletJellege?.Trim().ToLower())
{
case "fasor":
kozteruletJellegId = 920;
break;
case "körút":
kozteruletJellegId = 938;
break;
case "köz":
kozteruletJellegId = 939;
break;
case "sor":
kozteruletJellegId = 954;
break;
case "sugárút":
kozteruletJellegId = 955;
break;
case "sétány":
kozteruletJellegId = 958;
break;
case "tér":
kozteruletJellegId = 961;
break;
case "utca":
kozteruletJellegId = 964;
break;
case "út":
kozteruletJellegId = 965;
break;
case "útja":
kozteruletJellegId = 966;
break;
}
return kozteruletJellegId;
}
internal static void UpdateStatusBar(MetroProgressBar progressBar, int status, bool? Visible = null)
{
progressBar.BeginInvoke(
new Action(() =>
{
if (Visible.HasValue)
progressBar.Visible = Visible.Value;
progressBar.Value = status;
progressBar.Update();
}));
}
internal static void UpdateLogText(TextBox control, string text)
{
control.BeginInvoke(
new Action(() =>
{
control.AppendText(string.Format(text + " - {0}! {1}", GetDatumForLog(), Environment.NewLine));
control.Update();
}));
}
internal static DataTable ConvertListToDataTable(List<IntezmenyAdatok> list)
{
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(IntezmenyAdatok));
DataTable dt = new DataTable();
for (int i = 0; i < props.Count; i++)
{
PropertyDescriptor prop = props[i];
dt.Columns.Add(prop.Name, prop.PropertyType);
}
object[] values = new object[props.Count];
foreach (IntezmenyAdatok item in list)
{
for (int i = 0; i < values.Length; i++)
{
values[i] = props[i].GetValue(item);
}
dt.Rows.Add(values);
}
return dt;
}
internal static List<IntezmenyAdatok> ConvertDataTableToIntemenyAdatokList(DataTable dt)
{
var result = new List<IntezmenyAdatok>();
foreach (DataRow row in dt.Rows)
{
if (!row.AreCellIsEmpty())
{
var intezmeny = new IntezmenyAdatok();
intezmeny.Sorszam = row.Field<int>("Sorszam");
intezmeny.OMKod = row.Field<string>("OMKod");
intezmeny.IntezmenyNev = row.Field<string>("IntezmenyNev");
intezmeny.IntezmenyVezeto = row.Field<string>("IntezmenyVezeto");
intezmeny.EmailCim = row.Field<string>("EmailCim");
intezmeny.Tagintezmenykod = row.Field<string>("Tagintezmenykod");
intezmeny.Megye = row.Field<string>("Megye");
intezmeny.Iranyitoszam = row.Field<string>("Iranyitoszam");
intezmeny.Telepules = row.Field<string>("Telepules");
intezmeny.Kozterulet = row.Field<string>("Kozterulet");
intezmeny.KozteruletJellege = row.Field<string>("KozteruletJellege");
intezmeny.Hazszam = row.Field<string>("Hazszam");
intezmeny.FenntartoAzonosito = row.Field<string>("FenntartoAzonosito");
intezmeny.IntezmenyKod = row.Field<string>("IntezmenyKod");
intezmeny.AktivTanev = row.Field<string>("AktivTanev");
intezmeny.KovetkezoTanev = row.Field<string>("KovetkezoTanev");
intezmeny.KellABHet = row.Field<bool>("KellABHet");
intezmeny.TeljesKreta = row.Field<bool>("TeljesKreta");
result.Add(intezmeny);
}
}
return result;
}
internal static string GetDatumForLog()
{
return DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss");
}
}
}

View File

@@ -0,0 +1,22 @@
using System.Configuration;
using System.Data.SqlClient;
namespace Kreta.IntezmenyLetrehozo.Ablakok.KezdoAblak
{
internal class UpdateConfig
{
internal void UpdateMSSQLConnectionString(string dataSoure, string dbName)
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
var builder = new SqlConnectionStringBuilder(config.ConnectionStrings.ConnectionStrings["default"].ConnectionString);
builder.InitialCatalog = dbName;
builder.DataSource = dataSoure;
config.ConnectionStrings.ConnectionStrings["default"].ConnectionString = builder.ConnectionString;
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("connectionStrings");
}
}
}

View File

@@ -0,0 +1,225 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E7E26041-059A-4A58-92FA-AA0C82F92210}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Kreta.IntezmenyLetrehozo</RootNamespace>
<AssemblyName>Kreta.IntezmenyLetrehozo</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>intezmeny_kdU_icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="ClosedXML, Version=0.94.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ClosedXML.0.94.2\lib\net46\ClosedXML.dll</HintPath>
</Reference>
<Reference Include="DocumentFormat.OpenXml, Version=2.7.2.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
<HintPath>..\packages\DocumentFormat.OpenXml.2.7.2\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
</Reference>
<Reference Include="EPPlus, Version=4.1.0.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
<HintPath>..\packages\EPPlus.4.1.0\lib\net40\EPPlus.dll</HintPath>
</Reference>
<Reference Include="ExcelNumberFormat, Version=1.0.3.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca, processorArchitecture=MSIL">
<HintPath>..\packages\ExcelNumberFormat.1.0.3\lib\net20\ExcelNumberFormat.dll</HintPath>
</Reference>
<Reference Include="FastMember, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\FastMember.1.3.0\lib\net45\FastMember.dll</HintPath>
</Reference>
<Reference Include="MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.dll</HintPath>
</Reference>
<Reference Include="MetroFramework.Design, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Design.dll</HintPath>
</Reference>
<Reference Include="MetroFramework.Fonts, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Fonts.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Office.Interop.Excel.15.0.4795.1000\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.SqlServer.ConnectionInfo, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Unofficial.Microsoft.SQLServer.SMO.2014.12.0.2000.8\lib\Microsoft.SqlServer.ConnectionInfo.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SqlServer.ConnectionInfoExtended, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Unofficial.Microsoft.SQLServer.SMO.2014.12.0.2000.8\lib\Microsoft.SqlServer.ConnectionInfoExtended.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SqlServer.Management.Sdk.Sfc, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Unofficial.Microsoft.SQLServer.SMO.2014.12.0.2000.8\lib\Microsoft.SqlServer.Management.Sdk.Sfc.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SqlServer.Smo, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Unofficial.Microsoft.SQLServer.SMO.2014.12.0.2000.8\lib\Microsoft.SqlServer.Smo.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SqlServer.SmoExtended, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Unofficial.Microsoft.SQLServer.SMO.2014.12.0.2000.8\lib\Microsoft.SqlServer.SmoExtended.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SqlServer.SqlClrProvider, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Unofficial.Microsoft.SQLServer.SMO.2014.12.0.2000.8\lib\Microsoft.SqlServer.SqlClrProvider.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SqlServer.SqlEnum, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Unofficial.Microsoft.SQLServer.SMO.2014.12.0.2000.8\lib\Microsoft.SqlServer.SqlEnum.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.Administration.7.0.0.0\lib\net20\Microsoft.Web.Administration.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="OfficeOpenXml.Extends, Version=1.0.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OfficeOpenXml.Extends.1.0.6.0\lib\net40\OfficeOpenXml.Extends.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.0.1\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.Packaging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Packaging.4.0.0\lib\net46\System.IO.Packaging.dll</HintPath>
</Reference>
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="HelperClasses\UpdateConfig.cs" />
<Compile Include="DAL\SQLCommand.cs" />
<Compile Include="Ablakok\TelepitoAblak\SelectAndValidateExcelWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Ablakok\TelepitoAblak\SelectAndValidateExcelWindow.Designer.cs">
<DependentUpon>SelectAndValidateExcelWindow.cs</DependentUpon>
</Compile>
<Compile Include="ExcelTools\ExcelExport.cs" />
<Compile Include="ExcelTools\ExcelImport.cs" />
<Compile Include="ExcelTools\ExcelUtils.cs" />
<Compile Include="HelperClasses\Helper.cs" />
<Compile Include="Ablakok\KezdoAblak\ListItem.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Ablakok\KezdoAblak\ListItem.Designer.cs">
<DependentUpon>ListItem.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Ablakok\KezdoAblak\SelectEnvirnomentWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Ablakok\KezdoAblak\SelectEnvirnomentWindow.Designer.cs">
<DependentUpon>SelectEnvirnomentWindow.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="Ablakok\TelepitoAblak\SelectAndValidateExcelWindow.resx">
<DependentUpon>SelectAndValidateExcelWindow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Ablakok\KezdoAblak\ListItem.resx">
<DependentUpon>ListItem.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="Ablakok\KezdoAblak\SelectEnvirnomentWindow.resx">
<DependentUpon>SelectEnvirnomentWindow.cs</DependentUpon>
</EmbeddedResource>
<None Include="IntezmenyList.xlsx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="Fenntartok_JSON_set\fenntartokJSON_set.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\gadget_item_icon_selected.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Webp.net-resizeimage.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Webp.net-resizeimage %282%29.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\intezmeny_kdU_icon.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\setUp.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\download_2_512_stL_icon.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="intezmeny_kdU_icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using Kreta.IntezmenyLetrehozo;
namespace Kreta.IntezmenyLetrehozo
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.Run(new Kreta.IntezmenyLetrehozo.SelectEnvirnomentWindow());
/*
if (args.Length == 1)
{
// excel file path
var excelFile = args[0];
var watch = new Stopwatch();
watch.Start();
List<IntezmenyAdatok> items;
using (var fileStream = File.OpenRead(excelFile))
{
var import = new ExcelImport(fileStream);
items = import.Import();
}
Console.WriteLine($"{excelFile} excel fájl beolvasva! ({items.Count} db intézményi adat)");
var letrehozo = new IntezmenyLetrehozo();
var log = letrehozo.Letrehozas(items, excelFile);
watch.Stop();
var logMessage = $"Az összes intézmény sikeresen létre lett hozva! ({watch.Elapsed} idő alatt)";
using (var logFile = new StreamWriter($"log_{DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")}.txt"))
{
logFile.Write(log);
logFile.WriteLine(logMessage);
}
Console.WriteLine(logMessage);
}
else
{
Console.WriteLine("Paraméterként át kell adni az intézményi adatokat tartalmazó excel fájlt (xlsx)!");
}
Console.ReadLine();
*/
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Kreta.IntezmenyLetrehozo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Kreta.IntezmenyLetrehozo")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e7e26041-059a-4a58-92fa-aa0c82f92210")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Kreta.IntezmenyLetrehozo.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Kreta.IntezmenyLetrehozo.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon install {
get {
object obj = ResourceManager.GetObject("install", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap intezmeny_blue {
get {
object obj = ResourceManager.GetObject("intezmeny_blue", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon intezmeny_kdU_icon {
get {
object obj = ResourceManager.GetObject("intezmeny_kdU_icon", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap kreta_icon {
get {
object obj = ResourceManager.GetObject("kreta_icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="install" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\download_2_512_stL_icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="intezmeny_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Webp.net-resizeimage (2).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="intezmeny_kdU_icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\intezmeny_kdU_icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="kreta_icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\gadget_item_icon_selected.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Kreta.IntezmenyLetrehozo.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.2.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ClosedXML" version="0.94.2" targetFramework="net48" />
<package id="DocumentFormat.OpenXml" version="2.7.2" targetFramework="net48" />
<package id="EPPlus" version="4.1.0" targetFramework="net48" />
<package id="ExcelNumberFormat" version="1.0.3" targetFramework="net48" />
<package id="FastMember" version="1.3.0" targetFramework="net48" />
<package id="MetroModernUI" version="1.4.0.0" targetFramework="net48" />
<package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1000" targetFramework="net48" />
<package id="Microsoft.Web.Administration" version="7.0.0.0" targetFramework="net48" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net48" />
<package id="OfficeOpenXml.Extends" version="1.0.6.0" targetFramework="net48" />
<package id="System.IO.FileSystem.Primitives" version="4.0.1" targetFramework="net48" />
<package id="System.IO.Packaging" version="4.0.0" targetFramework="net48" />
<package id="Unofficial.Microsoft.SQLServer.SMO.2014" version="12.0.2000.8" targetFramework="net48" />
</packages>