//Submit Add Form
        protected void AddDoctorButton_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            String btnId = btn.ID;

            if (btnId.Equals("AddDoctorButton"))
            {
                if (IsValid)
                {
                    System.Threading.Thread.Sleep(3000);
                    var name = NameTextBox.Text;
                    var gender = GenderRadioButtonList1.SelectedItem.Value;
                    var genderId = long.Parse(gender);
                    var dob = Convert.ToDateTime(DOBTextBox.Text);
                    var address = AddressTextBox.Text;
                    var license = LicenseTextBox.Text;

                    var doctor = new Doctor() { doctorName = name, genderId = genderId, dob = dob, address = address, license = license };
                    _dataContext.Doctors.InsertOnSubmit(doctor);
                    _dataContext.SubmitChanges();
                    DoctorsList.DataBind();

                    ResetInputField();

                    //Use For checking Data
                    //Debug.WriteLine("name: " + name);
                    //Debug.WriteLine("gender: " + gender);
                    //Debug.WriteLine("dob: " + dob);
                    //Debug.WriteLine("address: " + address);
                    //Debug.WriteLine("license: " + license);
                }
                else if (btnId.Equals("ResetDoctorButton"))
                {
                    ResetInputField();
                }
            }
        }
        //Update Button Control
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                System.Threading.Thread.Sleep(3000);
                Label lblId = FormView1.FindControl("EditId") as Label;
                var id = long.Parse(lblId.Text);
                TextBox txtBoxName = FormView1.FindControl("EditName") as TextBox;
                var name = txtBoxName.Text;
                Label txtBoxGender = FormView1.FindControl("EditGender") as Label;
                var gender = (txtBoxGender.Text.Equals("Male")) ? 1 : 2;
                TextBox txtBoxDOB = FormView1.FindControl("EditDOB") as TextBox;
                var dob = Convert.ToDateTime(txtBoxDOB.Text);
                TextBox txtBoxAddress = FormView1.FindControl("EditAddress") as TextBox;
                var address = txtBoxAddress.Text;
                TextBox txtBoxLicense = FormView1.FindControl("EditLicense") as TextBox;
                var license = txtBoxLicense.Text;

                var doctor = new Doctor() { doctorId = id, doctorName = name, genderId = gender, dob = dob, address = address, license = license };
                _dataContext.Doctors.Attach(doctor);
                _dataContext.Refresh(RefreshMode.KeepCurrentValues, doctor);
                _dataContext.SubmitChanges();
                //Use For Debug passed value
                //Debug.WriteLine("id: " + id);
                //Debug.WriteLine("groupId: " + groupId);
                //Debug.WriteLine("Name: " + name);
                //Debug.WriteLine("price: " + price);
            }
        }
 partial void DeleteDoctor(Doctor instance);
 partial void UpdateDoctor(Doctor instance);
 partial void InsertDoctor(Doctor instance);
		private void detach_Doctors(Doctor entity)
		{
			this.SendPropertyChanging();
			entity.Gender = null;
		}
		private void attach_Doctors(Doctor entity)
		{
			this.SendPropertyChanging();
			entity.Gender = this;
		}
        //Control Update Process
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                System.Threading.Thread.Sleep(3000);
                var editedRowIndex = DoctorsList.EditIndex;
                var lblId = DoctorsList.Rows[editedRowIndex].FindControl("EditId") as Label;
                var txtBName = DoctorsList.Rows[editedRowIndex].FindControl("EditName") as TextBox;
                var txtBGender = DoctorsList.Rows[editedRowIndex].FindControl("EditGender") as Label;
                var txtBDob = DoctorsList.Rows[editedRowIndex].FindControl("EditDOBTextBox") as TextBox;
                var txtBAddress = DoctorsList.Rows[editedRowIndex].FindControl("EditAddress") as TextBox;
                var txtBLicense = DoctorsList.Rows[editedRowIndex].FindControl("EditLicense") as TextBox;

                var id = long.Parse(lblId.Text);
                var name = txtBName.Text;
                var gender = (txtBGender.Text.Equals("Male")) ? 1 : 2;
                var dob = Convert.ToDateTime(txtBDob.Text);
                var address = txtBAddress.Text;
                var license = txtBLicense.Text;

                var doctor = new Doctor() { doctorId = id, doctorName = name, genderId = gender, dob = dob, address = address, license = license };
                _dataContext.Doctors.Attach(doctor);
                _dataContext.Refresh(RefreshMode.KeepCurrentValues, doctor);
                _dataContext.SubmitChanges();
                DoctorsList.EditIndex = -1;

                //Use For Debug passed value
                //Debug.WriteLine("id: " + id);
                //Debug.WriteLine("name: " + name);
                //Debug.WriteLine("gender: " + gender);
                //Debug.WriteLine("dob: " + dob);
                //Debug.WriteLine("address: " + address);
                //Debug.WriteLine("license: " + license);
            }
        }