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

            if (btnId.Equals("AddPrescriptionButton"))
            {
                if (IsValid)
                {
                    System.Threading.Thread.Sleep(3000);
                    var doctorName = NameTextBox.Text;
                    var doctorId = GetGroupId(doctorName)[0];
                    var dateVisited = Convert.ToDateTime(VisitedDateTextBox.Text);

                    var prescription = new Prescription() { doctorId = doctorId, dateWritten = dateVisited };
                    _dataContext.Prescriptions.InsertOnSubmit(prescription);
                    _dataContext.SubmitChanges();
                    PrescriptionList.DataBind();

                    //USe for Testing
                    //Debug.WriteLine("Doctor Name: " + doctorId);
                    //Debug.WriteLine("Date Visisted: " + dateVisited);

                    ResetInputField();
                }
            }
            else if (btnId.Equals("ResetPrescriptionGroupButton"))
            {
                ResetInputField();
            }
        }
 partial void DeletePrescription(Prescription instance);
 partial void UpdatePrescription(Prescription instance);
 partial void InsertPrescription(Prescription instance);
		private void detach_Prescriptions(Prescription entity)
		{
			this.SendPropertyChanging();
			entity.Doctor = null;
		}
        //Control Update Process
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                System.Threading.Thread.Sleep(3000);
                var editedRowIndex = PrescriptionList.EditIndex;
                var lblId = PrescriptionList.Rows[editedRowIndex].FindControl("EditId") as Label;
                var txtbDName = PrescriptionList.Rows[editedRowIndex].FindControl("EditDName") as TextBox;
                var txtbDate = PrescriptionList.Rows[editedRowIndex].FindControl("EditDate") as TextBox;

                var id = long.Parse(lblId.Text);
                var doctorId = GetGroupId(txtbDName.Text)[0];
                var date = Convert.ToDateTime(txtbDate.Text);

                var prescription = new Prescription() { prescriptionId = id, doctorId = doctorId, dateWritten = date };
                _dataContext.Prescriptions.Attach(prescription);
                _dataContext.Refresh(RefreshMode.KeepCurrentValues, prescription);
                _dataContext.SubmitChanges();
                PrescriptionList.EditIndex = -1;

                //Use For Debug passed value
                //Debug.WriteLine("id: " + id);
                //Debug.WriteLine("DName: " + doctorId);
                //Debug.WriteLine("Date: " + date);
            }
        }