protected void frmViewAdd_ItemUpdated(object sender, FormViewUpdatedEventArgs e) { try { if (e.Exception == null) { if (hdSMS.Value == "YES") { BusinessLogic bl = new BusinessLogic(); string conn = bl.CreateConnectionString(Request.Cookies["Company"].Value); UtilitySMS utilSMS = new UtilitySMS(conn); string UserID = Page.User.Identity.Name; if (Session["Provider"] != null) { utilSMS.SendSMS(Session["Provider"].ToString(), Session["Priority"].ToString(), Session["SenderID"].ToString(), Session["UserName"].ToString(), Session["Password"].ToString(), hdMobile.Value, hdText.Value, true, UserID); } else { if (hdMobile.Value != "") { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('you are not configured to send SMS. Please contact Administrator.');", true); } } } MyAccordion.Visible = true; lnkBtnAdd.Visible = true; frmViewAdd.Visible = false; MyAccordion.Visible = true; GrdViewReceipt.DataBind(); GrdViewReceipt.Visible = true; } else { if (e.Exception.InnerException != null) { StringBuilder script = new StringBuilder(); script.Append("alert('You are not allowed to Update this record. Please contact Supervisor.');"); if (e.Exception.InnerException.Message.IndexOf("Invalid Date") > -1) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), script.ToString(), true); } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Exception Occured : " + e.Exception.InnerException.Message + "');", true); } e.ExceptionHandled = true; e.KeepInEditMode = true; lnkBtnAdd.Visible = false; //frmViewAdd.Visible = true; //GrdViewReceipt.Visible = true; } } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void lnkBtnUpdate_Click(object sender, EventArgs e) { BusinessLogic objBus = new BusinessLogic(); DBManager manager = new DBManager(DataProvider.SqlServer); manager.ConnectionString = objBus.CreateConnectionString(System.Configuration.ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ConnectionString); string enabledate = string.Empty; enabledate = rdvoudateenable.SelectedValue; try { manager.Open(); manager.ExecuteNonQuery(CommandType.Text, "Update last_recon Set recon_date='" + Convert.ToDateTime(txtReconDate.Text).ToString("yyyy-MM-dd") + "'"); manager.ExecuteNonQuery(CommandType.Text, "UPDATE tblSettings SET KEYVALUE = '" + enabledate.ToString() + "' WHERE KEYNAME='ENBLDATE' "); string salestype = string.Empty; int ScreenNo = 0; string ScreenName = string.Empty; salestype = "Lock Transaction"; ScreenName = "Lock Transaction"; string usernam = Request.Cookies["LoggedUserName"].Value; bool mobile = false; bool Email = false; string emailsubject = string.Empty; string connection = Request.Cookies["Company"].Value; BusinessLogic bl = new BusinessLogic(); string emailcontent = string.Empty; if (hdEmailRequired.Value == "YES") { var toAddress = ""; var toAdd = ""; Int32 ModeofContact = 0; int ScreenType = 0; DataSet dsdd = bl.GetDetailsForScreenNo(connection, ScreenName, ""); if (dsdd != null) { if (dsdd.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsdd.Tables[0].Rows) { ScreenType = Convert.ToInt32(dr["ScreenType"]); mobile = Convert.ToBoolean(dr["mobile"]); Email = Convert.ToBoolean(dr["Email"]); emailsubject = Convert.ToString(dr["emailsubject"]); emailcontent = Convert.ToString(dr["emailcontent"]); if (ScreenType == 1) { toAddress = toAdd; } else { toAddress = dr["EmailId"].ToString(); } if (Email == true) { string body = "\n"; int index123 = emailcontent.IndexOf("@Branch"); body = Request.Cookies["Company"].Value; if (index123 >= 0) { emailcontent = emailcontent.Remove(index123, 7).Insert(index123, body); } int index312 = emailcontent.IndexOf("@User"); body = usernam; if (index312 >= 0) { emailcontent = emailcontent.Remove(index312, 5).Insert(index312, body); } int index2 = emailcontent.IndexOf("@Date"); body = txtReconDate.Text; if (index2 >= 0) { emailcontent = emailcontent.Remove(index2, 5).Insert(index2, body); } string smtphostname = ConfigurationManager.AppSettings["SmtpHostName"].ToString(); int smtpport = Convert.ToInt32(ConfigurationManager.AppSettings["SmtpPortNumber"]); var fromAddress = ConfigurationManager.AppSettings["FromAddress"].ToString(); string fromPassword = ConfigurationManager.AppSettings["FromPassword"].ToString(); EmailLogic.SendEmail(smtphostname, smtpport, fromAddress, toAddress, emailsubject, emailcontent, fromPassword); //ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Email sent successfully')", true); } } } } } string conn = bl.CreateConnectionString(Request.Cookies["Company"].Value); UtilitySMS utilSMS = new UtilitySMS(conn); string UserID = Page.User.Identity.Name; string smscontent = string.Empty; if (hdSMSRequired.Value == "YES") { var toAddress = ""; var toAdd = ""; Int32 ModeofContact = 0; int ScreenType = 0; DataSet dsdd = bl.GetDetailsForScreenNo(connection, ScreenName, ""); if (dsdd != null) { if (dsdd.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsdd.Tables[0].Rows) { ScreenType = Convert.ToInt32(dr["ScreenType"]); mobile = Convert.ToBoolean(dr["mobile"]); smscontent = Convert.ToString(dr["smscontent"]); if (ScreenType == 1) { toAddress = toAdd; } else { toAddress = dr["mobile"].ToString(); } if (mobile == true) { string body = "\n"; int index123 = smscontent.IndexOf("@Branch"); body = Request.Cookies["Company"].Value; if (index123 >= 0) { smscontent = emailcontent.Remove(index123, 7).Insert(index123, body); } int index312 = smscontent.IndexOf("@User"); body = usernam; if (index312 >= 0) { smscontent = smscontent.Remove(index312, 5).Insert(index312, body); } int index2 = smscontent.IndexOf("@Date"); body = txtReconDate.Text; if (index2 >= 0) { smscontent = smscontent.Remove(index2, 5).Insert(index2, body); } if (Session["Provider"] != null) { utilSMS.SendSMS(Session["Provider"].ToString(), Session["Priority"].ToString(), Session["SenderID"].ToString(), Session["UserName"].ToString(), Session["Password"].ToString(), toAddress, smscontent, true, UserID); } } } } } } //errorDisplay.AddItem("Recon Date updated successfully." , DisplayIcons.GreenTick,false); ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Recon Date updated successfully.');", true); return; } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void BtnSendSMS_Click(object sender, EventArgs e) { try { BusinessLogic bl = new BusinessLogic(sDataSource); UtilitySMS utilSMS = new UtilitySMS(); //int LedgerID = int.Parse(cmbCustomer.SelectedValue); //double balance = double.Parse(txtOpenBal.Text); //string crORDR = ddCRDR.SelectedValue; string mobileNos = string.Empty; string smsText = string.Empty; if (Session["Provider"] == null) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('you are not configured to send SMS. Please contact Administrator.');", true); return; } if (rdoSMSType.SelectedValue == "NORM") { DataSet ds = new DataSet(); if (cmbCustomer.SelectedValue == "ALLCUST") { //All Customers ds = bl.GetGroupCreditDebitData(1, "Customer", sDataSource); } else if (cmbCustomer.SelectedValue == "ALLDEL") { //All Dealers ds = bl.GetGroupCreditDebitData(1, "Dealer", sDataSource); } else if (cmbCustomer.SelectedValue == "ALLDELSUPP") { //both Dealers and customers ds = bl.GetGroupCreditDebitData(1, "CustomerDealer", sDataSource); } else if (cmbCustomer.SelectedValue == "ALLSDC") { //both Dealers and customers ds = bl.GetGroupCreditDebitData(2, "CustomerDealerSupplier", sDataSource); } else { ds = bl.GetGroupCreditDebitData(int.Parse(cmbCustomer.SelectedValue), "Ledger", sDataSource); } if (ds != null) { foreach (DataRow dr in ds.Tables[0].Rows) { if ((dr["Mobile"] != null) && (dr["Mobile"].ToString().Length == 10)) { mobileNos = mobileNos + dr["Mobile"].ToString() + ","; } } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Customer Information not found.');", true); } smsText = txtMessage.Text; string UserID = Page.User.Identity.Name; if (Session["Provider"] != null) { utilSMS.SendSMS(Session["Provider"].ToString(), Session["Priority"].ToString(), Session["SenderID"].ToString(), Session["UserName"].ToString(), Session["Password"].ToString(), mobileNos, smsText, false, UserID); } } else { string strOper = ddOper.SelectedValue; double balance = double.Parse(txtOpenBal.Text); DataSet ds = new DataSet(); ds = bl.GetCustomerDealerMobileNos(1, sDataSource); if (ds != null) { int i = 0; foreach (DataRow dr in ds.Tables[0].Rows) { i++; double custDebit = 0.0; double custCredit = 0.0; double creditDiff = 0.0; if (dr["Debit"] != null) { custDebit = double.Parse(dr["Debit"].ToString()); } if (dr["Credit"] != null) { custCredit = double.Parse(dr["Credit"].ToString()); } creditDiff = custCredit - custDebit; if (strOper == ">") { if (creditDiff > balance) { if ((dr["Mobile"] != null) && (dr["Mobile"].ToString().Length == 10)) { mobileNos = mobileNos + dr["Mobile"].ToString() + ","; } } } if (strOper == ">=") { if (creditDiff >= balance) { if ((dr["Mobile"] != null) && (dr["Mobile"].ToString().Length == 10)) { mobileNos = mobileNos + dr["Mobile"].ToString() + ","; } } } if (strOper == "=") { if (creditDiff == balance) { if ((dr["Mobile"] != null) && (dr["Mobile"].ToString().Length == 10)) { mobileNos = mobileNos + dr["Mobile"].ToString() + ","; } } } string UserID = Page.User.Identity.Name; smsText = "Your current outstanding Debt Amount is " + GetCurrencyType() + creditDiff.ToString() + " . Please arrange to pay at the earliest. Thank You."; if (Session["Provider"] != null) { utilSMS.SendSMS(Session["Provider"].ToString(), Session["Priority"].ToString(), Session["SenderID"].ToString(), Session["UserName"].ToString(), Session["Password"].ToString(), mobileNos, smsText, false, UserID); } } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Customer Information not found.');", true); } } ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('SMS Sent Successfully.');", true); txtMessage.Text = ""; cmbCustomer.SelectedIndex = 0; ddSMSTemplate.SelectedIndex = 0; txtOpenBal.Text = ""; } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void btnReport_Click(object sender, EventArgs e) { try { Reset(); divPrint.Visible = true; DateTime startDate, endDate; string salesreturn = string.Empty; string purchasereturn = string.Empty; if (chkPurchase.Checked) { purchasereturn = "Yes"; } else { purchasereturn = "No"; } if (chkSales.Checked) { salesreturn = "Yes"; } else { salesreturn = "No"; } //string sDataSource = sDatasource;//ConfigurationManager.AppSettings["DataSource"].ToString(); // Server.MapPath("App_Data\\Store0910.mdb"); startDate = Convert.ToDateTime(txtStartDate.Text); endDate = Convert.ToDateTime(txtEndDate.Text); GenerateCashPurchase(sDataSource, startDate, endDate, salesreturn); GenerateChequePurchase(sDataSource, startDate, endDate, salesreturn); GenarateCreditPurchase(sDataSource, startDate, endDate, salesreturn); GenerateCashSales(sDataSource, startDate, endDate, purchasereturn); GenerateChequeSales(sDataSource, startDate, endDate, purchasereturn); GenarateCreditSales(sDataSource, startDate, endDate, purchasereturn); GenerateCashPaid(sDataSource, startDate, endDate, salesreturn); GenerateChequePaid(sDataSource, startDate, endDate, salesreturn); GenerateCashReceived(sDataSource, startDate, endDate, purchasereturn); GenerateChequeReceived(sDataSource, startDate, endDate, purchasereturn); GenerateItemwiseSales(sDataSource, startDate, endDate, purchasereturn); GenerateItemwisePurchase(sDataSource, startDate, endDate, salesreturn); GenerateGrossProfit(sDataSource, startDate, endDate, salesreturn, purchasereturn); GenerateVat(sDataSource, startDate, endDate, salesreturn); lblsumCashPaid.Text = lblGrandCashPaid.Text; lblsumCashRec.Text = lblGrandCashRec.Text; lblsumChequePaid.Text = lblGrandChequePaid.Text; lblsumChequeRec.Text = lblGrandChequeRecPaid.Text; lblsumCashSales.Text = lblGrandCashSales.Text; lblsumChequeSales.Text = lblGrandChequeSales.Text; lblsumCreditSales.Text = lblGrandCreditSales.Text; lblsumCreditPurchase.Text = lblGrandCreditPurchase.Text; lblsumCashPurchase.Text = lblGrandCashPurchase.Text; lblsumChequePurchase.Text = lblGrandCheqPurchase.Text; sumVatTotal.Text = lblVatTotal.Text; UtilitySMS utilSMS = new UtilitySMS(); string UserID = "Report"; string smsTEXT = "Business Transaction Details between " + startDate.ToShortDateString() + " and " + endDate.ToShortDateString() + " "; string sCustomerContact = ""; string ownerMobile = ""; if (lblsumCashPaid.Text != "") { smsTEXT = smsTEXT + "Total Cash Paid :" + lblsumCashPaid.Text + " "; } if (lblsumCashRec.Text != "") { smsTEXT = smsTEXT + "Total Cash Received :" + lblsumCashRec.Text + " "; } if (lblsumChequePaid.Text != "") { smsTEXT = smsTEXT + "Total Cheque Paid :" + lblsumChequePaid.Text + " "; } if (lblsumChequeRec.Text != "") { smsTEXT = smsTEXT + "Total Cash Received :" + lblsumChequeRec.Text + " "; } if (lblsumCashSales.Text != "") { smsTEXT = smsTEXT + "Total Cash Sales :" + lblsumCashSales.Text + " "; } if (lblsumChequeSales.Text != "") { smsTEXT = smsTEXT + "Total Cheque Sales :" + lblsumChequeSales.Text + " "; } if (lblsumCreditSales.Text != "") { smsTEXT = smsTEXT + "Total Credit Sales :" + lblsumCreditSales.Text + " "; } if (lblsumCreditPurchase.Text != "") { smsTEXT = smsTEXT + "Total Credit Purchase :" + lblsumCreditPurchase.Text + " "; } if (lblsumCashPurchase.Text != "") { smsTEXT = smsTEXT + "Total Cash Purchase :" + lblsumCashPurchase.Text + " "; } if (lblsumChequePurchase.Text != "") { smsTEXT = smsTEXT + "Total Cheque Purchase :" + lblsumChequePurchase.Text + " "; } if (Session["AppSettings"] != null) { DataSet appSettings = (DataSet)Session["AppSettings"]; for (int i = 0; i < appSettings.Tables[0].Rows.Count; i++) { if (appSettings.Tables[0].Rows[i]["KEY"].ToString() == "OWNERMOB") { ownerMobile = appSettings.Tables[0].Rows[i]["KEYVALUE"].ToString(); } } } if (Session["Provider"] != null) { if (ownerMobile != "" && ownerMobile.Length == 10) { utilSMS.SendSMS(Session["Provider"].ToString(), Session["Priority"].ToString(), Session["SenderID"].ToString(), Session["UserName"].ToString(), Session["Password"].ToString(), ownerMobile, smsTEXT, false, UserID); } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('you are not configured to send SMS. Please contact Administrator.');", true); } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void InsertButton_Click(object sender, EventArgs e) { try { string conn = string.Empty; if (Request.Cookies["Company"] != null) { conn = Request.Cookies["Company"].Value; } int CreditorID = int.Parse(ComboBox2.SelectedValue); string RefNo = txtRefNo.Text; DateTime TransDate = DateTime.Parse(txtTransDate.Text); //ViewState.Add("TransDate", DateTime.Parse(txtTransDate.Text).ToString("dd/MM/yyyy")); int DebitorID = 0; string Paymode = string.Empty; if (chkPayTo.SelectedValue == "Cash") { DebitorID = 1; Paymode = "Cash"; } else if (chkPayTo.SelectedValue == "Cheque") { DebitorID = int.Parse(ddBanks.SelectedValue); Paymode = "Cheque"; rvChequeNo.Enabled = true; cvBank.Enabled = true; PanelBank.Visible = true; Page.Validate(); if (!Page.IsValid) { return; } } Double Amount = Double.Parse(txtAmount.Text); string Narration = txtNarration.Text; string ChequeNo = txtChequeNo.Text; string VoucherType = "Receipt"; if (hdSMSRequired.Value == "YES") { hdMobile.Value = txtMobile.Text; hdText.Value = "Thank you for Payment of Rs." + txtAmount.Text; } BusinessLogic objBus = new BusinessLogic(conn); int transNo = 0; objBus.InsertReceipt(out transNo, conn, RefNo, TransDate, DebitorID, CreditorID, Amount, Narration, VoucherType, ChequeNo, Paymode); if (hdSMS.Value == "YES") { string connStr = objBus.CreateConnectionString(Request.Cookies["Company"].Value); UtilitySMS utilSMS = new UtilitySMS(connStr); string UserID = string.Empty; utilSMS.SendSMS(Session["Provider"].ToString(), Session["Priority"].ToString(), Session["SenderID"].ToString(), Session["UserName"].ToString(), Session["Password"].ToString(), hdMobile.Value, hdText.Value, true, UserID); } txtAmount.Text = string.Empty; txtRefNo.Text = string.Empty; ComboBox2.SelectedIndex = 0; txtTransDate.Text = DateTime.Now.ToShortDateString(); txtMobile.Text = ""; txtChequeNo.Text = ""; txtNarration.Text = ""; txtRefNo.Focus(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Receipt details Saved Successfully. Trans. No. : " + transNo + "');", true); //} //catch (Exception ex) //{ // if (ex.InnerException != null) // { // StringBuilder script = new StringBuilder(); // script.Append("alert('You are not allowed to enter the payment with this date. Please contact Supervisor.');"); // if (ex.InnerException.Message.IndexOf("Invalid Date") > -1) // ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), script.ToString(), true); // else // ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Exception Occured : " + ex.InnerException.Message + "');", true); // } // else // { // ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Exception Occured : " + ex.Message.ToString() + "');", true); // } //} } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void cmdSave_Click(object sender, EventArgs e) { try { string connection = Request.Cookies["Company"].Value; string serType = string.Empty; string recondate = string.Empty; string purchaseReturn = string.Empty; string prReason = string.Empty; string executive = string.Empty; string sBilldate = string.Empty; string sCustomerAddress = string.Empty; //Senthil string despatchedfrom = string.Empty; double fixedtotal = 0.0; int manualno = 0; string sCustomerAddress2 = string.Empty; string sCustomerAddress3 = string.Empty; string executivename = string.Empty; string sCustomerContact = string.Empty; string sOtherCusName = string.Empty;// krishnavelu 26 June int sCustomerID = 0; double dTotalAmt = 0; string sCustomerName = string.Empty; int iPaymode = 0; string sCreditCardno = string.Empty; double dFreight = 0; double dLU = 0; int iBank = 0; int iSales = 0; //DataSet ds; if (Page.IsValid) { BusinessLogic bl = new BusinessLogic(sDataSource); recondate = txtBillDate.Text.Trim();; if (!bl.IsValidDate(connection, Convert.ToDateTime(recondate))) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Date is invalid')", true); return; } sBilldate = txtBillDate.Text.Trim(); iPaymode = Convert.ToInt32(drpPaymode.SelectedItem.Value); dTotalAmt = Convert.ToDouble(hdTotalAmt.Value.Trim()); sCustomerAddress = txtAddress.Text.Trim(); sCustomerAddress2 = txtAddress2.Text.Trim(); sCustomerAddress3 = txtAddress3.Text.Trim(); sCustomerContact = hdContact.Value.Trim(); sCustomerContact = txtCustPh.Text; sCustomerName = cmbCustomer.SelectedItem.Text; sCustomerID = Convert.ToInt32(cmbCustomer.SelectedItem.Value); calcSum(); dTotalAmt = Convert.ToDouble(lblTotalSum.Text); executive = "0"; sOtherCusName = string.Empty; executivename = string.Empty; purchaseReturn = "NO"; string snarr = string.Empty; //Paymode as Bank if (iPaymode == 2) { sCreditCardno = Convert.ToString(txtCreditCardNo.Text); iBank = Convert.ToInt32(drpBankName.SelectedItem.Value); rvBank.Enabled = true; rvCheque.Enabled = true; } else { //Paymode as Cash rvBank.Enabled = false; rvCheque.Enabled = false; } /*March18*/ if (txtFreight.Text.Trim() != "") { dFreight = Convert.ToDouble(txtFreight.Text.Trim()); } if (txtLU.Text.Trim() != "") { dLU = Convert.ToDouble(txtLU.Text.Trim()); } /*March18*/ dTotalAmt = dTotalAmt + dFreight + dLU; ProdDataSales ds = new ProdDataSales(); string user = string.Empty; DataRow drNew = ds.Tables["productDs"].NewRow(); drNew["itemCode"] = cmbProdAdd.SelectedValue.ToString(); //drNew["ProductName"] = cmbProdAdd.SelectedItem.Text; drNew["ProductDesc"] = lblProdDescAdd.Text; drNew["Rate"] = txtRateAdd.Text.Trim(); drNew["Qty"] = txtQtyAdd.Text.Trim(); drNew["Measure_Unit"] = String.Empty; drNew["Discount"] = lblDisAdd.Text; drNew["IsRole"] = "N"; drNew["Rods"] = "0"; drNew["VAT"] = lblVATAdd.Text; drNew["CST"] = "0"; drNew["Bundles"] = "0"; drNew["ExecCharge"] = "0"; drNew["Total"] = GetTotal(Convert.ToDouble(txtQtyAdd.Text.Trim()), Convert.ToDouble(txtRateAdd.Text.Trim()), Convert.ToDouble(lblDisAdd.Text), Convert.ToDouble(lblVATAdd.Text), 0); ds.Tables["ProductDs"].Rows.Add(drNew); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { //old code //int billNo = bl.InsertSalesNewSeries("", sBilldate, sCustomerID, sCustomerName, sCustomerAddress, sCustomerContact, iPaymode, sCreditCardno, iBank, dTotalAmt, purchaseReturn, prReason, int.Parse(executive), dFreight, dLU, ds, sOtherCusName, "NO", null, "NO", "NO", sCustomerAddress2, sCustomerAddress3, executivename, despatchedfrom, fixedtotal, manualno, 0, user, "NO", "NO","",snarr,"","",0,""); // int billNo = bl.InsertSalesNewSeries("", sBilldate, sCustomerID, sCustomerName, sCustomerAddress, sCustomerContact, iPaymode, sCreditCardno, iBank, dTotalAmt, purchaseReturn, prReason, int.Parse(executive), dFreight, dLU,ds, sOtherCusName, "NO", null, "NO", "NO", sCustomerAddress2, sCustomerAddress3, executivename, despatchedfrom, fixedtotal, manualno, 0, user, "NO", "NO", "", snarr, "", "", 0, ""); int billNo = 1; if (billNo == -1) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Stock Limit is Less')", true); return; } else { Reset(); ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Sales Details Saved Successfully. Your Bill No. is " + billNo.ToString() + "')", true); } if (hdSMS.Value == "YES") { string conn = bl.CreateConnectionString(Request.Cookies["Company"].Value); string smsTEXT = smsTEXT = "This is the Electronic Receipt for your purchase. The Details are : "; //"Thank you for Purchasing with us. Total Purchase Amount Rs." + lblNet.Text; smsTEXT = smsTEXT + lblProdDescAdd.Text + " " + txtQtyAdd.Text + " Qty @ " + GetCurrencyType() + "." + GetProductTotalExVAT(double.Parse(txtQtyAdd.Text), double.Parse(txtRateAdd.Text), double.Parse(lblDisAdd.Text)); smsTEXT = smsTEXT + ". Total Bill Amount including Tax,Freight is " + GetCurrencyType() + "." + lblNet.Text; smsTEXT = smsTEXT + " . The Bill No. is " + billNo.ToString(); UtilitySMS utilSMS = new UtilitySMS(conn); string UserID = Page.User.Identity.Name; if (Session["Provider"] != null) { utilSMS.SendSMS(Session["Provider"].ToString(), Session["Priority"].ToString(), Session["SenderID"].ToString(), Session["UserName"].ToString(), Session["Password"].ToString(), sCustomerContact, smsTEXT, true, UserID); } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('you are not configured to send SMS. Please contact Administrator.');", true); } } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Please select the products for the bill before save')", true); return; } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Please select the products for the bill before update')", true); return; } } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }