Example #1
0
        private void btnUpdateDays_Click(object sender, EventArgs e)
        {
            DoctorRepo dr = new DoctorRepo();

            dr.DoctorID      = Convert.ToInt32(this.txtDoctorID.Text);
            dr.Specialty     = this.txtSpecialty.Text;
            dr.AvailableDays = this.cmbAvailableDays.Text.ToString();
            int check = dr.UpdateDoctor(dr.DoctorID, dr.Specialty, dr.AvailableDays);

            if (check == 1)
            {
                MessageBox.Show("Data Updated");
            }
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                CheckIfFieldEmpty();

                PersonRepo p1 = new PersonRepo();
                p1.PersonID = Convert.ToInt32(this.txtPID.Text);

                p1.Name       = this.txtName.Text;
                p1.Age        = Convert.ToInt32(this.txtAge.Text);
                p1.Phone      = this.txtNumber.Text;
                p1.Gender     = this.cmbGender.Text;
                p1.BloodGroup = this.cmbBloodGrp.Text;

                DoctorRepo dr = new DoctorRepo();
                dr.DoctorID      = Convert.ToInt32(this.txtDoctorId.Text);
                dr.Specialty     = this.txtSpecialty.Text;
                dr.AvailableDays = this.cmbAvailableDays.Text;


                EmployeeRepo er = new EmployeeRepo();
                er.EmpID       = Convert.ToInt32(this.txtEmpId.Text);
                er.Salary      = Convert.ToInt32(this.txtSalary.Text);
                er.Designation = this.cmbDesignation.Text;

                int personupdate = p1.UpdatePerson(p1.PersonID, p1.Name, p1.Age, p1.Gender, p1.BloodGroup, p1.Phone);
                int empupdate    = er.UpdateEmployee(er.EmpID, er.Designation, er.Salary);
                int doctorupdate = dr.UpdateDoctor(dr.DoctorID, dr.Specialty, dr.AvailableDays);
                PopulatePersonTable();
                MessageBox.Show("Successfully updated!");
                this.ClearAll();
            }

            catch (Exception exc)
            {
                MessageBox.Show("error" + exc);
            }
        }