private void ultraBtnPRefresh_Click(object sender, EventArgs e) { dsPatient = new DataSet(); try { ultraTextPSearch.Text = ""; ultraDateTimePSearch.Value = ""; objHospitalDB = new HospitalDB(); Patient objPatient = new Patient(objHospitalDB); PatientRow objPatientRow = new PatientRow(); dtPatient = objPatient.GetAllAsDataTable(); ultraGridPatient.DataSource = dtPatient; /*SqlCommand cmd = objHospitalDB.CreateCommand("Select * from [Hospital].[dbo].[Patient]", false); * SqlDataAdapter sda = new SqlDataAdapter(); * sda.SelectCommand = cmd; * sda.Fill(dsPatient); * ultraGridPatient.DataSource = dsPatient.Tables[0];*/ } catch (Exception ex) { MessageBox.Show(ex.Message); if (objHospitalDB != null) { objHospitalDB.Dispose(); } } }
private void ultraBtnPDelete_Click(object sender, EventArgs e) { objHospitalDB = new HospitalDB(); Patient objPatient = new Patient(objHospitalDB); PatientRow objPatientRow = new PatientRow(); objPatientRow.Patient_ID = Convert.ToInt32(this.Pat_id); objPatient.Delete(objPatientRow); ultraGridPatient.DataSource = objPatient.GetAll(); /* ultraGridPatient.Rows[this.ultraGridPatient.ActiveRow.Index].Delete(true); * SqlCommand query = objHospitalDB.CreateCommand("delete from Patient where Patient_ID='" + this.Pat_id + "';", false); * int p = query.ExecuteNonQuery(); * MessageBox.Show(p + "Deleted");*/ }
private void button1_Click(object sender, EventArgs e) { try { objHospitalDB = new HospitalDB(); Patient objPatient = new Patient(objHospitalDB); PatientRow objPatientRow = new PatientRow(); objPatientRow.Patient_Address = ultraTextAddress.Text; objPatientRow.DateOfBirth = Convert.ToDateTime(ultraCalendarComboDOB.Text); objPatientRow.DateOfRegistration = Convert.ToDateTime(ultraCalendarComboDOR.Text); objPatientRow.FullName = ultraTextFullName.Text; objPatientRow.Phone = Convert.ToInt32(ultraTextPhoneNumber.Text); objPatientRow.Emergency_Contact = Convert.ToInt32(ultraTextEmergencyContact.Text); //DataTable dtPatient = new DataTable(); if (strFormMode == "NEW") { if (MessageBox.Show("Are you sure You want to save", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { objPatient.Insert(objPatientRow); this.Hide(); } } else if (strFormMode == "EDIT") { try { objPatientRow.Patient_ID = Convert.ToInt32(this.id); objPatient.Update(objPatientRow); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public PatientRowChangeEvent(PatientRow row, global::System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }