diff --git a/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.Designer.cs index e1a69d6..f029804 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.Designer.cs @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeSoftware() + private void InitializeComponent() { this.comboBoxPackage = new System.Windows.Forms.ComboBox(); this.textBoxCount = new System.Windows.Forms.TextBox(); @@ -36,13 +36,15 @@ this.labelSum = new System.Windows.Forms.Label(); this.buttonSave = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); + this.labelClient = new System.Windows.Forms.Label(); + this.comboBoxClient = new System.Windows.Forms.ComboBox(); this.SuspendLayout(); // // comboBoxPackage // this.comboBoxPackage.BackColor = System.Drawing.SystemColors.Window; this.comboBoxPackage.FormattingEnabled = true; - this.comboBoxPackage.Location = new System.Drawing.Point(110, 24); + this.comboBoxPackage.Location = new System.Drawing.Point(110, 55); this.comboBoxPackage.Name = "comboBoxPackage"; this.comboBoxPackage.Size = new System.Drawing.Size(310, 23); this.comboBoxPackage.TabIndex = 0; @@ -50,7 +52,7 @@ // // textBoxCount // - this.textBoxCount.Location = new System.Drawing.Point(110, 62); + this.textBoxCount.Location = new System.Drawing.Point(110, 90); this.textBoxCount.Name = "textBoxCount"; this.textBoxCount.Size = new System.Drawing.Size(310, 23); this.textBoxCount.TabIndex = 1; @@ -58,7 +60,7 @@ // // textBoxSum // - this.textBoxSum.Location = new System.Drawing.Point(110, 101); + this.textBoxSum.Location = new System.Drawing.Point(110, 122); this.textBoxSum.Name = "textBoxSum"; this.textBoxSum.Size = new System.Drawing.Size(310, 23); this.textBoxSum.TabIndex = 2; @@ -66,7 +68,7 @@ // labelPackage // this.labelPackage.AutoSize = true; - this.labelPackage.Location = new System.Drawing.Point(29, 27); + this.labelPackage.Location = new System.Drawing.Point(29, 55); this.labelPackage.Name = "labelPackage"; this.labelPackage.Size = new System.Drawing.Size(42, 15); this.labelPackage.TabIndex = 3; @@ -75,7 +77,7 @@ // labelCount // this.labelCount.AutoSize = true; - this.labelCount.Location = new System.Drawing.Point(29, 65); + this.labelCount.Location = new System.Drawing.Point(29, 87); this.labelCount.Name = "labelCount"; this.labelCount.Size = new System.Drawing.Size(75, 15); this.labelCount.TabIndex = 4; @@ -84,7 +86,7 @@ // labelSum // this.labelSum.AutoSize = true; - this.labelSum.Location = new System.Drawing.Point(29, 104); + this.labelSum.Location = new System.Drawing.Point(29, 122); this.labelSum.Name = "labelSum"; this.labelSum.Size = new System.Drawing.Size(48, 15); this.labelSum.TabIndex = 5; @@ -92,7 +94,7 @@ // // buttonSave // - this.buttonSave.Location = new System.Drawing.Point(247, 132); + this.buttonSave.Location = new System.Drawing.Point(250, 151); this.buttonSave.Name = "buttonSave"; this.buttonSave.Size = new System.Drawing.Size(75, 23); this.buttonSave.TabIndex = 6; @@ -102,7 +104,7 @@ // // buttonCancel // - this.buttonCancel.Location = new System.Drawing.Point(345, 132); + this.buttonCancel.Location = new System.Drawing.Point(345, 151); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.TabIndex = 7; @@ -110,11 +112,31 @@ this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); // + // labelClient + // + this.labelClient.AutoSize = true; + this.labelClient.Location = new System.Drawing.Point(29, 21); + this.labelClient.Name = "labelClient"; + this.labelClient.Size = new System.Drawing.Size(49, 15); + this.labelClient.TabIndex = 8; + this.labelClient.Text = "Клиент:"; + // + // comboBoxClient + // + this.comboBoxClient.BackColor = System.Drawing.SystemColors.Window; + this.comboBoxClient.FormattingEnabled = true; + this.comboBoxClient.Location = new System.Drawing.Point(110, 18); + this.comboBoxClient.Name = "comboBoxClient"; + this.comboBoxClient.Size = new System.Drawing.Size(310, 23); + this.comboBoxClient.TabIndex = 9; + // // FormCreateOrder // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(450, 167); + this.ClientSize = new System.Drawing.Size(450, 186); + this.Controls.Add(this.comboBoxClient); + this.Controls.Add(this.labelClient); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.buttonSave); this.Controls.Add(this.labelSum); @@ -125,9 +147,9 @@ this.Controls.Add(this.comboBoxPackage); this.Name = "FormCreateOrder"; this.Text = "Заказ"; + this.Load += new System.EventHandler(this.FormCreateOrder_Load); this.ResumeLayout(false); this.PerformLayout(); - this.Load += new System.EventHandler(this.FormCreateOrder_Load); } @@ -141,5 +163,7 @@ private Label labelSum; private Button buttonSave; private Button buttonCancel; + private Label labelClient; + private ComboBox comboBoxClient; } } \ No newline at end of file diff --git a/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.cs b/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.cs index 16f413f..78314b7 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.cs @@ -10,12 +10,14 @@ namespace SoftwareInstallationView private readonly ILogger _logger; private readonly IPackageLogic _logicP; private readonly IOrderLogic _logicO; - public FormCreateOrder(ILogger logger, IPackageLogic logicP, IOrderLogic logicO) + private readonly IClientLogic _logicC; + public FormCreateOrder(ILogger logger, IPackageLogic logicP, IOrderLogic logicO, IClientLogic logicC) { - InitializeSoftware(); + InitializeComponent(); _logger = logger; _logicP = logicP; _logicO = logicO; + _logicC = logicC; LoadData(); } private void LoadData() @@ -38,6 +40,24 @@ namespace SoftwareInstallationView MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } + _logger.LogInformation("Загрузка клиентов для заказа"); + try + { + var list = _logicC.ReadList(null); + if (list != null) + { + comboBoxClient.DisplayMember = "ClientFIO"; + comboBoxClient.ValueMember = "Id"; + comboBoxClient.DataSource = list; + comboBoxClient.SelectedItem = null; + } + + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки списка клиентов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } private void FormCreateOrder_Load(object sender, EventArgs e) { @@ -123,7 +143,6 @@ namespace SoftwareInstallationView DialogResult = DialogResult.Cancel; Close(); } - } } diff --git a/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs index c93deac..4a1f0db 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs @@ -28,7 +28,7 @@ namespace SoftwareInstallationView /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeSoftware() + private void InitializeComponent() { this.dataGridView = new System.Windows.Forms.DataGridView(); this.buttonCreateOrder = new System.Windows.Forms.Button(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormMain.cs b/SoftwareInstallation/SoftwareInstallation/FormMain.cs index 7f9ada6..0a977a9 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormMain.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormMain.cs @@ -22,7 +22,7 @@ namespace SoftwareInstallationView public FormMain(ILogger logger, IOrderLogic orderLogic , IReportLogic reportLogic) { - InitializeSoftware(); + InitializeComponent(); _logger = logger; _orderLogic = orderLogic; _reportLogic = reportLogic; diff --git a/SoftwareInstallation/SoftwareInstallation/FormMain.resx b/SoftwareInstallation/SoftwareInstallation/FormMain.resx index 938108a..f298a7b 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormMain.resx +++ b/SoftwareInstallation/SoftwareInstallation/FormMain.resx @@ -57,7 +57,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - \ No newline at end of file diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs index db57d10..bc82d79 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeSoftware() + private void InitializeComponent() { this.textBoxName = new System.Windows.Forms.TextBox(); this.textBoxPrice = new System.Windows.Forms.TextBox(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackage.cs b/SoftwareInstallation/SoftwareInstallation/FormPackage.cs index 64ed87d..3756f0c 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackage.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackage.cs @@ -17,7 +17,7 @@ namespace SoftwareInstallationView public FormPackage(ILogger logger, IPackageLogic logic) { - InitializeSoftware(); + InitializeComponent(); _logger = logger; _logic = logic; _packageSoftwares = new Dictionary(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.Designer.cs index 129e20e..c06b790 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.Designer.cs @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeSoftware() + private void InitializeComponent() { this.textBox1 = new System.Windows.Forms.TextBox(); this.comboBoxSoftware = new System.Windows.Forms.ComboBox(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.cs b/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.cs index 9ae7451..0374af1 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.cs @@ -46,7 +46,7 @@ namespace SoftwareInstallationView public FormPackageSoftware(ISoftwareLogic logic) { - InitializeSoftware(); + InitializeComponent(); _list = logic.ReadList(null); if (_list != null) { diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackages.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormPackages.Designer.cs index 66e6372..28c3a2b 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackages.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackages.Designer.cs @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeSoftware() + private void InitializeComponent() { this.dataGridView = new System.Windows.Forms.DataGridView(); this.ColumnId = new System.Windows.Forms.DataGridViewTextBoxColumn(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackages.cs b/SoftwareInstallation/SoftwareInstallation/FormPackages.cs index 25e04ed..acf6220 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackages.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackages.cs @@ -11,7 +11,7 @@ namespace SoftwareInstallationView private readonly IPackageLogic _logic; public FormPackages(ILogger logger, IPackageLogic logic) { - InitializeSoftware(); + InitializeComponent(); _logger = logger; _logic = logic; LoadData(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormSoftware.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormSoftware.Designer.cs index 34da41f..bed9dc9 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormSoftware.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormSoftware.Designer.cs @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeSoftware() + private void InitializeComponent() { this.textBoxName = new System.Windows.Forms.TextBox(); this.textBoxCost = new System.Windows.Forms.TextBox(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormSoftware.cs b/SoftwareInstallation/SoftwareInstallation/FormSoftware.cs index 1e1b2cc..95bf8d3 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormSoftware.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormSoftware.cs @@ -13,7 +13,7 @@ namespace SoftwareInstallation public int Id { set { _id = value; } } public FormSoftware(ILogger logger, ISoftwareLogic logic) { - InitializeSoftware(); + InitializeComponent(); _logger = logger; _logic = logic; } diff --git a/SoftwareInstallation/SoftwareInstallation/FormSoftwares.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormSoftwares.Designer.cs index 043b06e..61c84ab 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormSoftwares.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormSoftwares.Designer.cs @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeSoftware() + private void InitializeComponent() { this.buttonAdd = new System.Windows.Forms.Button(); this.buttonEdit = new System.Windows.Forms.Button(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormSoftwares.cs b/SoftwareInstallation/SoftwareInstallation/FormSoftwares.cs index c7d456f..cffd2b8 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormSoftwares.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormSoftwares.cs @@ -9,7 +9,7 @@ namespace SoftwareInstallationView { public FormSoftwares(ILogger logger, ISoftwareLogic logic) { - InitializeSoftware(); + InitializeComponent(); _logger = logger; _logic = logic; LoadData();