private void buttonMedicineEdit_Click(object sender, EventArgs e) { if (dataViewMedicine.SelectedRows.Count > 0) { int medicineID = Convert.ToInt32(dataViewMedicine.SelectedRows[0].Cells[0].Value); FormMedicineDetail formMedicineDetail = new FormMedicineDetail(Medicine.GetMedicine(medicineID), "edit"); formMedicineDetail.ShowDialog(); refreshDataViewMedicine(); } }
private void finish_Click(object sender, EventArgs e) { Dictionary <Medicine, int> medicines = new Dictionary <Medicine, int>(); foreach (var item in prescribed) { medicines[Medicine.GetMedicine(item.Item1)] = item.Item2; } Diagnosis diagnosis = new Diagnosis(diseaseBox.Text, DateTime.Now, medicines); doctor.WriteDiagnosis(patient, diagnosis); backToDoctorProfile(this, EventArgs.Empty); }
private void SetPDetailForInsert(int staffID, int patientID) { textBoxPatientID.Text = patientID.ToString(); textBoxStaffID.Text = staffID.ToString(); dateCreate.Value = DateTime.Today; dateCreate.Enabled = false; DataTable dtMedicine = Medicine.GetListMedicine(); for (int i = 0; i < dtMedicine.Rows.Count; i++) { Medicine newMedicine = Medicine.GetMedicine(Convert.ToInt32(dtMedicine.Rows[i][0])); listMedicine.Add(newMedicine); comboBoxMedicine.Items.Add(newMedicine.MedicineName); comboBoxMedicine.AutoCompleteCustomSource.Add(newMedicine.MedicineName); } comboBoxMedicine.SelectedIndex = 0; }
private void SetPDetailForUpdate(Prescription pDetail) { textBoxPrescriptionID.Text = pDetail.PrescriptionID.ToString(); textBoxPatientID.Text = pDetail.PatientID.ToString(); textBoxStaffID.Text = pDetail.StaffID.ToString(); dateCreate.Value = pDetail.Date; DataTable dtMedicine = Medicine.GetListMedicine(); for (int i = 0; i < dtMedicine.Rows.Count; i++) { Medicine newMedicine = Medicine.GetMedicine(Convert.ToInt32(dtMedicine.Rows[i][0])); listMedicine.Add(newMedicine); comboBoxMedicine.Items.Add(newMedicine.MedicineName); comboBoxMedicine.AutoCompleteCustomSource.Add(newMedicine.MedicineName); } comboBoxMedicine.SelectedIndex = 0; DataTable dtPD = PrescriptionDetail.GetListPrescriptionDetail(pDetail.PrescriptionID); for (int i = 0; i < dtPD.Rows.Count; i++) { PrescriptionDetail newDP = new PrescriptionDetail(); newDP.PrescriptionID = Convert.ToInt32(dtPD.Rows[i][0]); newDP.MedicineID = Convert.ToInt32(dtPD.Rows[i][1]); newDP.Quantity = Convert.ToInt16(dtPD.Rows[i][2]); newDP.Instruction = dtPD.Rows[i][3].ToString(); listDP.Add(newDP); Medicine newMedicine = Medicine.GetMedicine(newDP.MedicineID); listSelectedMedicine.Items.Add(newMedicine.MedicineName); } if (listSelectedMedicine.Items.Count > 0) { listSelectedMedicine.SelectedIndex = 0; } }