точно всё

This commit is contained in:
parent 4c9a5d26ae
commit 80e7462e84
3 changed files with 45 additions and 44 deletions

View File

@ -36,35 +36,35 @@
dateTimePicker = new DateTimePicker(); dateTimePicker = new DateTimePicker();
label1 = new Label(); label1 = new Label();
label2 = new Label(); label2 = new Label();
textBoxCount = new TextBox(); numericCount = new NumericUpDown();
textBoxPay = new TextBox(); numericPay = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)numericCount).BeginInit();
((System.ComponentModel.ISupportInitialize)numericPay).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// labelDoctor // labelDoctor
// //
labelDoctor.AutoSize = true; labelDoctor.AutoSize = true;
labelDoctor.Location = new Point(35, 43); labelDoctor.Location = new Point(31, 32);
labelDoctor.Name = "labelDoctor"; labelDoctor.Name = "labelDoctor";
labelDoctor.Size = new Size(43, 20); labelDoctor.Size = new Size(34, 15);
labelDoctor.TabIndex = 0; labelDoctor.TabIndex = 0;
labelDoctor.Text = "Врач"; labelDoctor.Text = "Врач";
// //
// buttonCancel // buttonCancel
// //
buttonCancel.Location = new Point(240, 304); buttonCancel.Location = new Point(210, 228);
buttonCancel.Margin = new Padding(3, 4, 3, 4);
buttonCancel.Name = "buttonCancel"; buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(106, 39); buttonCancel.Size = new Size(93, 29);
buttonCancel.TabIndex = 11; buttonCancel.TabIndex = 11;
buttonCancel.Text = "Отмена"; buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true; buttonCancel.UseVisualStyleBackColor = true;
// //
// buttonSave // buttonSave
// //
buttonSave.Location = new Point(35, 304); buttonSave.Location = new Point(31, 228);
buttonSave.Margin = new Padding(3, 4, 3, 4);
buttonSave.Name = "buttonSave"; buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(106, 39); buttonSave.Size = new Size(93, 29);
buttonSave.TabIndex = 10; buttonSave.TabIndex = 10;
buttonSave.Text = "Сохранить"; buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true; buttonSave.UseVisualStyleBackColor = true;
@ -74,18 +74,17 @@
// //
comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxDoctor.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxDoctor.FormattingEnabled = true; comboBoxDoctor.FormattingEnabled = true;
comboBoxDoctor.Location = new Point(193, 40); comboBoxDoctor.Location = new Point(169, 30);
comboBoxDoctor.Margin = new Padding(3, 4, 3, 4);
comboBoxDoctor.Name = "comboBoxDoctor"; comboBoxDoctor.Name = "comboBoxDoctor";
comboBoxDoctor.Size = new Size(153, 28); comboBoxDoctor.Size = new Size(134, 23);
comboBoxDoctor.TabIndex = 12; comboBoxDoctor.TabIndex = 12;
// //
// label4 // label4
// //
label4.AutoSize = true; label4.AutoSize = true;
label4.Location = new Point(35, 99); label4.Location = new Point(31, 74);
label4.Name = "label4"; label4.Name = "label4";
label4.Size = new Size(54, 20); label4.Size = new Size(43, 15);
label4.TabIndex = 17; label4.TabIndex = 17;
label4.Text = "Месяц"; label4.Text = "Месяц";
// //
@ -93,50 +92,53 @@
// //
dateTimePicker.CustomFormat = "MMMM yyyy"; dateTimePicker.CustomFormat = "MMMM yyyy";
dateTimePicker.Format = DateTimePickerFormat.Custom; dateTimePicker.Format = DateTimePickerFormat.Custom;
dateTimePicker.Location = new Point(193, 94); dateTimePicker.Location = new Point(169, 70);
dateTimePicker.Margin = new Padding(3, 2, 3, 2);
dateTimePicker.Name = "dateTimePicker"; dateTimePicker.Name = "dateTimePicker";
dateTimePicker.Size = new Size(153, 27); dateTimePicker.Size = new Size(134, 23);
dateTimePicker.TabIndex = 22; dateTimePicker.TabIndex = 22;
// //
// label1 // label1
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Location = new Point(35, 155); label1.Location = new Point(31, 116);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new Size(142, 20); label1.Size = new Size(113, 15);
label1.TabIndex = 23; label1.TabIndex = 23;
label1.Text = "Кол-во посещений"; label1.Text = "Кол-во посещений";
// //
// label2 // label2
// //
label2.AutoSize = true; label2.AutoSize = true;
label2.Location = new Point(35, 204); label2.Location = new Point(31, 153);
label2.Name = "label2"; label2.Name = "label2";
label2.Size = new Size(59, 20); label2.Size = new Size(47, 15);
label2.TabIndex = 24; label2.TabIndex = 24;
label2.Text = "Оплата"; label2.Text = "Оплата";
// //
// textBoxCount // numericCount
// //
textBoxCount.Location = new Point(193, 152); numericCount.Location = new Point(169, 114);
textBoxCount.Name = "textBoxCount"; numericCount.Maximum = new decimal(new int[] { 999999, 0, 0, 0 });
textBoxCount.Size = new Size(153, 27); numericCount.Name = "numericCount";
textBoxCount.TabIndex = 25; numericCount.Size = new Size(134, 23);
numericCount.TabIndex = 27;
// //
// textBoxPay // numericPay
// //
textBoxPay.Location = new Point(193, 201); numericPay.Location = new Point(169, 151);
textBoxPay.Name = "textBoxPay"; numericPay.Maximum = new decimal(new int[] { 999999, 0, 0, 0 });
textBoxPay.Size = new Size(153, 27); numericPay.Name = "numericPay";
textBoxPay.TabIndex = 26; numericPay.Size = new Size(134, 23);
numericPay.TabIndex = 28;
// //
// FormDoctorPayment // FormDoctorPayment
// //
AutoScaleDimensions = new SizeF(8F, 20F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(370, 363); ClientSize = new Size(324, 272);
Controls.Add(textBoxPay); Controls.Add(numericPay);
Controls.Add(textBoxCount); Controls.Add(numericCount);
Controls.Add(label2); Controls.Add(label2);
Controls.Add(label1); Controls.Add(label1);
Controls.Add(dateTimePicker); Controls.Add(dateTimePicker);
@ -145,10 +147,11 @@
Controls.Add(buttonCancel); Controls.Add(buttonCancel);
Controls.Add(buttonSave); Controls.Add(buttonSave);
Controls.Add(labelDoctor); Controls.Add(labelDoctor);
Margin = new Padding(3, 4, 3, 4);
Name = "FormDoctorPayment"; Name = "FormDoctorPayment";
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
Text = "Оплата врачу"; Text = "Оплата врачу";
((System.ComponentModel.ISupportInitialize)numericCount).EndInit();
((System.ComponentModel.ISupportInitialize)numericPay).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
@ -163,7 +166,7 @@
private DateTimePicker dateTimePicker; private DateTimePicker dateTimePicker;
private Label label1; private Label label1;
private Label label2; private Label label2;
private TextBox textBoxCount; private NumericUpDown numericCount;
private TextBox textBoxPay; private NumericUpDown numericPay;
} }
} }

