Изменения

This commit is contained in:
nastya.girl.22@mail.ru 2023-04-26 09:58:57 +04:00
parent a621af5ca9
commit e939295746
7 changed files with 154 additions and 145 deletions

View File

@ -18,7 +18,7 @@ namespace LawFirmFileImplement.Implements
{
source = DataFileSingleton.GetInstance();
}
private OrderViewModel AddManufactureName(OrderViewModel model)
private OrderViewModel AddDocumentName(OrderViewModel model)
{
model.DocumentName = source.Documents.SingleOrDefault(x => x.Id == model.DocumentId)?.DocumentName ?? string.Empty;
return model;
@ -26,7 +26,7 @@ namespace LawFirmFileImplement.Implements
public List<OrderViewModel> GetFullList()
{
return source.Orders
.Select(x => AddManufactureName(x.GetViewModel))
.Select(x => AddDocumentName(x.GetViewModel))
.ToList();
}
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
@ -37,7 +37,7 @@ namespace LawFirmFileImplement.Implements
}
return source.Orders
.Where(x => x.Id == model.Id)
.Select(x => AddManufactureName(x.GetViewModel))
.Select(x => AddDocumentName(x.GetViewModel))
.ToList();
}
public OrderViewModel? GetElement(OrderSearchModel model)
@ -51,7 +51,7 @@ namespace LawFirmFileImplement.Implements
{
return null;
}
return AddManufactureName(order);
return AddDocumentName(order);
}
public OrderViewModel? Insert(OrderBindingModel model)
{

View File

@ -28,82 +28,86 @@
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.buttonSave = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.textBoxName = new System.Windows.Forms.TextBox();
this.textBoxCost = new System.Windows.Forms.TextBox();
this.SuspendLayout();
label1 = new Label();
label2 = new Label();
buttonSave = new Button();
buttonCancel = new Button();
textBoxName = new TextBox();
textBoxCost = new TextBox();
SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 15);
this.label1.TabIndex = 0;
this.label1.Text = "Название:";
label1.AutoSize = true;
label1.Location = new Point(14, 24);
label1.Name = "label1";
label1.Size = new Size(80, 20);
label1.TabIndex = 0;
label1.Text = "Название:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 46);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(38, 15);
this.label2.TabIndex = 1;
this.label2.Text = "Цена:";
label2.AutoSize = true;
label2.Location = new Point(14, 61);
label2.Name = "label2";
label2.Size = new Size(48, 20);
label2.TabIndex = 1;
label2.Text = "Цена:";
//
// buttonSave
//
this.buttonSave.Location = new System.Drawing.Point(181, 80);
this.buttonSave.Name = "buttonSave";
this.buttonSave.Size = new System.Drawing.Size(75, 23);
this.buttonSave.TabIndex = 2;
this.buttonSave.Text = "Сохранить";
this.buttonSave.UseVisualStyleBackColor = true;
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
buttonSave.Location = new Point(183, 107);
buttonSave.Margin = new Padding(3, 4, 3, 4);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(99, 31);
buttonSave.TabIndex = 2;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
this.buttonCancel.Location = new System.Drawing.Point(262, 80);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 3;
this.buttonCancel.Text = "Отмена";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
buttonCancel.Location = new Point(288, 107);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(97, 31);
buttonCancel.TabIndex = 3;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// textBoxName
//
this.textBoxName.Location = new System.Drawing.Point(80, 15);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new System.Drawing.Size(257, 23);
this.textBoxName.TabIndex = 4;
textBoxName.Location = new Point(91, 20);
textBoxName.Margin = new Padding(3, 4, 3, 4);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(293, 27);
textBoxName.TabIndex = 4;
//
// textBoxCost
//
this.textBoxCost.Location = new System.Drawing.Point(80, 43);
this.textBoxCost.Name = "textBoxCost";
this.textBoxCost.Size = new System.Drawing.Size(127, 23);
this.textBoxCost.TabIndex = 5;
textBoxCost.Location = new Point(91, 57);
textBoxCost.Margin = new Padding(3, 4, 3, 4);
textBoxCost.Name = "textBoxCost";
textBoxCost.Size = new Size(145, 27);
textBoxCost.TabIndex = 5;
//
// FormComponent
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(356, 119);
this.Controls.Add(this.textBoxCost);
this.Controls.Add(this.textBoxName);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonSave);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "FormComponent";
this.Text = "Компонент";
this.ResumeLayout(false);
this.PerformLayout();
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(407, 159);
Controls.Add(textBoxCost);
Controls.Add(textBoxName);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(label2);
Controls.Add(label1);
Margin = new Padding(3, 4, 3, 4);
Name = "FormComponent";
Text = "Компонент";
ResumeLayout(false);
PerformLayout();
}
#endregion

