точно финал

This commit is contained in:
parent 80e7462e84
commit 35e3cd66a4
6 changed files with 47 additions and 38 deletions

View File

@ -34,24 +34,27 @@
labelGrams = new Label(); labelGrams = new Label();
labelDescription = new Label(); labelDescription = new Label();
checkedListBoxName = new CheckedListBox(); checkedListBoxName = new CheckedListBox();
textBoxGrams = new TextBox();
textBoxDescription = new TextBox(); textBoxDescription = new TextBox();
numericGrams = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)numericGrams).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// buttonCancel // buttonCancel
// //
buttonCancel.Location = new Point(177, 302); buttonCancel.Location = new Point(202, 403);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(93, 29); buttonCancel.Size = new Size(106, 39);
buttonCancel.TabIndex = 8; buttonCancel.TabIndex = 8;
buttonCancel.Text = "Отмена"; buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true; buttonCancel.UseVisualStyleBackColor = true;
// //
// buttonSave // buttonSave
// //
buttonSave.Location = new Point(38, 302); buttonSave.Location = new Point(43, 403);
buttonSave.Margin = new Padding(3, 4, 3, 4);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(93, 29); buttonSave.Size = new Size(106, 39);
buttonSave.TabIndex = 7; buttonSave.TabIndex = 7;
buttonSave.Text = "Сохранить"; buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true; buttonSave.UseVisualStyleBackColor = true;
@ -60,68 +63,75 @@
// labelName // labelName
// //
labelName.AutoSize = true; labelName.AutoSize = true;
labelName.Location = new Point(38, 44); labelName.Location = new Point(43, 59);
labelName.Name = "labelName"; labelName.Name = "labelName";
labelName.Size = new Size(59, 15); labelName.Size = new Size(77, 20);
labelName.TabIndex = 9; labelName.TabIndex = 9;
labelName.Text = "Название"; labelName.Text = "Название";
// //
// labelGrams // labelGrams
// //
labelGrams.AutoSize = true; labelGrams.AutoSize = true;
labelGrams.Location = new Point(38, 188); labelGrams.Location = new Point(43, 251);
labelGrams.Name = "labelGrams"; labelGrams.Name = "labelGrams";
labelGrams.Size = new Size(60, 15); labelGrams.Size = new Size(76, 20);
labelGrams.TabIndex = 10; labelGrams.TabIndex = 10;
labelGrams.Text = "Грамовка"; labelGrams.Text = "Грамовка";
// //
// labelDescription // labelDescription
// //
labelDescription.AutoSize = true; labelDescription.AutoSize = true;
labelDescription.Location = new Point(38, 236); labelDescription.Location = new Point(43, 315);
labelDescription.Name = "labelDescription"; labelDescription.Name = "labelDescription";
labelDescription.Size = new Size(45, 15); labelDescription.Size = new Size(57, 20);
labelDescription.TabIndex = 11; labelDescription.TabIndex = 11;
labelDescription.Text = "Рецепт"; labelDescription.Text = "Рецепт";
// //
// checkedListBoxName // checkedListBoxName
// //
checkedListBoxName.FormattingEnabled = true; checkedListBoxName.FormattingEnabled = true;
checkedListBoxName.Location = new Point(136, 44); checkedListBoxName.Location = new Point(155, 59);
checkedListBoxName.Margin = new Padding(3, 4, 3, 4);
checkedListBoxName.Name = "checkedListBoxName"; checkedListBoxName.Name = "checkedListBoxName";
checkedListBoxName.Size = new Size(161, 94); checkedListBoxName.Size = new Size(183, 114);
checkedListBoxName.TabIndex = 12; checkedListBoxName.TabIndex = 12;
// //
// textBoxGrams
//
textBoxGrams.Location = new Point(136, 185);
textBoxGrams.Name = "textBoxGrams";
textBoxGrams.Size = new Size(161, 23);
textBoxGrams.TabIndex = 13;
//
// textBoxDescription // textBoxDescription
// //
textBoxDescription.Location = new Point(136, 233); textBoxDescription.Location = new Point(155, 311);
textBoxDescription.Margin = new Padding(3, 4, 3, 4);
textBoxDescription.Name = "textBoxDescription"; textBoxDescription.Name = "textBoxDescription";
textBoxDescription.Size = new Size(161, 23); textBoxDescription.Size = new Size(183, 27);
textBoxDescription.TabIndex = 14; textBoxDescription.TabIndex = 14;
// //
// numericGrams
//
numericGrams.Location = new Point(155, 249);
numericGrams.Maximum = new decimal(new int[] { 10000, 0, 0, 0 });
numericGrams.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
numericGrams.Name = "numericGrams";
numericGrams.Size = new Size(183, 27);
numericGrams.TabIndex = 15;
numericGrams.Value = new decimal(new int[] { 1, 0, 0, 0 });
//
// FormDrug // FormDrug
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(309, 357); ClientSize = new Size(353, 476);
Controls.Add(numericGrams);
Controls.Add(textBoxDescription); Controls.Add(textBoxDescription);
Controls.Add(textBoxGrams);
Controls.Add(checkedListBoxName); Controls.Add(checkedListBoxName);
Controls.Add(labelDescription); Controls.Add(labelDescription);
Controls.Add(labelGrams); Controls.Add(labelGrams);
Controls.Add(labelName); Controls.Add(labelName);
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonSave); Controls.Add(buttonSave);
Margin = new Padding(3, 4, 3, 4);
Name = "FormDrug"; Name = "FormDrug";
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
Text = "Лекарство"; Text = "Лекарство";
((System.ComponentModel.ISupportInitialize)numericGrams).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
@ -134,7 +144,7 @@
private Label labelGrams; private Label labelGrams;
private Label labelDescription; private Label labelDescription;
private CheckedListBox checkedListBoxName; private CheckedListBox checkedListBoxName;
private TextBox textBoxGrams;
private TextBox textBoxDescription; private TextBox textBoxDescription;
private NumericUpDown numericGrams;
} }
} }

