using Business.Configuration; using Business.Customer; using Common.Helper; using JMEAgentSystem.WebPages.CustomerRegistration; using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace JMEAgentSystem.WebPages.SendTxn { public partial class PrintSendMoneyRequestDetails : System.Web.UI.Page { private readonly ICustomerServices _customerServices = AutoFacContainer.Resolve(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GetStatic.PrintMessage(this.Page); LoadCustomerDetails(); SavePDF(); } } private void SavePDF() { var result = _customerServices.GetCustomerDetailsForPDFSave(GetMembershipId(), GetRowId(), "txn").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 + "\\"; var sb = new StringBuilder(); downloadDivPDF.RenderControl(new HtmlTextWriter(new StringWriter(sb))); string s = sb.ToString(); string replaceText = "/WebPages/GetFileView.ashx?registerDate=" + Convert.ToDateTime(registerDate).ToString("yyyy-MM-dd") + "&customerId=" + customerId + "&membershipNo=" + membershipId + "&fileName=" + fileNameSignature; s = s.Replace(replaceText, path + fileNameSignature); string fileName = GetStatic.HTMLToPDF(s, GetStatic.GetUser(), path, "txn-req-form"); _customerServices.AddCustomerPDFUpload(customerId, GetStatic.GetUser(), fileName, "txn", GetRowId()); } protected void approve_Click(object sender, EventArgs e) { } private void LoadCustomerDetails() { var membershipId = GetMembershipId(); var rowId = GetRowId(); if (rowId == "" || membershipId == "") { return; } var dataSet = _customerServices.GetCustomerInfoFromMembershiId(GetStatic.GetUser(), membershipId, "", rowId); SetCustomerDetails(dataSet.Tables[1].Rows[0]); //set receiver dettails SetTransactionDetails(dataSet.Tables[3].Rows[0]); PrintDetails pd = new PrintDetails(); docDiv.InnerHtml = pd.GetSignatrueHtml(dataSet, "agent-upload-txn", rowId); } private string GetMembershipId() { return GetStatic.ReadQueryString("customerId", ""); } private string GetRowId() { return GetStatic.ReadQueryString("rowId", ""); } private void SetTransactionDetails(DataRow dr) { idNumber.InnerText = dr["idNumber"].ToString(); custFullName.InnerText = dr["custFullName"].ToString(); recFullName.InnerText = dr["receiverFullName"].ToString(); recAddress.InnerText = dr["receiverAddress"].ToString(); recMobile.InnerText = dr["ReceiverMobileNumber"].ToString(); pCountry.InnerText = dr["pcountry"].ToString(); pmode.InnerText = dr["pMode"].ToString(); pAgent.InnerText = dr["BANK_NAME"].ToString(); pBranch.InnerText = dr["BRANCH_NAME"].ToString(); accountNo.InnerText = dr["accountNumber"].ToString(); cAmt.InnerText = dr["cAmt"].ToString(); tAmt.InnerText = dr["tAmt"].ToString(); serviceCharge.InnerText = dr["serviceCharge"].ToString(); purpose.InnerText = dr["purposeOfRemit"].ToString(); relationship.InnerText = dr["relationship"].ToString(); otherRelation.InnerText = dr["otherRelation"].ToString(); otherPurpose.InnerText = dr["otherPurpose"].ToString(); collMode.InnerText = dr["collMode"].ToString(); } private void SetCustomerDetails(DataRow dr) { customerName.InnerText = dr["fullName"].ToString(); membershiId.InnerText = dr["membershipId"].ToString(); custAddress.InnerText = dr["address"].ToString(); custDob.InnerText = dr["dob"].ToString(); custOccupation.InnerText = dr["occupation"].ToString(); } } }