View File

@ -34,17 +34,15 @@ public partial class FormDoctorPayment : Form
{ {
try try
{ {
if (comboBoxDoctor.SelectedIndex < 0 || if (comboBoxDoctor.SelectedIndex < 0)
string.IsNullOrWhiteSpace(textBoxCount.Text) ||
string.IsNullOrWhiteSpace(textBoxPay.Text))
{ {
throw new Exception("Имеются незаполненные поля."); throw new Exception("Имеются незаполненные поля.");
} }
int doctorId = (int)comboBoxDoctor.SelectedValue!; int doctorId = (int)comboBoxDoctor.SelectedValue!;
string month = dateTimePicker.Value.ToString("yyyy-MM"); string month = dateTimePicker.Value.ToString("yyyy-MM");
int patientCount = Convert.ToInt32(textBoxCount.Text); int patientCount = (int)numericCount.Value;
int payment = Convert.ToInt32(textBoxPay.Text); int payment = (int)numericPay.Value;
var doctorPay = DoctorPay.CreateElement(0, doctorId, month, patientCount, payment); var doctorPay = DoctorPay.CreateElement(0, doctorId, month, patientCount, payment);
_doctorPayRepository.CreateDoctorPayments(doctorPay); _doctorPayRepository.CreateDoctorPayments(doctorPay);