private void doctorFinishVisitButton_Click(object sender, EventArgs e) { DateTime time = DateTime.Now; Visit visit = new Visit(); visit.id_visit = this.idVisit; //sprawdzic czy nie maja czegos zlego wpisanego if (doctorVisitPatientDescriptionTextBox.Text != "Description") { visit.description = doctorVisitPatientDescriptionTextBox.Text; } if (doctorVisitPatientDiagnosisTextBox.Text != "Diagnosis") { visit.diagnosis = doctorVisitPatientDiagnosisTextBox.Text; } visit.state = "DONE"; visit.execution_cancel_datetime = time; DoctorFacade.FinishVisit(visit); this.Close(); //validate data }
private void doctorSelectVisitbutton_Click(object sender, EventArgs e) { if (dataGridView1.RowCount == 0 || dataGridView1.SelectedCells.Count == 0) { //MessageBox.Show("No visit selected", "Error"); MessageBox.Show("No visit selected !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (dataGridView1.SelectedRows.Count > 1) { //MessageBox.Show("Selected too many visits, please select just one", "Error"); MessageBox.Show("Selected too many visits ! \nPlease select just one...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { int visitIndex = dataGridView1.CurrentRow.Index; int idVisit = Int32.Parse(dataGridView1.Rows[visitIndex].Cells[5].Value.ToString()); Patient patient = DoctorFacade.GetPatientByVisit(idVisit); //tu musimy wyciagnac wszstko z wizyty DoctorVisitViewForm doctorViewVisit = new DoctorVisitViewForm(patient, idVisit); doctorViewVisit.ShowDialog(this); Visit visit = new Visit(); visit.id_patient = idPatient; if (this.doctorVisitStateComboBox.SelectedItem != null) { visit.state = this.doctorVisitStateComboBox.SelectedItem.ToString(); } if (doctorDateTimePickerExecDate.Checked == true) { visit.registration_date = doctorDateTimePickerExecDate.Value; } else { DateTime loadedDate = DateTime.ParseExact("01.01.1754 00:00:00", "dd.MM.yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); visit.registration_date = loadedDate; } this.dataGridView1.DataSource = DoctorFacade.GetPatientsWithAdresses(idDoctor, idPatient, visit); } }
private void doctorCancelVisitButton_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure ?", "Cancel the visit...", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { DateTime time = DateTime.Now; Visit visit = new Visit(); visit.id_visit = this.idVisit; if (doctorVisitPatientDescriptionTextBox.Text != "Description") { visit.description = doctorVisitPatientDescriptionTextBox.Text; } if (doctorVisitPatientDiagnosisTextBox.Text != "Diagnosis") { visit.diagnosis = doctorVisitPatientDiagnosisTextBox.Text; } visit.state = "CANC"; visit.execution_cancel_datetime = time; DoctorFacade.FinishVisit(visit); this.Close(); } ; }
private void Initialize(int idDoctor) { this.idDoctor = idDoctor; doctorDateTimePickerExecDate.Checked = true; //doctorVisitStateComboBox.SelectedIndex = doctorVisitStateComboBox.FindStringExact("REG"); int index = doctorVisitStateComboBox.Items.IndexOf("REG"); doctorVisitStateComboBox.SelectedItem = doctorVisitStateComboBox.Items[index]; this.doctorPatientNameTextBox.Text = "All patients"; Visit visit = new Visit(); visit.registration_date = doctorDateTimePickerExecDate.Value; visit.state = doctorVisitStateComboBox.SelectedItem.ToString(); visit.id_doctor = idDoctor; this.dataGridView1.DataSource = DoctorFacade.GetPatientsWithAdresses(idDoctor, idPatient, visit); //this.dataGridView1.DataSource = DoctorFacade.GetVisitsFromToday(idDoctor, doctorDateTimePickerExecDate.Value); this.dataGridView1.Columns[0].HeaderText = "Patient's first name"; this.dataGridView1.Columns[1].HeaderText = "Patient's last name"; this.dataGridView1.Columns[3].HeaderText = "State of visit"; this.dataGridView1.Columns[4].HeaderText = "Registration date"; this.dataGridView1.Columns[5].Visible = false; this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; }
private void doctorSearchButton_Click(object sender, EventArgs e) { //Patient patientSearchCriteria = new Patient(); Visit visit = new Visit(); visit.id_patient = idPatient; if (this.doctorVisitStateComboBox.SelectedItem != null) { visit.state = this.doctorVisitStateComboBox.SelectedItem.ToString(); } if (doctorDateTimePickerExecDate.Checked == true) { visit.registration_date = doctorDateTimePickerExecDate.Value; } else { //na razie nic lepszego do glowy mi nie przychodzi, chyba ze druga funkcja w doctorFacade // MW DateTime loadedDate = DateTime.ParseExact("01.01.1754 00:00:00", "dd.MM.yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); visit.registration_date = loadedDate; } this.dataGridView1.DataSource = DoctorFacade.GetPatientsWithAdresses(idDoctor, idPatient, visit); this.dataGridView1.Columns[0].HeaderText = "Patient's first name"; this.dataGridView1.Columns[1].HeaderText = "Patient's last name"; this.dataGridView1.Columns[3].HeaderText = "State of visit"; this.dataGridView1.Columns[4].HeaderText = "Registration date"; this.dataGridView1.Columns[5].Visible = false; this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //force select first row if (dataGridView1.Rows.Count >= 1) { dataGridView1.CurrentCell = dataGridView1.Rows[0].Cells[0]; } }