PIbd-21 Chechevitsyn S.A LabWork_1 #1

Closed
shaman_stepan wants to merge 3 commits from Labwork1 into main
7 changed files with 23 additions and 18 deletions
Showing only changes of commit 6b8329bbe9 - Show all commits

View File

@ -9,9 +9,11 @@ public class PrintingHouses
public int MaterialsId { get; set; }
public DateTime Date { get; set; }
public IEnumerable<PrintingHouseOrders> printingHouseOrder { get; set; } = [];
public static PrintingHouses CreateEntity(int id, string title, string phone, string address,IEnumerable<PrintingHouseOrders> printingHouseOrders)
public static PrintingHouses CreateEntity(int id, string title, string phone, string address, int materialsId, IEnumerable<PrintingHouseOrders> printingHouseOrders)
{
return new PrintingHouses
@ -20,6 +22,8 @@ public class PrintingHouses
Title = title,
Phone = phone,
Address = address,
MaterialsId = materialsId,
Date = DateTime.Now,
printingHouseOrder = printingHouseOrders
};
}

View File

@ -31,7 +31,7 @@
labelDateMaterials = new Label();
labelCount = new Label();
labelTypeMaterials = new Label();
checkedListBox1 = new CheckedListBox();
checkedListBox = new CheckedListBox();
dateTimePickerDateMaterial = new DateTimePicker();
numericUpDownCount = new NumericUpDown();
buttonSave = new Button();
@ -66,13 +66,13 @@
labelTypeMaterials.TabIndex = 2;
labelTypeMaterials.Text = "Тип материала";
//
// checkedListBox1
// checkedListBox
//
checkedListBox1.FormattingEnabled = true;
checkedListBox1.Location = new Point(168, 140);
checkedListBox1.Name = "checkedListBox1";
checkedListBox1.Size = new Size(164, 114);
checkedListBox1.TabIndex = 3;
checkedListBox.FormattingEnabled = true;
checkedListBox.Location = new Point(168, 140);
checkedListBox.Name = "checkedListBox";
checkedListBox.Size = new Size(164, 114);
checkedListBox.TabIndex = 3;
//
// dateTimePickerDateMaterial
//
@ -119,13 +119,13 @@
Controls.Add(buttonSave);
Controls.Add(numericUpDownCount);
Controls.Add(dateTimePickerDateMaterial);
Controls.Add(checkedListBox1);
Controls.Add(checkedListBox);
Controls.Add(labelTypeMaterials);
Controls.Add(labelCount);
Controls.Add(labelDateMaterials);
Name = "FormMaterial";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormMaterials";
Text = "Материалы";
Load += FormMaterials_Load;
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
ResumeLayout(false);
@ -137,7 +137,7 @@
private Label labelDateMaterials;
private Label labelCount;
private Label labelTypeMaterials;
private CheckedListBox checkedListBox1;
private CheckedListBox checkedListBox;
private DateTimePicker dateTimePickerDateMaterial;
private NumericUpDown numericUpDownCount;
private Button buttonSave;

View File

@ -37,7 +37,7 @@ public partial class FormMaterial : Form
if ((elem & material.Material) != 0)
{
checkedListBox1.SetItemChecked(checkedListBox1.Items.IndexOf(elem), true);
checkedListBox.SetItemChecked(checkedListBox.Items.IndexOf(elem), true);
}
}
material.DateMaterials = dateTimePickerDateMaterial.Value.Date;
@ -58,7 +58,7 @@ public partial class FormMaterial : Form
InitializeComponent();
foreach (var item in Enum.GetValues(typeof(TypeMaterials)))
{
checkedListBox1.Items.Add(item);
checkedListBox.Items.Add(item);
}
}
@ -71,7 +71,7 @@ public partial class FormMaterial : Form
{
try
{
if (int.Parse(numericUpDownCount.Value.ToString()) <= 0 || dateTimePickerDateMaterial.Value.Date < DateTime.Now || checkedListBox1.SelectedItems.Count == 0)
if (int.Parse(numericUpDownCount.Value.ToString()) <= 0 || dateTimePickerDateMaterial.Value.Date < DateTime.Now || checkedListBox.SelectedItems.Count == 0)
{
throw new Exception("Имеются незаполненные поля");
}
@ -99,7 +99,7 @@ public partial class FormMaterial : Form
private Materials CreateMaterials(int id)
{
TypeMaterials typeMaterials = TypeMaterials.None;
foreach (var elem in checkedListBox1.CheckedItems)
foreach (var elem in checkedListBox.CheckedItems)
{
typeMaterials |= (TypeMaterials)elem;
}

View File

@ -188,7 +188,7 @@
Controls.Add(labelTitle);
Name = "FormPrintingHouse";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormPrintingHousecs";
Text = "Печать";
groupBoxGridView.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
ResumeLayout(false);

View File

@ -49,6 +49,7 @@ public partial class FormPrintingHouse : Form
textBoxTitle.Text,
textBoxPhone.Text,
textBoxAddress.Text,
(int)comboBoxMaterials.SelectedValue!,
CreateListPrintingHouseOrdersFromDataGrid()
)
);

View File

@ -97,7 +97,7 @@
Controls.Add(panel1);
Name = "FormPrintingHouses";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormPrintingHouses";
Text = "Печати";
Load += FormPrintingHouses_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();

View File

@ -110,7 +110,7 @@
Controls.Add(panel1);
Name = "FormPublishingHouses";
StartPosition = FormStartPosition.CenterScreen;
Text = "FormPublishingHouses";
Text = "Издательства";
Load += FormPublishingHouses_Load;
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();