Текстбокс

This commit is contained in:
ityurner02@mail.ru 2023-02-21 14:27:14 +04:00
parent 78c2459fd0
commit 54d61694e3
6 changed files with 30 additions and 40 deletions

View File

@ -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;
}
}

View File

@ -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();

View File

@ -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)

View File

@ -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)
{

View File

@ -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);
}
}

View File

@ -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
{