PIbd-23 Dolgov D. A. Lab Work 5 #8

Closed
devil_1nc wants to merge 9 commits from LabWork05 into LabWork04
15 changed files with 69 additions and 29 deletions
Showing only changes of commit 75b48e5b57 - Show all commits

View File

@ -26,7 +26,7 @@
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@ -10,12 +10,14 @@ namespace SoftwareInstallationView
private readonly ILogger _logger;
private readonly IPackageLogic _logicP;
private readonly IOrderLogic _logicO;
public FormCreateOrder(ILogger<FormCreateOrder> logger, IPackageLogic logicP, IOrderLogic logicO)
private readonly IClientLogic _logicC;
public FormCreateOrder(ILogger<FormCreateOrder> 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();
}
}
}

View File

@ -28,7 +28,7 @@ namespace SoftwareInstallationView
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeSoftware()
private void InitializeComponent()
{
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonCreateOrder = new System.Windows.Forms.Button();

View File

@ -22,7 +22,7 @@ namespace SoftwareInstallationView
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic , IReportLogic reportLogic)
{
InitializeSoftware();
InitializeComponent();
_logger = logger;
_orderLogic = orderLogic;
_reportLogic = reportLogic;

View File

@ -57,7 +57,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -26,7 +26,7 @@
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeSoftware()
private void InitializeComponent()
{
this.textBoxName = new System.Windows.Forms.TextBox();
this.textBoxPrice = new System.Windows.Forms.TextBox();

View File

@ -17,7 +17,7 @@ namespace SoftwareInstallationView
public FormPackage(ILogger<FormPackage> logger, IPackageLogic logic)
{
InitializeSoftware();
InitializeComponent();
_logger = logger;
_logic = logic;
_packageSoftwares = new Dictionary<int, (ISoftwareModel, int)>();

View File

@ -26,7 +26,7 @@
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeSoftware()
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.comboBoxSoftware = new System.Windows.Forms.ComboBox();

View File

@ -46,7 +46,7 @@ namespace SoftwareInstallationView
public FormPackageSoftware(ISoftwareLogic logic)
{
InitializeSoftware();
InitializeComponent();
_list = logic.ReadList(null);
if (_list != null)
{

View File

@ -26,7 +26,7 @@
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeSoftware()
private void InitializeComponent()
{
this.dataGridView = new System.Windows.Forms.DataGridView();
this.ColumnId = new System.Windows.Forms.DataGridViewTextBoxColumn();

View File

@ -11,7 +11,7 @@ namespace SoftwareInstallationView
private readonly IPackageLogic _logic;
public FormPackages(ILogger<FormPackages> logger, IPackageLogic logic)
{
InitializeSoftware();
InitializeComponent();
_logger = logger;
_logic = logic;
LoadData();

View File

@ -26,7 +26,7 @@
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeSoftware()
private void InitializeComponent()
{
this.textBoxName = new System.Windows.Forms.TextBox();
this.textBoxCost = new System.Windows.Forms.TextBox();

View File

@ -13,7 +13,7 @@ namespace SoftwareInstallation
public int Id { set { _id = value; } }
public FormSoftware(ILogger<FormSoftware> logger, ISoftwareLogic logic)
{
InitializeSoftware();
InitializeComponent();
_logger = logger;
_logic = logic;
}

View File

@ -26,7 +26,7 @@
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeSoftware()
private void InitializeComponent()
{
this.buttonAdd = new System.Windows.Forms.Button();
this.buttonEdit = new System.Windows.Forms.Button();

View File

@ -9,7 +9,7 @@ namespace SoftwareInstallationView
{
public FormSoftwares(ILogger<FormSoftwares> logger, ISoftwareLogic logic)
{
InitializeSoftware();
InitializeComponent();
_logger = logger;
_logic = logic;
LoadData();