protected void AddMSButton_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            String btnId = btn.ID;

            if (btnId.Equals("AddMSButton"))
            {
                if (IsValid)
                {
                    System.Threading.Thread.Sleep(3000);
                    var msName = NameTextBox.Text;
                    var groupName = GroupNameTextBox.Text;
                    var groupId = GetGroupId(groupName)[0];
                    var msPrice = PriceTextBox.Text;

                    var ms = new MedicalService() { medicalServiceName = msName, medicalServiceGroupId = groupId, price = Convert.ToDecimal(msPrice) };
                    _dataContext.MedicalServices.InsertOnSubmit(ms);
                    _dataContext.SubmitChanges();
                    MedicalServiceList.DataBind();

                    ResetInputField();
                }
            }
            else if (btnId.Equals("ResetMSButton"))
            {
                ResetInputField();
            }
        }
        protected void UpdateButton_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                System.Threading.Thread.Sleep(3000);
                var editedRowIndex = MedicalServiceList.EditIndex;
                var lblId = MedicalServiceList.Rows[editedRowIndex].FindControl("EditId") as Label;
                var txtbGroupId = MedicalServiceList.Rows[editedRowIndex].FindControl("EditGroupId") as TextBox;
                var txtbName = MedicalServiceList.Rows[editedRowIndex].FindControl("EditName") as TextBox;
                var txtbPrice = MedicalServiceList.Rows[editedRowIndex].FindControl("editPrice") as TextBox;

                var id = long.Parse(lblId.Text);
                var groupdId = GetGroupId(txtbGroupId.Text)[0];
                var name = txtbName.Text;
                var price = decimal.Parse(txtbPrice.Text);

                var medicalService = new MedicalService() { medicalServiceId = id, medicalServiceGroupId = groupdId, medicalServiceName = name, price = price };
                _dataContext.MedicalServices.Attach(medicalService);
                _dataContext.Refresh(RefreshMode.KeepCurrentValues, medicalService);
                _dataContext.SubmitChanges();
                MedicalServiceList.EditIndex = -1;
                //Use For Debug passed value
                //Debug.WriteLine("id: " + id);
                //Debug.WriteLine("groupId: " + groupdId);
                //Debug.WriteLine("Name: " + name);
                //Debug.WriteLine("price: " + price);
            }
        }
 partial void DeleteMedicalService(MedicalService instance);
 partial void UpdateMedicalService(MedicalService instance);
 partial void InsertMedicalService(MedicalService instance);
		private void detach_MedicalServices(MedicalService entity)
		{
			this.SendPropertyChanging();
			entity.MedicalServiceGroup = null;
		}