private void buttonSearch_Click(object sender, EventArgs e) { if (this.textBoxSearchName.Text.Length > 0 || this.textBoxSearchId.Text.Length > 0) { //Search by Name if (this.textBoxSearchName.Text.Length > 0) { DoctorShiftsHL docShi = new DoctorShiftsHL(); docShi.shiftName = this.textBoxSearchName.Text; DataTable dt = new DataTable(); dt = DoctorShiftsManager.getDoctorShiftListByName(docShi); dataGridViewShifts.DataSource = dt; clearSearchBoxes(); } //Search by Id if (this.textBoxSearchId.Text.Length > 0) { DoctorShiftsHL docShi = new DoctorShiftsHL(); docShi.shiftId = Convert.ToInt32(this.textBoxSearchId.Text); DataTable dt = new DataTable(); dt = DoctorShiftsManager.getDoctorShiftListById(docShi); dataGridViewShifts.DataSource = dt; clearSearchBoxes(); } } else { MessageBox.Show("Please enter a value to search!"); } }
private void buttonDeleteShift_Click(object sender, EventArgs e) { DoctorShiftsHL docshi = new DoctorShiftsHL(); try { docshi.shiftId = IdShift; DoctorShiftsManager.doctorShiftDelete(docshi); MessageBox.Show("Deleted"); displayDataShifts(); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
private void buttonNewShift_Click(object sender, EventArgs e) { DoctorShiftsHL docshi = new DoctorShiftsHL(); try { docshi.shiftName = textBoxShiftsName.Text; docshi.from = TimeSpan.Parse(textBoxFrom.Text); docshi.to = TimeSpan.Parse(textBoxTo.Text); DoctorShiftsManager.doctorShiftSave(docshi); MessageBox.Show("Success"); displayDataShifts(); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }