Exemplo n.º 1
0
        private void ultraButtonDelete_Click(object sender, EventArgs e)
        {
            try
            {
                ultraGridDoctorList.Rows[this.ultraGridDoctorList.ActiveRow.Index].Delete(true);
                objHospDB = new HospitalDB();
                DoctorInfo    objDoctorInfo    = new DoctorInfo(objHospDB);
                DoctorInfoRow objDoctroInfoRow = new DoctorInfoRow();

                objDoctroInfoRow.DoctorIDD = Convert.ToInt32(id);
                objDoctorInfo.Delete(objDoctroInfoRow);



                MessageBox.Show(":deleted");
            }catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void ultraButtonRegister_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (this.strFormMode == "Edit")
                {
                    objHospDB = new HospitalDB();
                    DoctorInfo    objDoctorInfo    = new DoctorInfo(objHospDB);
                    DoctorInfoRow objDoctorInfoRow = new DoctorInfoRow();
                    objDoctorInfoRow.DoctorIDD = Convert.ToInt32(classtextEditorID.Text);
                    objDoctorInfoRow.Name      = ultraTextEditorName.Text;
                    objDoctorInfoRow.Address   = ultraTextEditorAddress.Text;
                    objDoctorInfoRow.Phone     = classtePhone.Text;
                    objDoctorInfo.Update(objDoctorInfoRow);


                    MessageBox.Show(":updated");
                    openfrmDoctorList();
                }
                else
                {
                    objHospDB = new HospitalDB();
                    DoctorInfo    objDoctorInfo    = new DoctorInfo(objHospDB);
                    DoctorInfoRow objDoctorInfoRow = new DoctorInfoRow();
                    // SqlCommand cmd = objHospDB.CreateCommand("insert into DoctorInfo values('" + ultraTextEditorName.Text + "','" + ultraTextEditorAddress.Text + "','" + classtePhone.Text + "');");
                    objDoctorInfoRow.Name    = ultraTextEditorName.Text;
                    objDoctorInfoRow.Address = ultraTextEditorAddress.Text;
                    objDoctorInfoRow.Phone   = classtePhone.Text;

                    objDoctorInfo.Insert(objDoctorInfoRow);
                    MessageBox.Show(":Registerd");
                    openfrmDoctorList();
                }
            }catch (Exception ex)
            {
                MessageBox.Show("Error");
            }
        }