private void materialFlatButton1_Click(object sender, EventArgs e) { _Treatment.Therapy = therapyTextBox.Text; _Treatment.Diagnos = diagnozTextBox.Text; _Treatment.Save(); string history = "Дата: " + _Visit.Date.ToString() + " " + diagnozTextBox.Text + ";" + "\n"; int num = GetPatientsByTherapyNumber(Visits.Records().Get(), _Treatment.Therapy_number); SaveHistory(Patient_histories.Records().Get(), num, history); this.Close(); }
private void button1_Click(object sender, EventArgs e) { int hour = int.Parse(hours.Text); int min = int.Parse(minutes.Text); int sec = int.Parse(seconds.Text); int clientId = int.Parse(clientComboBoxId.Items[clientsNameComboBox.SelectedIndex].ToString()); int servise_number = int.Parse(comboBoxServises.Items[comboBoxServisesName.SelectedIndex].ToString()); int employee_number = int.Parse(comboBoxDoctor.Items[comboBoxDoctorsName.SelectedIndex].ToString()); if (_Doctor == null && _Servise == null && _Visit == null && _Patient == null && _Servise == null && _Treatment == null) { Treatment tret = new Treatment() { Diagnos = "Диагноз: ", Therapy = "Лечение: " }; var res = tret.Save(); var num_tret = tret.Therapy_number; Visit vis = new Visit() { Therapy_number = num_tret, Pasport_ID = clientId, Servise_number = servise_number, Employee_number = employee_number, Date = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month, dateTimePicker1.Value.Day, hour, min, sec) }; vis.SetTreatment(tret); vis.onValidationError += Visit_onValidationError; if (vis.Save() > 0) { MessageBox.Show("Новая запись добавлена!"); } else { MessageBox.Show("Ошибка в добавлении"); } } else { _Visit.Pasport_ID = clientId; _Visit.Employee_number = employee_number; _Visit.Servise_number = servise_number; _Visit.Date = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month, dateTimePicker1.Value.Day, hour, min, sec); _Visit.onValidationError += Visit_onValidationError; if (_Visit.Save() > 0) { MessageBox.Show("Запись обновлена!"); } } this.Close(); }