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

            if (btnId.Equals("AddDrugButton"))
            {
                if (IsValid)
                {
                    System.Threading.Thread.Sleep(3000);
                    var drugName = NameTextBox.Text;
                    var drugGroup = GroupNameTextBox.Text;
                    var groupId = GetGroupId(drugGroup)[0];
                    var drugGenName = GenNameTextBox.Text; ;
                    var unit = UnitTextBox.Text;
                    var price = decimal.Parse(PriceTextBox.Text);

                    var drug = new Drug () { drugName = drugName, drugGroupId = groupId, drugGenericName = drugGenName, unit = unit, price = price };
                    _dataContext.Drugs.InsertOnSubmit(drug);
                    _dataContext.SubmitChanges();
                    DrugsList.DataBind();

                    ResetInputField();
                }
            }
            else if (btnId.Equals("ResetDrugButton"))
            {
                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 txtBoxGroupId = FormView1.FindControl("EditGroupId") as TextBox;
                var groupId = GetGroupId(txtBoxGroupId.Text)[0];
                TextBox txtBoxIcdName = FormView1.FindControl("EditName") as TextBox;
                var name = txtBoxIcdName.Text;
                TextBox txtBoxGenName = FormView1.FindControl("EditGenName") as TextBox;
                var genName = txtBoxGenName.Text;
                TextBox txtBoxUnit = FormView1.FindControl("EditUnit") as TextBox;
                var unit = txtBoxUnit.Text;
                TextBox txtBoxPrice = FormView1.FindControl("EditPrice") as TextBox;
                var price = decimal.Parse(txtBoxPrice.Text);

                var drug = new Drug() { drugId = id, drugName = name, drugGroupId = groupId, drugGenericName = genName, unit = unit, price = price };
                _dataContext.Drugs.Attach(drug);
                _dataContext.Refresh(RefreshMode.KeepCurrentValues, drug);
                _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 DeleteDrug(Drug instance);
 partial void UpdateDrug(Drug instance);
 partial void InsertDrug(Drug instance);
		private void detach_Drugs(Drug entity)
		{
			this.SendPropertyChanging();
			entity.DrugGroup = null;
		}
		private void attach_Drugs(Drug entity)
		{
			this.SendPropertyChanging();
			entity.DrugGroup = this;
		}