View File

@ -17,11 +17,11 @@ namespace LawFirmView
public partial class FormComponent : Form
{
private readonly ILogger _logger;
private readonly IComponentLogic _logic;
private int? _id;
public int Id { set { _id = value; } }
public FormComponent(ILogger<FormComponent> logger, IComponentLogic logic)

View File

@ -28,108 +28,113 @@
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.comboBoxDocument = new System.Windows.Forms.ComboBox();
this.textBoxCount = new System.Windows.Forms.TextBox();
this.textBoxSum = new System.Windows.Forms.TextBox();
this.buttonSave = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
this.Load += new System.EventHandler(this.FormCreateOrder_Load);
label1 = new Label();
label2 = new Label();
label3 = new Label();
comboBoxDocument = new ComboBox();
textBoxCount = new TextBox();
textBoxSum = new TextBox();
buttonSave = new Button();
buttonCancel = new Button();
SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 15);
this.label1.TabIndex = 0;
this.label1.Text = "Изделие:";
label1.AutoSize = true;
label1.Location = new Point(14, 12);
label1.Name = "label1";
label1.Size = new Size(71, 20);
label1.TabIndex = 0;
label1.Text = "Изделие:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 42);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(75, 15);
this.label2.TabIndex = 1;
this.label2.Text = "Количество:";
label2.AutoSize = true;
label2.Location = new Point(14, 56);
label2.Name = "label2";
label2.Size = new Size(93, 20);
label2.TabIndex = 1;
label2.Text = "Количество:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 74);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(48, 15);
this.label3.TabIndex = 2;
this.label3.Text = "Сумма:";
label3.AutoSize = true;
label3.Location = new Point(14, 99);
label3.Name = "label3";
label3.Size = new Size(58, 20);
label3.TabIndex = 2;
label3.Text = "Сумма:";
//
// comboBoxDocument
//
this.comboBoxDocument.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxDocument.FormattingEnabled = true;
this.comboBoxDocument.Location = new System.Drawing.Point(93, 6);
this.comboBoxDocument.Name = "comboBoxDocument";
this.comboBoxDocument.Size = new System.Drawing.Size(270, 23);
this.comboBoxDocument.TabIndex = 5;
this.comboBoxDocument.SelectedIndexChanged += new System.EventHandler(this.ComboBoxDocument_SelectedIndexChanged);
comboBoxDocument.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxDocument.FormattingEnabled = true;
comboBoxDocument.Location = new Point(106, 8);
comboBoxDocument.Margin = new Padding(3, 4, 3, 4);
comboBoxDocument.Name = "comboBoxDocument";
comboBoxDocument.Size = new Size(308, 28);
comboBoxDocument.TabIndex = 5;
comboBoxDocument.SelectedIndexChanged += ComboBoxDocument_SelectedIndexChanged;
//
// textBoxCount
//
this.textBoxCount.Location = new System.Drawing.Point(93, 39);
this.textBoxCount.Name = "textBoxCount";
this.textBoxCount.Size = new System.Drawing.Size(270, 23);
this.textBoxCount.TabIndex = 4;
this.textBoxCount.TextChanged += new System.EventHandler(this.TextBoxCount_TextChanged);
textBoxCount.Location = new Point(106, 52);
textBoxCount.Margin = new Padding(3, 4, 3, 4);
textBoxCount.Name = "textBoxCount";
textBoxCount.Size = new Size(308, 27);
textBoxCount.TabIndex = 4;
textBoxCount.TextChanged += TextBoxCount_TextChanged;
//
// textBoxSum
//
this.textBoxSum.Location = new System.Drawing.Point(93, 71);
this.textBoxSum.Name = "textBoxSum";
this.textBoxSum.ReadOnly = true;
this.textBoxSum.Size = new System.Drawing.Size(270, 23);
this.textBoxSum.TabIndex = 5;
textBoxSum.Location = new Point(106, 95);
textBoxSum.Margin = new Padding(3, 4, 3, 4);
textBoxSum.Name = "textBoxSum";
textBoxSum.ReadOnly = true;
textBoxSum.Size = new Size(308, 27);
textBoxSum.TabIndex = 5;
//
// buttonSave
//
this.buttonSave.Location = new System.Drawing.Point(207, 106);
this.buttonSave.Name = "buttonSave";
this.buttonSave.Size = new System.Drawing.Size(75, 23);
this.buttonSave.TabIndex = 6;
this.buttonSave.Text = "Сохранить";
this.buttonSave.UseVisualStyleBackColor = true;
this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click);
buttonSave.Location = new Point(222, 141);
buttonSave.Margin = new Padding(3, 4, 3, 4);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(93, 31);
buttonSave.TabIndex = 6;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click;
//
// buttonCancel
//
this.buttonCancel.Location = new System.Drawing.Point(288, 106);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 7;
this.buttonCancel.Text = "Отмена";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
buttonCancel.Location = new Point(321, 141);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(94, 31);
buttonCancel.TabIndex = 7;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click;
//
// FormCreateOrder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(381, 141);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonSave);
this.Controls.Add(this.textBoxSum);
this.Controls.Add(this.textBoxCount);
this.Controls.Add(this.comboBoxDocument);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "FormCreateOrder";
this.Text = "Заказ";
this.ResumeLayout(false);
this.PerformLayout();
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(435, 188);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(textBoxSum);
Controls.Add(textBoxCount);
Controls.Add(comboBoxDocument);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1);
Margin = new Padding(3, 4, 3, 4);
Name = "FormCreateOrder";
Text = "Заказ";
Load += FormCreateOrder_Load;
ResumeLayout(false);
PerformLayout();
}
#endregion

