using Swift.DAL.BL.Remit.Transaction; using Swift.DAL.OnlineAgent; using Swift.web.Library; using System; using System.Data; using System.IO; using System.Text; using System.Web.UI; namespace Swift.web.AgentNew.TabletMenu { public partial class TransactionSignature : System.Web.UI.Page { private readonly OnlineCustomerDao _cd = new OnlineCustomerDao(); private readonly ReceiptDao obj = new ReceiptDao(); private readonly SwiftLibrary sl = new SwiftLibrary(); protected void Page_Load(object sender, EventArgs e) { sl.CheckSession(); if (!IsPostBack) { ShowData(); ShowSingleReceipt(); docDiv.Visible = false; dateDiv.Visible = false; } } private void ShowSingleReceipt() { divInvoiceSecond.Attributes.Add("style", "margin: 15px 0; display: none;"); divInvoiceSecond1.Attributes.Add("style", "display: none;"); } private string GetCustomerId() { return GetStatic.ReadQueryString("customerId", ""); } private string GetControlNo() { return GetStatic.ReadQueryString("controlNo", ""); } protected void ShowData() { //lblControlNo.Text = GetStatic.GetTranNoName(); DataSet ds = obj.GetSendIntlReceipt(GetControlNo(), GetStatic.GetUser(), "S"); if (ds.Tables.Count >= 1) { if (ds.Tables[0].Rows.Count > 0) { //Load Sender Information DataRow sRow = ds.Tables[0].Rows[0]; senderName.Text = sRow["senderName"].ToString(); sMemId.Text = sRow["sMemId"].ToString(); sAddress.Text = sRow["sAddress"].ToString(); sNativeCountry.Text = sRow["sNativeCountry"].ToString(); purpose.Text = sRow["purpose"].ToString(); sDob.Text = sRow["sDob"].ToString(); sContactNo.Text = sRow["sContactNo"].ToString(); visaStatus.Text = sRow["visaStatus"].ToString(); //Load Receiver Information receiverName.Text = sRow["receiverName"].ToString(); pAgentCountry.Text = sRow["pAgentCountry"].ToString(); paymentMode.Text = sRow["paymentMode"].ToString(); rContactNo.Text = sRow["rContactNo"].ToString(); pAgent.Text = sRow["pAgent"].ToString(); rAddress.Text = sRow["rAddress"].ToString(); pBankName.Text = sRow["pBankName"].ToString(); relationShip.Text = sRow["relwithSender"].ToString(); serial1.Text = sRow["tranId"].ToString(); serial2.Text = sRow["tranId"].ToString(); //comment by gunn //pBranchName.Text = sRow["pBranchName"].ToString(); pBranchName.Text = sRow["BranchName"].ToString(); accountNo.Text = sRow["accountNo"].ToString(); rAmtWords.Text = GetStatic.NumberToWord(sRow["pAmt"].ToString()); controlNo.Text = sRow["controlNo"].ToString(); createdBy.Text = sRow["createdBy"].ToString(); approvedDate.Text = DateTime.Parse(sRow["createdDate"].ToString()).ToString("yyyy-MM-dd hh:mm:ss tt"); cAmt.Text = GetStatic.ShowWithoutDecimal(sRow["cAmt"].ToString()) + " " + sRow["collCurr"].ToString(); serviceCharge.Text = GetStatic.ShowWithoutDecimal(sRow["serviceCharge"].ToString()) + " " + sRow["collCurr"].ToString(); tAmt.Text = GetStatic.ShowWithoutDecimal(sRow["tAmt"].ToString()) + " " + sRow["collCurr"].ToString(); exRate.Text = sRow["exRate"].ToString() + " " + sRow["payoutCurr"].ToString(); pAmt.Text = GetStatic.ShowDecimal(sRow["pAmt"].ToString()) + " " + sRow["payoutCurr"].ToString(); depositType.Text = sRow["collMode"].ToString(); depositType1.Text = sRow["collMode"].ToString(); operator1.Text = sRow["createdBy"].ToString(); //for second from //Load Sender Information senderName1.Text = sRow["senderName"].ToString(); sMemId1.Text = sRow["sMemId"].ToString(); sAddress1.Text = sRow["sAddress"].ToString(); sNativeCountry1.Text = sRow["sNativeCountry"].ToString(); purpose1.Text = sRow["purpose"].ToString(); sDob1.Text = sRow["sDob"].ToString(); sContactNo1.Text = sRow["sContactNo"].ToString(); visaStatus1.Text = sRow["visaStatus"].ToString(); //Load Receiver Information receiverName1.Text = sRow["receiverName"].ToString(); pAgentCountry1.Text = sRow["pAgentCountry"].ToString(); paymentMode1.Text = sRow["paymentMode"].ToString(); rContactNo1.Text = sRow["rContactNo"].ToString(); pAgent1.Text = sRow["pAgent"].ToString(); rAddress1.Text = sRow["rAddress"].ToString(); pBankName1.Text = sRow["pBankName"].ToString(); relationship1.Text = sRow["relwithSender"].ToString(); pBranchName1.Text = sRow["BranchName"].ToString(); accountNo1.Text = sRow["accountNo"].ToString(); rAmtWords1.Text = GetStatic.NumberToWord(sRow["pAmt"].ToString()); controlNo1.Text = sRow["controlNo"].ToString(); createdBy1.Text = sRow["createdBy"].ToString(); approvedDate1.Text = DateTime.Parse(sRow["createdDate"].ToString()).ToString("yyyy-MM-dd hh:mm:ss tt"); cAmt1.Text = GetStatic.ShowWithoutDecimal(sRow["cAmt"].ToString()) + " " + sRow["collCurr"].ToString(); serviceCharge1.Text = GetStatic.ShowWithoutDecimal(sRow["serviceCharge"].ToString()) + " " + sRow["collCurr"].ToString(); tAmt1.Text = GetStatic.ShowWithoutDecimal(sRow["tAmt"].ToString()) + " " + sRow["collCurr"].ToString(); exRate1.Text = sRow["exRate"].ToString() + " " + sRow["payoutCurr"].ToString(); pAmt1.Text = GetStatic.ShowDecimal(sRow["pAmt"].ToString()) + " " + sRow["payoutCurr"].ToString(); operator2.Text = sRow["createdBy"].ToString(); if (sRow["paymentMethod"].ToString().ToUpper().Equals("CASH PAYMENT")) { bank3.Attributes.Add("style", "display: none;"); bank4.Attributes.Add("style", "display: none;"); bank5.Attributes.Add("style", "display: none;"); bank6.Attributes.Add("style", "display: none;"); bank7.Attributes.Add("style", "display: none;"); bank8.Attributes.Add("style", "display: none;"); bank9.Attributes.Add("style", "display: none;"); bank10.Attributes.Add("style", "display: none;"); bankLable.InnerHtml = "Cash Location"; bankLable1.InnerHtml = "Cash Location"; } } } } protected void registerCustomerAndReceiver_Click(object sender, EventArgs e) { var ImgURL = hddImgURL.Value; if (string.IsNullOrEmpty(ImgURL)) { GetStatic.AlertMessage(this, "No signature found!"); return; } var customerId = GetCustomerId(); var customerDetails = _cd.GetRequiredCustomerDetails(customerId, GetStatic.GetUser()); string membershipId = Convert.ToString(customerDetails["membershipId"]); string registrationDate = Convert.ToString(customerDetails["createdDate"]); string signatureName = GetStatic.UploadSignatureImage(ImgURL, registrationDate, membershipId, customerId); if (signatureName != "1") { var dbRes = _cd.AddCustomerSignature(customerId, GetStatic.GetUser(), signatureName, "Counter (Customer-Signature-txn)", GetControlNo()); GetStatic.SetMessage(dbRes); if (dbRes.ErrorCode == "0") { SavePDF(); } Response.Redirect("/AgentNew/TabletMenu/CustomerPendingList.aspx"); } } private void SavePDF() { customerSign.Visible = false; customerVerifyBtn.Visible = false; docDiv.Visible = true; dateDiv.Visible = true; var result = _cd.GetCustomerDetailsForPDFSave(GetCustomerId(), GetControlNo(), "txn", "Y").Split('|'); if (result[0] != "0") { return; } var customerId = result[1]; var membershipId = result[2]; var registerDate = result[3]; var fileNameSignature = result[4]; string path = GetStatic.GetCustomerFilePath() + "CustomerDocument\\" + registerDate.Replace("-", "\\") + "\\" + membershipId + "\\"; docDiv.InnerHtml = "
"; todaysDate.InnerText = DateTime.Now.ToString("dd-MM-yyyy"); var sb = new StringBuilder(); downloadDivPDF.RenderControl(new HtmlTextWriter(new StringWriter(sb))); string s = sb.ToString(); string replaceText = ""; s = s.Replace(replaceText, ""); string fileName = GetStatic.HTMLToPDF(s, GetStatic.GetUser(), path, "customer-send-txn-form"); _cd.AddCustomerPDFUpload(customerId, GetStatic.GetUser(), fileName, "txn", GetControlNo()); } } }