This commit is contained in:
ElEgEv 2023-10-24 19:45:26 +04:00
parent 19d6cfae36
commit 3ec2154684
3 changed files with 29 additions and 13 deletions

View File

@ -48,9 +48,9 @@ namespace VisualComponentsForm
var model = new LabWorkBindingModel var model = new LabWorkBindingModel
{ {
Id = _id ?? 0, Id = _id ?? 0,
Theme = dropDownList.Selected, Theme = inputInRange.Value,
FCs = textBoxStudents.Text, FCs = textBoxStudents.Text,
Discipline = inputInRange.Text, Discipline = dropDownList.Selected,
Questions = textBoxQuestions.Text, Questions = textBoxQuestions.Text,
}; };

View File

@ -132,13 +132,15 @@
// contextMenuStrip // contextMenuStrip
// //
contextMenuStrip.Name = "contextMenuStrip"; contextMenuStrip.Name = "contextMenuStrip";
contextMenuStrip.Size = new Size(61, 4); contextMenuStrip.Size = new Size(181, 26);
contextMenuStrip.Text = "Меню";
// //
// FormMain // FormMain
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(529, 412); ClientSize = new Size(529, 412);
ContextMenuStrip = contextMenuStrip;
Controls.Add(button1); Controls.Add(button1);
Controls.Add(groupBox); Controls.Add(groupBox);
Name = "FormMain"; Name = "FormMain";

View File

@ -39,6 +39,7 @@ namespace VisualComponentsForm
new DataGridViewInfoCol("Возраст", "Age", 60, true) new DataGridViewInfoCol("Возраст", "Age", 60, true)
}; };
InitializeComponent(); InitializeComponent();
ToolStripMenuItem createLabWork = new("Создать лаб. раб."); ToolStripMenuItem createLabWork = new("Создать лаб. раб.");
@ -52,14 +53,16 @@ namespace VisualComponentsForm
myListBox.ContextMenuStrip = contextMenuStrip; myListBox.ContextMenuStrip = contextMenuStrip;
//valueTree.ContextMenuStrip = contextMenuStrip; //valueTree.ContextMenuStrip = contextMenuStrip;
createLabWork.Click += createLabWork_Click; createLabWork.Click += CreateLabWork_Click;
updateLabWork.Click += updateLabWork_Click; updateLabWork.Click += UpdateLabWork_Click;
deleteLabWork.Click += deleteLabWork_Click; deleteLabWork.Click += DeleteLabWork_Click;
//createSimpleDocItem.Click += createSimpleDocItem_Click; //createSimpleDocItem.Click += createSimpleDocItem_Click;
//createTableDocEntityItem.Click += createTableDocEntityItem_Click; //createTableDocEntityItem.Click += createTableDocEntityItem_Click;
//createChartDocEntityItem.Click += createChartDocEntityItem_Click; //createChartDocEntityItem.Click += createChartDocEntityItem_Click;
_labWorkStorage = labWorkStorage; _labWorkStorage = labWorkStorage;
LoadData();
} }
private void ButtonCheck_Click(object sender, EventArgs e) private void ButtonCheck_Click(object sender, EventArgs e)
@ -79,7 +82,7 @@ namespace VisualComponentsForm
myListBox.ClearAll(); myListBox.ClearAll();
} }
public void createLabWork_Click(object sender, EventArgs e) public void CreateLabWork_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormCreateLabWork)); var service = Program.ServiceProvider?.GetService(typeof(FormCreateLabWork));
@ -87,11 +90,11 @@ namespace VisualComponentsForm
{ {
form.ShowDialog(); form.ShowDialog();
//LoadData(); LoadData();
} }
} }
public void updateLabWork_Click(object sender, EventArgs e) public void UpdateLabWork_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormCreateLabWork)); var service = Program.ServiceProvider?.GetService(typeof(FormCreateLabWork));
@ -101,11 +104,11 @@ namespace VisualComponentsForm
form.ShowDialog(); form.ShowDialog();
//LoadData(); LoadData();
} }
} }
public void deleteLabWork_Click(object sender, EventArgs e) public void DeleteLabWork_Click(object sender, EventArgs e)
{ {
// Удаление выбранных строк при нажатии на клавишу Delete // Удаление выбранных строк при нажатии на клавишу Delete
/* /*
@ -143,11 +146,11 @@ namespace VisualComponentsForm
{ {
if (e.KeyCode == Keys.A) if (e.KeyCode == Keys.A)
{ {
createLabWork_Click(sender, e); CreateLabWork_Click(sender, e);
} }
if (e.KeyCode == Keys.U) if (e.KeyCode == Keys.U)
{ {
updateLabWork_Click(sender, e); UpdateLabWork_Click(sender, e);
} }
if (e.KeyCode == Keys.D) if (e.KeyCode == Keys.D)
{ {
@ -179,5 +182,16 @@ namespace VisualComponentsForm
//LoadData(); //LoadData();
} }
} }
public void LoadData()
{
var labWorks = _labWorkStorage.GetFullList();
foreach(var labWork in labWorks)
{
myListBox.AddItem(labWork.Discipline + " | " + labWork.Id.ToString() + " | "
+ labWork.Theme + " | " + labWork.Questions);
}
}
} }
} }