protected void LinkButton_Delete_Command(object sender, CommandEventArgs e) { SUBSTANCE_SUPPLIER objData = new Pricing.BLL.SUBSTANCE_SUPPLIER(); objData.SelectByDrugReqID(int.Parse(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); Drug_Reguest_Substances objData2 = new Pricing.BLL.Drug_Reguest_Substances(); objData2.LoadByPrimaryKey(int.Parse(e.CommandArgument.ToString())); objData2.MarkAsDeleted(); objData2.Save(); LoadGeneric(); }
protected void Button_Update_Click(object sender, EventArgs e) { if (Session["PopUpType"].ToString() == "AddNewGeneric") { Drug_Reguest_Substances objData = new Pricing.BLL.Drug_Reguest_Substances(); objData.AddNew(); objData.DRUG_REQUEST_ID = TradePriceID; objData.SUBSTANCE_ID = Label_Generic_Name_ID.Text == "" ? 0 : Convert.ToInt32(Label_Generic_Name_ID.Text); objData.TYPE = DropDownList_GenericType.SelectedValue; objData.Save(); SUBSTANCE_SUPPLIER objSupplier = new Pricing.BLL.SUBSTANCE_SUPPLIER(); objSupplier.AddNew(); objSupplier.DRUG_REQUEST_SUBSTANCE_ID = objData.ID; objSupplier.UNIT_ID = Convert.ToInt32(DropDownList_Quantity_Unit.SelectedValue); objSupplier.QUANTITY = TextBox_Quantity.Text == "" ? 0 : float.Parse(TextBox_Quantity.Text); objSupplier.EQUI_NAME_SUBSTANCE = Label_Equ_Generic_Name_ID.Text == "" ? 0 : Convert.ToInt32(Label_Equ_Generic_Name_ID.Text); objSupplier.EQUI_QUANTITY = TextBox_EquQuantity.Text == "" ? 0 : float.Parse(TextBox_EquQuantity.Text); objSupplier.EQUI_UNIT = Convert.ToInt32(DropDownList_Eq_Quantity_Unit.SelectedValue); objSupplier.OVER_QUANTITY = TextBox_OverQuantity.Text == "" ? 0 : float.Parse(TextBox_OverQuantity.Text); objSupplier.OVER_UNIT_ID = Convert.ToInt32(DropDownList_Over_Quantity_Unit.SelectedValue); objSupplier.OVER_EQUI_QUANTITY = TextBox_EquQuantity.Text == "" ? 0 : float.Parse(TextBox_EquQuantity.Text); objSupplier.OVER_EQUI_UNIT = Convert.ToInt32(DropDownList_Eq_Quantity_Unit.SelectedValue); objSupplier.Save(); //Response.Redirect("ProductEdit.aspx?DrugListId=" + TradePriceID); ResetPopUp(); LoadGeneric(); } else { if (Session["DrugReguestSubstancesID"] != null) { Drug_Reguest_Substances objDRSub = new Pricing.BLL.Drug_Reguest_Substances(); objDRSub.LoadByPrimaryKey(Convert.ToInt32(Session["DrugReguestSubstancesID"].ToString())); objDRSub.TYPE = DropDownList_GenericType.SelectedValue; objDRSub.SUBSTANCE_ID = Convert.ToInt32(Label_Generic_Name_ID.Text); objDRSub.Save(); SUBSTANCE_SUPPLIER objSubSupplier = new Pricing.BLL.SUBSTANCE_SUPPLIER(); objSubSupplier.SelectByDrugReqID(Convert.ToInt32(Session["DrugReguestSubstancesID"].ToString())); objSubSupplier.QUANTITY = float.Parse(TextBox_Quantity.Text); objSubSupplier.UNIT_ID = Convert.ToInt32(DropDownList_Quantity_Unit.SelectedValue); objSubSupplier.OVER_QUANTITY = float.Parse(TextBox_OverQuantity.Text); objSubSupplier.OVER_UNIT_ID = Convert.ToInt32(DropDownList_Over_Quantity_Unit.SelectedValue); objSubSupplier.EQUI_QUANTITY = float.Parse(TextBox_EquQuantity.Text); objSubSupplier.EQUI_UNIT = Convert.ToInt32(DropDownList_Eq_Quantity_Unit.SelectedValue); objSubSupplier.OVER_EQUI_QUANTITY = float.Parse(TextBox_OverEquQuantity.Text); objSubSupplier.OVER_EQUI_UNIT = Convert.ToInt32(DropDownList_Eq_Over_Quantity_Unit.SelectedValue); objSubSupplier.EQUI_NAME_SUBSTANCE = Convert.ToInt32(Label_Equ_Generic_Name_ID.Text); objSubSupplier.Save(); //Response.Redirect("ProductEdit.aspx?DrugListId=" + TradePriceID); ResetPopUp(); LoadGeneric(); } } Session["PopUpType"] = "AddNewGeneric"; }