private void ultraBtnRefresh_Click(object sender, EventArgs e) { try { objHospitalDB = new HospitalDB(); Doctor objDoctor = new Doctor(objHospitalDB); DoctorRow objDoctorRow = new DoctorRow(); ultraGridDoc.DataSource = objDoctor.GetAll(); /* dsDoctor = new DataSet(); * SqlCommand cmd = objHospitalDB.CreateCommand("Select * from [Hospital].[dbo].[Doctor]", false); * SqlDataAdapter sda = new SqlDataAdapter(); * sda.SelectCommand = cmd; * sda.Fill(dsDoctor); * ultraGridDoc.DataSource = dsDoctor.Tables[0];*/ } catch (Exception ex) { MessageBox.Show(ex.Message); if (objHospitalDB != null) { objHospitalDB.Dispose(); } } }
private void frmDoctorView_Load(object sender, EventArgs e) { objHospitalDB = new HospitalDB(); Doctor objDoctor = new Doctor(objHospitalDB); DoctorRow objDoctorRow = new DoctorRow(); ultraGridDoc.DataSource = objDoctor.GetAll(); /* SqlCommand cmd = objHospitalDB.CreateCommand("SELECT * FROM Doctor"); * SqlDataAdapter sda = new SqlDataAdapter(cmd); * dtDoctor = new DataTable(); * sda.Fill(dtDoctor); * ultraGridDoc.DataSource = dtDoctor;*/ }
private void ultraBtnDelete_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Are you sure you want to delete?", "delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { objHospitalDB = new HospitalDB(); Doctor objDoctor = new Doctor(objHospitalDB); DoctorRow objDoctorRow = new DoctorRow(); objDoctorRow.Doctor_ID = Convert.ToInt32(this.id); objDoctor.Delete(objDoctorRow); ultraGridDoc.DataSource = objDoctor.GetAll(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } /*try * { * objHospitalDB = new HospitalDB(); * // con.Open(); * ultraGridDoc.Rows[this.ultraGridDoc.ActiveRow.Index].Delete(true); * SqlCommand query = objHospitalDB.CreateCommand("delete from Doctor where Doctor_ID='" + this.id + "';", false); * int p = query.ExecuteNonQuery(); * * MessageBox.Show(p + "Deleted"); * } * catch (Exception ex) * { * MessageBox.Show(ex.Message); * if(objHospitalDB!=null) * { * objHospitalDB.Dispose(); * } * }*/ }
public DoctorRowChangeEvent(DoctorRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }