Изменения

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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