You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

111 lines
4.8 KiB

using Business.Configuration;
using Business.Customer;
using Common.Helper;
using System;
using System.Data;
using System.IO;
using System.Text;
using System.Web.UI;
namespace JMEAgentSystem.WebPages.CustomerRegistration
{
public partial class PrintDetails : System.Web.UI.Page
{
private readonly ICustomerServices _customerServices = AutoFacContainer.Resolve<ICustomerServices>();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetStatic.PrintMessage(this.Page);
LoadCustomerDetails();
todaysDate.InnerText = DateTime.Now.ToString("dd-MM-yyyy");
SavePDF();
}
}
private void SavePDF()
{
var result = _customerServices.GetCustomerDetailsForPDFSave(GetMembershipId(), GetStatic.ReadQueryString("customerId", ""), "customer").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, "customer-req-form");
_customerServices.AddCustomerPDFUpload(customerId, GetStatic.GetUser(), fileName, "customer", customerId);
}
protected void approve_Click(object sender, EventArgs e)
{
}
private void LoadCustomerDetails()
{
var membershipId = GetMembershipId();
// var receiverId = GetReceiverId();
if (membershipId == "")
{
return;
}
var dataSet = _customerServices.GetCustomerInfoFromMembershiId(GetStatic.GetUser(), membershipId,"", "");
//set customer details
SetCustomerDetails(dataSet.Tables[1].Rows[0]);
}
private string GetMembershipId()
{
return GetStatic.ReadQueryString("membershipId", "");
}
private void SetCustomerDetails(DataRow dr)
{
hdnCustomerId.Value = dr["customerId"].ToString();
txtCustomerType.InnerText = dr["customerType"].ToString();
txtFullName.InnerText = dr["fullName"].ToString();
customerName.InnerText = dr["fullName"].ToString();
membershiId.InnerText = dr["membershipId"].ToString();
hdnAccountName.Value = txtFullName.InnerText;
txtGender.InnerText = dr["gender"].ToString();
txtCountry.InnerText = dr["country"].ToString();
txtAddress.InnerText = dr["address"].ToString();
txtZipcCode.InnerText = dr["zipcode"].ToString();
txtCity.InnerText = dr["city"].ToString();
txtEmailId.InnerText = dr["email"].ToString();
txtTelephoneNo.InnerText = dr["telNo"].ToString();
txtMobileNo.InnerText = dr["mobile"].ToString();
txtNativeCountry.InnerText = dr["nativeCountry"].ToString();
txtDateOfBirth.InnerText = dr["dob"].ToString();
txtOccupation.InnerText = dr["occupation"].ToString();
txtOtherOccupation.InnerText = dr["occupationOther"].ToString();
txtIssueDate.InnerText = dr["idIssueDate"].ToString();
txtExpireDate.InnerText = dr["idExpiryDate"].ToString();
txtIdType.InnerText = dr["idType"].ToString();
txtIdNumber.InnerText = dr["idNumber"].ToString();
txtVisaStatus.InnerText = dr["visaStatus"].ToString();
txtEmployeeBusinessType.InnerText = dr["employeeBusinessType"].ToString();
txtNameOfEmployer.InnerText = dr["nameOfEmployeer"].ToString();
txtMonthlyIncome.InnerText = dr["monthlyIncome"].ToString();
txtRemittanceAllowed.InnerText = dr["remittanceAllowed"].ToString();
txtOnlineLoginAllowed.InnerText = dr["onlineUser"].ToString();
txtRemarks.InnerText = dr["remarks"].ToString();
txtSourceOfFund.InnerText = dr["sourceOfFund"].ToString();
}
}
}