private void ultraButtonRegister_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.strFormMode == "Edit")
                {
                    ultraButtonRegister.Text = "Update";
                    objHospDB = new HospitalDB();
                    // SqlCommand cmd =objHospDB.CreateCommand("update  PatientInfo set Name='" + ultraTextEditorName.Text + "',Address='" + ultraTextEditorAddress.Text + "',DateOfBirth='" + ultraDateTimeEditorPatientRgister.DateTime + "',Phone='" + classPhone.Text + "',EmergencyContact='" + classEmergencyContact.Text + "',DateOfRegistration='" + ultraDateTimeEditorDORPR.DateTime + "' where ID= '" + classtextEditorID.Text + "'");
                    // int obj = cmd.ExecuteNonQuery();
                    PatientInfo    objPatietntInfo   = new PatientInfo(objHospDB);
                    PatientInfoRow objPatientInforow = new PatientInfoRow();

                    objPatientInforow.Id                 = Convert.ToInt32(classtextEditorID.Text);
                    objPatientInforow.Name               = ultraTextEditorName.Text;
                    objPatientInforow.Address            = ultraTextEditorAddress.Text;
                    objPatientInforow.DateOfBirth        = ultraDateTimeEditorPatientRgister.DateTime;
                    objPatientInforow.Phone              = Convert.ToInt32(classPhone.Text);
                    objPatientInforow.EmergencyContact   = Convert.ToInt32(classEmergencyContact.Text);
                    objPatientInforow.DateOfRegistration = ultraDateTimeEditorDORPR.DateTime;

                    objPatietntInfo.Update(objPatientInforow);

                    MessageBox.Show(":updated");
                    //openfrmPatientList();
                    openPatientList();
                }
                else
                {
                    //conn.Open();
                    objHospDB = new HospitalDB();
                    PatientInfo    objPatietntInfo   = new PatientInfo(objHospDB);
                    PatientInfoRow objPatientInforow = new PatientInfoRow();


                    objPatientInforow.Name               = ultraTextEditorName.Text;
                    objPatientInforow.Address            = ultraTextEditorAddress.Text;
                    objPatientInforow.DateOfBirth        = ultraDateTimeEditorPatientRgister.DateTime;
                    objPatientInforow.Phone              = Convert.ToInt32(classPhone.Text);
                    objPatientInforow.EmergencyContact   = Convert.ToInt32(classEmergencyContact.Text);
                    objPatientInforow.DateOfRegistration = ultraDateTimeEditorDORPR.DateTime;
                    //SqlCommand cmd = objHospDB.CreateCommand("Insert into PatientInfo values('" + ultraTextEditorName.Text + "','" + ultraTextEditorAddress.Text + "','" + ultraDateTimeEditorPatientRgister.DateTime + "','" + classPhone.Text + "','" + classEmergencyContact.Text + "','" + ultraDateTimeEditorDORPR.DateTime + "')");

                    objPatietntInfo.Insert(objPatientInforow);
                    MessageBox.Show(":Registered");
                    //openfrmPatientList();
                    openPatientList();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("error");
            }
        }
Exemple #2
0
        private void ultraButtonDelete_Click(object sender, EventArgs e)
        {
            ultraGridPatientList.Rows[this.ultraGridPatientList.ActiveRow.Index].Delete(true);

            try
            {
                objHospDB = new HospitalDB();
                PatientInfo    objPatientInfo    = new PatientInfo(objHospDB);
                PatientInfoRow objPatientInfoRow = new PatientInfoRow();
                objPatientInfoRow.Id = Convert.ToInt32(id);


                objPatientInfo.Delete(objPatientInfoRow);


                MessageBox.Show(":deleted");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #3
0
 public PatientInfoRowChangeEvent(PatientInfoRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }