diff --git a/PlumbingRepair/PlumbingRepair/FormStore.Designer.cs b/PlumbingRepair/PlumbingRepair/FormStore.Designer.cs index 25595bc..d8fcdfb 100644 --- a/PlumbingRepair/PlumbingRepair/FormStore.Designer.cs +++ b/PlumbingRepair/PlumbingRepair/FormStore.Designer.cs @@ -31,12 +31,12 @@ this.StoreNameLabel = new System.Windows.Forms.Label(); this.StoreAdressLabel = new System.Windows.Forms.Label(); this.OpeningDateLabel = new System.Windows.Forms.Label(); - this.NameComboBox = new System.Windows.Forms.ComboBox(); + this.NameTextBox = new System.Windows.Forms.TextBox(); this.AdressTextBox = new System.Windows.Forms.TextBox(); this.DataGridView = new System.Windows.Forms.DataGridView(); - this.PackageName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.PackagePrice = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.PackageCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.WorkName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.WorkPrice = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.WorkCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.SaveButton = new System.Windows.Forms.Button(); this.ButtonCancel = new System.Windows.Forms.Button(); this.OpeningDatePicker = new System.Windows.Forms.DateTimePicker(); @@ -72,12 +72,10 @@ // // NameComboBox // - this.NameComboBox.FormattingEnabled = true; - this.NameComboBox.Location = new System.Drawing.Point(137, 6); - this.NameComboBox.Name = "NameComboBox"; - this.NameComboBox.Size = new System.Drawing.Size(174, 23); - this.NameComboBox.TabIndex = 3; - this.NameComboBox.SelectedIndexChanged += new System.EventHandler(this.NameComboBox_SelectedIndexChanged); + this.NameTextBox.Location = new System.Drawing.Point(137, 6); + this.NameTextBox.Name = "NameComboBox"; + this.NameTextBox.Size = new System.Drawing.Size(174, 23); + this.NameTextBox.TabIndex = 3; // // AdressTextBox // @@ -90,9 +88,9 @@ // this.DataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.DataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.PackageName, - this.PackagePrice, - this.PackageCount}); + this.WorkName, + this.WorkPrice, + this.WorkCount}); this.DataGridView.Location = new System.Drawing.Point(12, 109); this.DataGridView.Name = "DataGridView"; this.DataGridView.RowTemplate.Height = 25; @@ -101,19 +99,19 @@ // // PackageName // - this.PackageName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.PackageName.HeaderText = "Название изделия"; - this.PackageName.Name = "PackageName"; + this.WorkName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.WorkName.HeaderText = "Название изделия"; + this.WorkName.Name = "PackageName"; // // PackagePrice // - this.PackagePrice.HeaderText = "Цена"; - this.PackagePrice.Name = "PackagePrice"; + this.WorkPrice.HeaderText = "Цена"; + this.WorkPrice.Name = "PackagePrice"; // // PackageCount // - this.PackageCount.HeaderText = "Количество"; - this.PackageCount.Name = "PackageCount"; + this.WorkCount.HeaderText = "Количество"; + this.WorkCount.Name = "PackageCount"; // // SaveButton // @@ -152,7 +150,7 @@ this.Controls.Add(this.SaveButton); this.Controls.Add(this.DataGridView); this.Controls.Add(this.AdressTextBox); - this.Controls.Add(this.NameComboBox); + this.Controls.Add(this.NameTextBox); this.Controls.Add(this.OpeningDateLabel); this.Controls.Add(this.StoreAdressLabel); this.Controls.Add(this.StoreNameLabel); @@ -170,14 +168,14 @@ private Label StoreNameLabel; private Label StoreAdressLabel; private Label OpeningDateLabel; - private ComboBox NameComboBox; + private TextBox NameTextBox; private TextBox AdressTextBox; private DataGridView DataGridView; private Button SaveButton; private Button ButtonCancel; - private DataGridViewTextBoxColumn PackageName; - private DataGridViewTextBoxColumn PackagePrice; - private DataGridViewTextBoxColumn PackageCount; + private DataGridViewTextBoxColumn WorkName; + private DataGridViewTextBoxColumn WorkPrice; + private DataGridViewTextBoxColumn WorkCount; private DateTimePicker OpeningDatePicker; } } \ No newline at end of file diff --git a/PlumbingRepair/PlumbingRepair/FormStore.cs b/PlumbingRepair/PlumbingRepair/FormStore.cs index 16a53c2..ad36d7c 100644 --- a/PlumbingRepair/PlumbingRepair/FormStore.cs +++ b/PlumbingRepair/PlumbingRepair/FormStore.cs @@ -19,13 +19,6 @@ namespace PlumbingRepair _logger = logger; _listStores = logic.ReadList(null); _logic = logic; - if (_listStores != null) - { - NameComboBox.DisplayMember = "StoreName"; - NameComboBox.ValueMember = "Id"; - NameComboBox.DataSource = _listStores; - NameComboBox.SelectedItem = null; - } } private IStoreModel? GetStore(int id) @@ -46,7 +39,7 @@ namespace PlumbingRepair private void SaveButton_Click(object sender, EventArgs e) { - if (string.IsNullOrEmpty(NameComboBox.Text)) + if (string.IsNullOrEmpty(NameTextBox.Text)) { MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); return; @@ -65,7 +58,7 @@ namespace PlumbingRepair DateTime.TryParse(OpeningDatePicker.Text, out var dateTime); StoreBindingModel model = new() { - StoreName = NameComboBox.Text, + StoreName = NameTextBox.Text, StoreAdress = AdressTextBox.Text, OpeningDate = dateTime }; @@ -112,10 +105,10 @@ namespace PlumbingRepair { try { - var model = GetStore(extendDate ? Id : Convert.ToInt32(NameComboBox.SelectedValue)); + var model = GetStore(extendDate ? Id : Convert.ToInt32(NameTextBox.Text)); if (model != null) { - NameComboBox.Text = model.StoreName; + NameTextBox.Text = model.StoreName; AdressTextBox.Text = model.StoreAdress; OpeningDatePicker.Text = Convert.ToString(model.OpeningDate); DataGridView.Rows.Clear(); diff --git a/PlumbingRepair/PlumbingRepair/FormStoreReplenishment.cs b/PlumbingRepair/PlumbingRepair/FormStoreReplenishment.cs index d036c67..facb081 100644 --- a/PlumbingRepair/PlumbingRepair/FormStoreReplenishment.cs +++ b/PlumbingRepair/PlumbingRepair/FormStoreReplenishment.cs @@ -73,7 +73,7 @@ namespace PlumbingRepair throw new Exception("Не найдено изделие. Дополнительная информация в логах."); } - var resultOperation = _storeLogic.AddPackage( + var resultOperation = _storeLogic.AddWork( model: new() { Id = (int)StoreNameComboBox.SelectedValue }, work: work, quantity: Convert.ToInt32(CountTextBox.Text) diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogic/StoreLogic.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogic/StoreLogic.cs index fab2757..713d275 100644 --- a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogic/StoreLogic.cs +++ b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogic/StoreLogic.cs @@ -17,7 +17,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogic _logger = logger; _storeStorage = storeStorage; } - public bool AddPackage(StoreSearchModel model, IWorkModel work, int quantity) + public bool AddWork(StoreSearchModel model, IWorkModel work, int quantity) { if (model == null) { diff --git a/PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IStoreLogic.cs b/PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IStoreLogic.cs index fd21673..eb93eec 100644 --- a/PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IStoreLogic.cs +++ b/PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IStoreLogic.cs @@ -12,6 +12,6 @@ namespace PlumbingRepairContracts.BusinessLogicsContracts bool Create(StoreBindingModel model); bool Update(StoreBindingModel model); bool Delete(StoreBindingModel model); - bool AddPackage(StoreSearchModel model, IWorkModel work, int quantity); + bool AddWork(StoreSearchModel model, IWorkModel work, int quantity); } } diff --git a/PlumbingRepair/PlumbingRepairListImplement/Implements/StoreStorage.cs b/PlumbingRepair/PlumbingRepairListImplement/Implements/StoreStorage.cs index 48e292d..696723f 100644 --- a/PlumbingRepair/PlumbingRepairListImplement/Implements/StoreStorage.cs +++ b/PlumbingRepair/PlumbingRepairListImplement/Implements/StoreStorage.cs @@ -3,7 +3,6 @@ using PlumbingRepairContracts.SearchModels; using PlumbingRepairContracts.StoragesContracts; using PlumbingRepairContracts.ViewModels; using PlumbingRepairListImplement.Models; -using static System.Formats.Asn1.AsnWriter; namespace PlumbingRepairListImplement.Implements {