protected void btnAddAgentProductItem_click(object sender, EventArgs e) { dpAgent.Enabled = false; double tempQty = 0; DataSet ds = new DataSet(); Invoice invocie = new Invoice(); InvoiceData invicedata = new InvoiceData(); invocie.TokanId = hftokanno.Value; invocie.UserID = GlobalInfo.Userid; invocie.TypeID = Convert.ToInt32(dpAgentProductType.SelectedItem.Value); invocie.ProductID = Convert.ToInt32(dpAgentProductdetaisl.SelectedItem.Value); invocie.qty = Convert.ToDouble(txtagentOrderqty.Text); invocie.UnitCost = Convert.ToDouble(hfAgentProductUnitPrice.Value); invocie.totalCoast = Convert.ToDouble(txtagentOrderqty.Text) * Convert.ToDouble(hfAgentProductUnitPrice.Value); tempQty = Convert.ToDouble(txtagentOrderqty.Text); invocie.orderDate = GlobalInfo.OfflineBoothDate; invocie.CurrentBoothID = GlobalInfo.CurrentbothID; int flag = 2; bool result = invicedata.CheckTempInvoiceItam(invocie, flag); if (!result) { ds = invicedata.checkStock(invocie); if (!Comman.Comman.IsDataSetEmpty(ds)) { double temp = Convert.ToDouble(ds.Tables[0].Rows[0]["avail"]); if (temp >= tempQty) { invicedata.Booth_InsertTempInvoiceItam(invocie); BindAgntTempItam(invocie); pnlBills.Visible = false; txtagentOrderqty.Text = ""; } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alertMessage", "alertMessage();", true); } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alertMessage", "alertMessage();", true); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Item already exists')", true); } }
// protected void btnaddCustomeraItam_clcik(object sender, EventArgs e) { double tempQty = 0; Invoice invocie = new Invoice(); InvoiceData invicedata = new InvoiceData(); DataSet ds = new DataSet(); invocie.TokanId = hftokanno.Value; invocie.UserID = GlobalInfo.Userid; invocie.TypeID = Convert.ToInt32(dpCustomerPRoductType.SelectedItem.Value); invocie.ProductID = Convert.ToInt32(dpCustomerPRoductDetails.SelectedItem.Value); invocie.qty = Convert.ToDouble(txtcustomerqty.Text); invocie.UnitCost = Convert.ToDouble(hfCustmoerUnitPrice.Value); invocie.totalCoast = Convert.ToDouble(txtcustomerqty.Text) * Convert.ToDouble(hfCustmoerUnitPrice.Value); tempQty = Convert.ToDouble(txtcustomerqty.Text); invocie.orderDate = DateTime.Now.ToString("dd-MM-yyyy"); invocie.CurrentBoothID = GlobalInfo.CurrentbothID; int flag = 2; bool result = invicedata.CheckTempInvoiceItam(invocie, flag); if (!result) { ds = invicedata.checkStock(invocie); if (!Comman.Comman.IsDataSetEmpty(ds)) { double temp = Convert.ToDouble(ds.Tables[0].Rows[0]["avail"]); if (temp >= invocie.qty) { invicedata.Booth_InsertTempInvoiceItam(invocie); BindCustomerTempItam(invocie); pnlBill.Visible = true; btnPrint.Visible = false; pnlBills.Visible = false; pnlBill.Enabled = true; txtcustomerqty.Text = ""; } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alertMessage", "alertMessage();", true); } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alertMessage", "alertMessage();", true); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Item already exists')", true); } }
public void AddAgentShemeDetails(int dbagentinfo) { AgentInfoData agentInfoData = new AgentInfoData(); DataSet DS = new DataSet(); DS = agentInfoData.GetAgentbyID(dbagentinfo); if (!Comman.Comman.IsDataSetEmpty(DS)) { //txtSchemeAmount.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["SchemeAmount"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["SchemeAmount"].ToString(); Invoice invocie = new Invoice(); InvoiceData invicedata = new InvoiceData(); invocie.TokanId = hftokanno.Value; invocie.UserID = GlobalInfo.Userid; invocie.TypeID = 0; invocie.ProductID = 0; invocie.qty = 0; invocie.totalCoast = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["SchemeAmount"].ToString()) ? 0 : Convert.ToDouble(DS.Tables[0].Rows[0]["SchemeAmount"]); invocie.SchemeAmount = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["SchemeAmount"].ToString()) ? 0 : Convert.ToDouble(DS.Tables[0].Rows[0]["SchemeAmount"]); invocie.TotalSchemeAmount = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["TotalSchemeAmount"].ToString()) ? 0 : Convert.ToDouble(DS.Tables[0].Rows[0]["TotalSchemeAmount"]); invocie.TotalSchemeAmount = invocie.TotalSchemeAmount + invocie.SchemeAmount; schemeTemp = invocie.TotalSchemeAmount; if (invocie.SchemeAmount > 0) { schemeApplied = true; invicedata.Booth_InsertTempInvoiceItam(invocie); BindAgntTempItam(invocie); } else { schemeApplied = false; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Scheme not available')", true); dpAgentShemeApplied.ClearSelection(); } } }