View File

@ -39,7 +39,7 @@ public partial class FormDrug : Form
checkedListBoxName.SetItemChecked(checkedListBoxName.Items.IndexOf(elem), true); checkedListBoxName.SetItemChecked(checkedListBoxName.Items.IndexOf(elem), true);
} }
} }
textBoxGrams.Text = drag.Grams.ToString(); numericGrams.Text = drag.Grams.ToString();
textBoxDescription.Text = drag.Description; textBoxDescription.Text = drag.Description;
_dragId = value; _dragId = value;
@ -69,7 +69,7 @@ public partial class FormDrug : Form
{ {
try try
{ {
if (string.IsNullOrWhiteSpace(textBoxGrams.Text) || string.IsNullOrWhiteSpace(textBoxDescription.Text) || if (string.IsNullOrWhiteSpace(textBoxDescription.Text) ||
checkedListBoxName.CheckedItems.Count == 0) checkedListBoxName.CheckedItems.Count == 0)
{ {
throw new Exception("Имеется незаполненные поля"); throw new Exception("Имеется незаполненные поля");
@ -104,7 +104,7 @@ public partial class FormDrug : Form
drugName |= (DrugsNames)elem; drugName |= (DrugsNames)elem;
} }
return Drug.CreateElement(id, drugName, Convert.ToInt32(textBoxGrams.Text), textBoxDescription.Text); return Drug.CreateElement(id, drugName, (int)numericGrams.Value, textBoxDescription.Text);
} }

View File

@ -72,7 +72,6 @@ public class PatientRepository : IPatientRepository
public IEnumerable<Patient> ReadPatient() public IEnumerable<Patient> ReadPatient()
{ {
//return [];
_logger.LogInformation("Получение всех объектов пациентов"); _logger.LogInformation("Получение всех объектов пациентов");
try try
{ {