View File

@ -33,7 +33,7 @@ namespace LawFirmView
private void FormCreateOrder_Load(object sender, EventArgs e)
{
_logger.LogInformation("Загрузка изделий для заказа");
var list = _logicD.ReadList(null);
if (list != null)
{
@ -118,7 +118,7 @@ namespace LawFirmView
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@ -189,10 +189,10 @@
//
// buttonSave
//
buttonSave.Location = new Point(431, 529);
buttonSave.Location = new Point(422, 529);
buttonSave.Margin = new Padding(3, 4, 3, 4);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(86, 31);
buttonSave.Size = new Size(95, 31);
buttonSave.TabIndex = 5;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
@ -203,7 +203,7 @@
buttonCancel.Location = new Point(523, 529);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(86, 31);
buttonCancel.Size = new Size(98, 31);
buttonCancel.TabIndex = 6;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;

View File

@ -75,10 +75,10 @@
//
// buttonSave
//
buttonSave.Location = new Point(151, 108);
buttonSave.Location = new Point(140, 108);
buttonSave.Margin = new Padding(3, 4, 3, 4);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(86, 31);
buttonSave.Size = new Size(97, 31);
buttonSave.TabIndex = 4;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
@ -89,7 +89,7 @@
buttonCancel.Location = new Point(243, 108);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(86, 31);
buttonCancel.Size = new Size(96, 31);
buttonCancel.TabIndex = 5;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;