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.
 
 
 
 
 

150 lines
6.3 KiB

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 CustomerSignature : System.Web.UI.Page
{
private readonly OnlineCustomerDao _cd = new OnlineCustomerDao();
private readonly SwiftLibrary sl = new SwiftLibrary();
protected void Page_Load(object sender, EventArgs e)
{
sl.CheckSession();
if (!IsPostBack)
{
GetStatic.PrintMessage(this.Page);
LoadCustomerDetails();
docDiv.Visible = false;
dateDiv.Visible = false;
//SavePDF();
}
}
private void LoadCustomerDetails()
{
var customerId = GetCustomerId();
var dataSet = _cd.GetCustomerInfoFromCustomerId(GetStatic.GetUser(), customerId);
//set customer details
SetCustomerDetails(dataSet.Rows[0]);
}
private string GetCustomerId()
{
return GetStatic.ReadQueryString("customerId", "");
}
private void SetCustomerDetails(DataRow dr)
{
//var result = dbResult.Id.Split('|');
//var customerId = result[0];
//var membershipId = result[1];
//var registerDate = result[2];
//string signatureName = GetStatic.UploadSignatureImage(hddImgURL.Value, registerDate, membershipId, customerId);
//if (signatureName != "1")
//{
// _cd.AddCustomerSignature(customerId, GetStatic.GetUser(), signatureName, "agent-upload", customerId);
//}
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();
txtMobileLoginAllowed.InnerText = dr["mobileUser"].ToString();
txtRemarks.InnerText = dr["remarks"].ToString();
txtSourceOfFund.InnerText = dr["sourceOfFund"].ToString();
}
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)", customerId);
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(), GetCustomerId(), "customer", "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 = "<div class=\"col-md-12\"><div class=\"form-group\"><label>Customer Signature:</label><img src=\"" + path + fileNameSignature + "\" height=\"150\" width=\"200\" /></div></div>";
todaysDate.InnerText = DateTime.Now.ToString("dd-MM-yyyy");
var sb = new StringBuilder();
downloadDivPDF.RenderControl(new HtmlTextWriter(new StringWriter(sb)));
string s = sb.ToString();
string fileName = GetStatic.HTMLToPDF(s, GetStatic.GetUser(), path, "customer-reg-form");
_cd.AddCustomerPDFUpload(customerId, GetStatic.GetUser(), fileName, "customer", GetCustomerId());
}
}
}