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.
527 lines
25 KiB
527 lines
25 KiB
using Swift.DAL.OnlineAgent;
|
|
using Swift.DAL.SwiftDAL;
|
|
using Swift.web.Library;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Script.Serialization;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace Swift.web.MobileRemit.Agent.ApproveCustomer
|
|
{
|
|
public partial class EditCustomerFromMobile : System.Web.UI.Page
|
|
{
|
|
private readonly RemittanceLibrary _sl = new RemittanceLibrary();
|
|
private readonly OnlineCustomerDao _cd = new OnlineCustomerDao();
|
|
private readonly StaticDataDdl _sdd = new StaticDataDdl();
|
|
|
|
private const string ViewFunctionIdFromMobile = "20450000";
|
|
private const string AddFunctionIdFromMobile = "20450030";
|
|
private const string SaveEditIdFromMobile = "20203000";
|
|
// private const string SignatureFunctionIdFromMobile = "20450040";
|
|
|
|
private const string ViewFunctionIdFromAgent = "20400000";
|
|
private const string AddFunctionIdFromAgent = "20400030";
|
|
private const string SaveEditIdFromAgent = "20450020";
|
|
// private const string SignatureFunctionIdFromAgent = "20400040";
|
|
|
|
private bool isEdit = Convert.ToBoolean(GetStatic.ReadQueryString("edit", "false"));
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
Authenticate();
|
|
signatureDiv.Visible = !CheckAddOrEdit() && _sl.HasRight(GetFunctionIdByUserType(ViewFunctionIdFromAgent, ViewFunctionIdFromMobile));
|
|
isDisplaySignature.Value = !CheckAddOrEdit() && _sl.HasRight(GetFunctionIdByUserType(ViewFunctionIdFromAgent, ViewFunctionIdFromMobile)) ? "true" : "false";
|
|
GetStatic.PrintMessage(Page);
|
|
displayOnlyOnEdit.Visible = CheckAddOrEdit();
|
|
addEditPanel.Attributes.Add("style", "display:" + (CheckAddOrEdit() ? "none" : ""));
|
|
displayCounterVisit.Visible = !CheckAddOrEdit();
|
|
|
|
var MethodName = Request.Form["MethodName"];
|
|
if (!IsPostBack)
|
|
{
|
|
PopulateDdl();
|
|
if (MethodName == "GetAddressDetailsByZipCode")
|
|
{
|
|
GetAddressDetailsByZipCode();
|
|
}
|
|
if (MethodName == "GetCustomerDetails")
|
|
{
|
|
GetCustomerDetails();
|
|
}
|
|
if (MethodName == "GetImageUrl")
|
|
{
|
|
GetImageUrl();
|
|
}
|
|
if (MethodName == "GetSignature")
|
|
{
|
|
GetSignature();
|
|
}
|
|
}
|
|
if (GetVerificationType() == "verify")
|
|
{
|
|
SaveEditedData.Text = "Verify";
|
|
}
|
|
}
|
|
protected string GetCustomerId()
|
|
{
|
|
return GetStatic.ReadQueryString("customerId", "");
|
|
}
|
|
protected string GetRequestFrom()
|
|
{
|
|
return GetStatic.ReadQueryString("requestFrom", "");
|
|
}
|
|
protected string GetVerificationType()
|
|
{
|
|
return GetStatic.ReadQueryString("type", "");
|
|
}
|
|
private void Authenticate()
|
|
{
|
|
if (CheckAddOrEdit())
|
|
_sl.CheckAuthentication(GetFunctionIdByUserType(SaveEditIdFromAgent, SaveEditIdFromMobile));
|
|
else
|
|
_sl.CheckAuthentication(GetFunctionIdByUserType(AddFunctionIdFromAgent, AddFunctionIdFromMobile));
|
|
|
|
string eId = GetStatic.ReadQueryString("customerId", "");
|
|
|
|
var hasRight = false;
|
|
if (eId == "")
|
|
{
|
|
hasRight = _sl.HasRight(GetFunctionIdByUserType(AddFunctionIdFromAgent, AddFunctionIdFromMobile));
|
|
}
|
|
else
|
|
{
|
|
hasRight = _sl.HasRight(GetFunctionIdByUserType(SaveEditIdFromAgent, SaveEditIdFromMobile));
|
|
}
|
|
}
|
|
|
|
private bool CheckAddOrEdit()
|
|
{
|
|
if (isEdit)
|
|
{
|
|
customerType.Attributes.Add("hidden", "hidden");
|
|
}
|
|
else
|
|
{
|
|
customerType.Attributes.Remove("hidden");
|
|
}
|
|
return isEdit;
|
|
}
|
|
public string GetFunctionIdByUserType(string functionIdAgent, string functionIdAdmin)
|
|
{
|
|
return (GetStatic.GetUserType() == "HO") ? functionIdAdmin : functionIdAgent;
|
|
}
|
|
|
|
private void GetAddressDetailsByZipCode()
|
|
{
|
|
string zipCode = Request.Form["zipCode"];
|
|
string rowID = Request.Form["RowID"];
|
|
string customerId = GetCustomerId();
|
|
var dr = _cd.GetAddressByZipCodeNew(zipCode, GetStatic.GetUser(), rowID, customerId);
|
|
|
|
//CustomerAddress _cAddress = new CustomerAddress();
|
|
//if (dr != null)
|
|
//{
|
|
// _cAddress.errrorCode = dr["errorCode"].ToString();
|
|
// _cAddress.msg = dr["msg"].ToString();
|
|
// if (dr["errorCode"].ToString() == "0")
|
|
// {
|
|
// _cAddress.State = dr["STATE_ID"].ToString();
|
|
// _cAddress.City = dr["CITY_NAME"].ToString();
|
|
// _cAddress.Street = dr["STREET_NAME"].ToString();
|
|
// }
|
|
//}
|
|
|
|
var json = GetStatic.DataTableToJson(dr);
|
|
|
|
GetStatic.JsonResponse(json, this);
|
|
}
|
|
private void GetCustomerDetails()
|
|
{
|
|
string eId = Request.Form["Id"];
|
|
var dt = _cd.GetDetailsForEditCustomer(eId, GetStatic.GetUser());
|
|
//hdnDocument.Value = populateDocument();
|
|
Response.ContentType = "text/plain";
|
|
var json = DataTableToJson(dt);
|
|
Response.Write(json);
|
|
Response.End();
|
|
}
|
|
public static string DataTableToJson(DataTable table)
|
|
{
|
|
if (table == null)
|
|
return "";
|
|
var list = new List<Dictionary<string, object>>();
|
|
|
|
foreach (DataRow row in table.Rows)
|
|
{
|
|
var dict = new Dictionary<string, object>();
|
|
|
|
foreach (DataColumn col in table.Columns)
|
|
{
|
|
dict[col.ColumnName] = string.IsNullOrEmpty(row[col].ToString()) ? "" : row[col];
|
|
}
|
|
list.Add(dict);
|
|
}
|
|
var serializer = new JavaScriptSerializer();
|
|
string json = serializer.Serialize(list);
|
|
return json;
|
|
}
|
|
private void PopulateDdl()
|
|
{
|
|
_sl.SetDDL(ref genderList, "EXEC proc_online_dropDownList @flag='GenderList',@user='" + GetStatic.GetUser() + "'", "valueId", "detailTitle", "", "Select..");
|
|
_sl.SetDDL(ref countryList, "EXEC proc_online_dropDownList @flag='onlineCountrylist',@user='" + GetStatic.GetUser() + "'", "countryId", "countryName", "", "");
|
|
_sl.SetDDL(ref nativeCountry, "EXEC proc_online_dropDownList @flag='allCountrylist',@user='" + GetStatic.GetUser() + "'", "countryId", "countryName", "", "Select..");
|
|
_sl.SetDDL(ref occupation, "EXEC proc_online_dropDownList @flag='occupationList',@user='" + GetStatic.GetUser() + "'", "valueId", "detailTitle", "", "Select..");
|
|
_sl.SetDDL(ref idType, "EXEC proc_online_dropDownList @flag='IdTypeWithDetails',@user='" + GetStatic.GetUser() + "',@countryId='" + countryList.SelectedValue + "'", "valueId", "detailTitle", "", "Select..");
|
|
_sl.SetDDL(ref ddlCustomerType, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=4700", "valueId", "detailTitle", ddlCustomerType.SelectedValue, "");
|
|
_sl.SetDDL(ref ddlOrganizationType, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=7002", "valueId", "detailTitle", "", "Select..");
|
|
_sl.SetDDL(ref ddlnatureOfCompany, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=7003", "valueId", "detailTitle", "", "Select..");
|
|
_sl.SetDDL(ref ddlEmployeeBusType, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=7004", "valueId", "detailTitle", "", "");
|
|
_sl.SetDDL(ref ddlVisaStatus, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=7005", "valueId", "detailTitle", "", "Select..");
|
|
_sl.SetDDL(ref ddlPosition, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=7006", "valueId", "detailTitle", "", "Select..");
|
|
_sl.SetDDL(ref ddlState, "EXEC proc_online_dropDownList @flag='state',@countryId='" + countryList.SelectedValue + "'", "stateId", "stateName", "", "Select..");
|
|
_sdd.SetDDL(ref ddlSearchBy, "exec proc_sendPageLoadData @flag='search-cust-by'", "VALUE", "TEXT", "", "");
|
|
_sdd.SetStaticDdl(ref ddlDocType, "7009", "", "Select");
|
|
}
|
|
protected void register_Click(object sender, EventArgs e)
|
|
{
|
|
string eId = GetStatic.ReadQueryString("customerId", "");
|
|
string verifyType = GetStatic.ReadQueryString("type", "");
|
|
//string createdFrom = GetStatic.ReadQueryString("createdUserFrom", "");
|
|
string createdFrom = hdnCreatedFrom.Value;
|
|
|
|
if (eId == "")
|
|
{
|
|
if (!_sl.HasRight(GetFunctionIdByUserType(AddFunctionIdFromAgent, AddFunctionIdFromMobile)))
|
|
{
|
|
GetStatic.AlertMessage(this, "You are not authorized to Add Customer!");
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!_sl.HasRight(GetFunctionIdByUserType(SaveEditIdFromAgent, SaveEditIdFromMobile)))
|
|
{
|
|
GetStatic.AlertMessage(this, "You are not authorized to Edit Customer!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (hddTxnsMade.Value == "Y" && (!email.Text.Equals(hddOldEmailValue.Value.ToString())))
|
|
{
|
|
GetStatic.AlertMessage(this, "You can not change the email of customer who have already done transaction!");
|
|
return;
|
|
}
|
|
//if (_sl.HasRight(SignatureFunctionIdFromAgent) && !isEdit && (string.IsNullOrEmpty(customerPassword.Text) || string.IsNullOrWhiteSpace(customerPassword.Text)) && (string.IsNullOrEmpty(hddImgURL.Value) || string.IsNullOrWhiteSpace(hddImgURL.Value)))
|
|
//{
|
|
// GetStatic.AlertMessage(this, "Customer signature or customer password is required!");
|
|
// return;
|
|
//}
|
|
//if (_sl.HasRight(SignatureFunctionIdFromMobile) && !isEdit && (string.IsNullOrEmpty(customerPassword.Text) || string.IsNullOrWhiteSpace(customerPassword.Text)) && (string.IsNullOrEmpty(hddImgURL.Value) || string.IsNullOrWhiteSpace(hddImgURL.Value)))
|
|
//{
|
|
// GetStatic.AlertMessage(this, "Customer signature or customer password is required!");
|
|
// return;
|
|
//}
|
|
string trimmedfirstName = firstName.Text.Trim() == "" ? null : firstName.Text.Trim();
|
|
string trimmedMiddleName = middleName.Text.Trim() == "" ? null : middleName.Text.Trim();
|
|
string trimmedlastName = lastName.Text.Trim() == "" ? null : lastName.Text.Trim();
|
|
|
|
string area = Request.Form["ctl00$ContentPlaceHolder1$txtStreet"];
|
|
|
|
OnlineCustomerModel customerModel = new OnlineCustomerModel()
|
|
{
|
|
flag = "customer-register-core",
|
|
firstName = trimmedfirstName,
|
|
middleName = trimmedMiddleName,
|
|
lastName1 = trimmedlastName,
|
|
gender = genderList.SelectedValue,
|
|
customerType = ddlCustomerType.SelectedValue,
|
|
country = countryList.Text,
|
|
address = addressLine1.Text,
|
|
zipCode = zipCode.Text,
|
|
street = Request.Form["ctl00$ContentPlaceHolder1$txtStreet"],
|
|
AdditionalAddress = txtAdditionalAddress.Text,
|
|
city = cityHidden.Value,
|
|
state = ddlStateHidden.Value,
|
|
senderCityjapan = txtsenderCityjapan.Text,
|
|
email = email.Text,
|
|
streetJapanese = txtstreetJapanese.Text,
|
|
homePhone = phoneNumber.Text,
|
|
mobile = mobile.Text,
|
|
visaStatus = ddlVisaStatus.SelectedValue,
|
|
employeeBusinessType = ddlEmployeeBusType.SelectedValue,
|
|
nativeCountry = nativeCountry.SelectedValue,
|
|
dob = dob.Text,
|
|
occupation = occupation.Text,
|
|
telNo = phoneNumber.Text,
|
|
ipAddress = GetStatic.GetIp(),
|
|
createdBy = GetStatic.GetUser(),
|
|
idNumber = verificationTypeNo.Text,
|
|
idIssueDate = IssueDate.Text,
|
|
idExpiryDate = ExpireDate.Text,
|
|
idType = idType.Text.Split('|')[0].ToString(),
|
|
membershipId = txtMembershipId.Text,
|
|
remitanceAllowed = (rbRemitanceAllowed.SelectedValue == "Enabled" ? true : false),
|
|
onlineUser = (rbOnlineLogin.SelectedValue == "Enabled" ? true : false),
|
|
mobileUser = (rbMobileLogin.SelectedValue == "Enabled" ? true : false),
|
|
remarks = txtRemarks.Text,
|
|
registrationNo = txtRegistrationNo.Text,
|
|
natureOfCompany = ddlnatureOfCompany.Text,
|
|
organizationType = ddlOrganizationType.SelectedValue,
|
|
dateOfIncorporation = txtDateOfIncorporation.Text,
|
|
position = ddlPosition.SelectedValue,
|
|
nameofAuthoPerson = txtNameofAuthoPerson.Text,
|
|
nameofEmployeer = txtNameofEmployeer.Text,
|
|
companyName = txtCompanyName.Text,
|
|
MonthlyIncome = ddlSalary.Text,
|
|
IsCounterVisited = customerCounterVisit.Checked ? "Y" : "N",
|
|
customerPassword = customerPassword.Text,
|
|
agentId = GetStatic.GetAgent().ToInt(),
|
|
DocumentType = ddlDocType.SelectedValue,
|
|
occupationOther = occupationText.Text,
|
|
otherIdNumber = otherVerificationTypeNo.Text
|
|
};
|
|
|
|
if (hdnCustomerId.Value != "")
|
|
{
|
|
customerModel.customerId = hdnCustomerId.Value;
|
|
customerModel.flag = "customer-editeddata";
|
|
}
|
|
|
|
var dbResult = _cd.RegisterCustomerNewAgent(customerModel);
|
|
if (dbResult.ErrorCode == "0" && !string.IsNullOrEmpty(hddImgURL.Value) && !string.IsNullOrWhiteSpace(hddImgURL.Value))
|
|
{
|
|
var customerDetails = _cd.GetRequiredCustomerDetails(dbResult.Id, GetStatic.GetUser());
|
|
string membershipId = Convert.ToString(customerDetails["membershipId"]);
|
|
string registrationDate = Convert.ToString(customerDetails["createdDate"]);
|
|
var verificationCode = dbResult.Id;
|
|
var customerId = dbResult.Id;
|
|
var fileCollection = Request.Files;
|
|
if (UploadSignatureImage(hddImgURL.Value, registrationDate, membershipId, customerId) == 0)
|
|
{
|
|
_cd.AddCustomerSignature(customerId, GetStatic.GetUser(), customerId + "_signature.png");
|
|
}
|
|
}
|
|
if (dbResult.ErrorCode == "0")
|
|
{
|
|
saveCustomerDocument(dbResult);
|
|
Approve(sender, e, createdFrom, verifyType);
|
|
}
|
|
GetStatic.SetMessage(dbResult.ErrorCode, dbResult.Msg);
|
|
Page_Load(sender, e);
|
|
return;
|
|
}
|
|
public int UploadSignatureImage(string imageData, string registerDate, string membershipId, string customerId)
|
|
{
|
|
int errorCode = 0;
|
|
try
|
|
{
|
|
string path = GetStatic.ReadWebConfig("customerDocPath", "") + "CustomerDocument\\" + registerDate.Replace("-", "\\") + "\\" + membershipId;
|
|
if (!Directory.Exists(path))
|
|
Directory.CreateDirectory(path);
|
|
|
|
string fileName = path + "\\" + customerId + "_signature" + ".png";
|
|
using (FileStream fs = new FileStream(fileName, FileMode.CreateNew))
|
|
{
|
|
using (BinaryWriter bw = new BinaryWriter(fs))
|
|
{
|
|
byte[] data = Convert.FromBase64String(imageData);
|
|
bw.Write(data);
|
|
bw.Close();
|
|
}
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
errorCode = 1;
|
|
}
|
|
return errorCode;
|
|
}
|
|
|
|
protected void Approve(object sender, EventArgs e, string createdFrom, string verifyType)
|
|
{
|
|
string userCreatedFrm = GetStatic.ReadQueryString("createdUserFrom", "");
|
|
|
|
DataSet ds = new DataSet();
|
|
if (GetRequestFrom() == "agent")
|
|
{
|
|
ds = _cd.ApprovePending(GetCustomerId(), GetStatic.GetUser(), "");
|
|
}
|
|
else
|
|
{
|
|
ds = _cd.ApprovePendingFromMobile(GetCustomerId(), GetStatic.GetUser(), createdFrom, verifyType, "");
|
|
}
|
|
|
|
DbResult dbRes = _cd.ParseDbResult(ds.Tables[0]);
|
|
|
|
if (dbRes.ErrorCode == "1")
|
|
{
|
|
GetStatic.AlertMessage(this.Page, dbRes.Msg);
|
|
}
|
|
else
|
|
{
|
|
dbRes.Msg = "Customer saved and approved successfully!!!";
|
|
GetStatic.SetMessage(dbRes);
|
|
if (dbRes.Extra.ToLower() == "y" && dbRes.Extra2.ToLower() == "approved")
|
|
{
|
|
Response.Redirect("/MobileRemit/Agent/ApproveCustomer/List.aspx");
|
|
|
|
return;
|
|
}
|
|
if (dbRes.Extra.ToLower() == "y" && dbRes.Extra2.ToLower() == "verified")
|
|
{
|
|
Response.Redirect("/MobileRemit/Agent/ApproveCustomer/VerifyList.aspx");
|
|
return;
|
|
}
|
|
if (GetRequestFrom() == "mobile" && dbRes.Extra2.ToLower() == "approved")
|
|
{
|
|
Response.Redirect("/AgentNew/Transaction/Letters/LetterForCustomerFromMobile.aspx?createdFrom=" + createdFrom + "&customerId=" + GetCustomerId() + "&membershipId=" + ds.Tables[1].Rows[0]["account"].ToString() + "");
|
|
}
|
|
else
|
|
{
|
|
Response.Redirect("/AgentNew/Transaction/Letters/LetterForCustomerFromOthers.aspx?customerId=" + GetCustomerId() + "&membershipId=" + ds.Tables[1].Rows[0]["account"].ToString() + "");
|
|
}
|
|
}
|
|
}
|
|
|
|
public void GetImageUrl()
|
|
{
|
|
var customerId = Request.Form["customerId"];
|
|
var membershipId = Request.Form["membershipId"];
|
|
var registerDate = Request.Form["registerDate"];
|
|
var documentDetails = _cd.GetDocumentByCustomerId(customerId);
|
|
string[] imageUrlArray = new string[documentDetails.Rows.Count+1];
|
|
if (documentDetails != null)
|
|
{
|
|
int i = 0;
|
|
int j = 1;
|
|
foreach (DataRow item in documentDetails.Rows)
|
|
{
|
|
string imageUrl = "";
|
|
string docName = "";
|
|
|
|
if (item["documentType"].ToString() == "0")
|
|
{
|
|
docName = "Signature";
|
|
imageUrl = "/Handler/CustomerSignature.ashx?registerDate=" + Convert.ToDateTime(registerDate).ToString("yyyy-MM-dd") + "&customerId=" + customerId + "&membershipNo=" + membershipId + "&fileName=" + item["fileName"]; ;
|
|
imageUrlArray[i] = imageUrl;
|
|
}
|
|
else
|
|
{
|
|
|
|
docName = item["documentName"].ToString();
|
|
imageUrl = "/Handler/CustomerSignature.ashx?registerDate=" + Convert.ToDateTime(registerDate).ToString("yyyy-MM-dd") + "&customerId=" + customerId + "&membershipNo=" + membershipId + "&fileName=" + item["fileName"];
|
|
imageUrlArray[j] = imageUrl;
|
|
j++;
|
|
}
|
|
}
|
|
}
|
|
Response.ContentType = "text/plain";
|
|
var serializer = new JavaScriptSerializer();
|
|
var json = serializer.Serialize(imageUrlArray);
|
|
Response.Write(json);
|
|
Response.End();
|
|
|
|
}
|
|
private void saveCustomerDocument(DbResult dbresult)
|
|
{
|
|
var result = dbresult.Id.Split('|');
|
|
var customerId = result[0];
|
|
var membershipId = result[1];
|
|
var registerDate = result[2];
|
|
|
|
HttpFileCollection fileCollection = Request.Files;
|
|
|
|
for (int i = 0; i < fileCollection.AllKeys.Length; i++)
|
|
{
|
|
HttpPostedFile file = fileCollection[i];
|
|
if (file != null)
|
|
{
|
|
string documentTypeName = "";
|
|
string documentType = "";
|
|
string fileType = "";
|
|
if (i == 0)
|
|
{
|
|
documentTypeName = "Alien Registration Card(Front)";
|
|
documentType = "11054";
|
|
}
|
|
else
|
|
{
|
|
documentTypeName = "Alien Registration Card(Back)";
|
|
documentType = "11055";
|
|
}
|
|
string fileName = (!string.IsNullOrWhiteSpace(file.FileName) ? UploadDocument(file, customerId, documentTypeName, membershipId, registerDate, out fileType) : UploadDocument(file, customerId, documentType, membershipId, registerDate, out fileType));
|
|
CustomerDocument cm = new CustomerDocument();
|
|
cm.customerId = result[0];
|
|
cm.fileDescription = "";
|
|
cm.documentType = documentType;
|
|
cm.fileUrl = fileName;
|
|
cm.fileType = fileType;
|
|
var res = _cd.UpdateCustomerDocument("", customerId, fileName, documentTypeName, fileType, documentType, GetStatic.GetUser());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
private string UploadDocument(HttpPostedFile doc, string customerId, string documentType, string membershipId, string registeredDate, out string fileType)
|
|
{
|
|
fileType = "";
|
|
string fName = "";
|
|
try
|
|
{
|
|
fileType = doc.ContentType;
|
|
string fileExtension = new FileInfo(doc.FileName).Extension;
|
|
string documentExtension = GetStatic.ReadWebConfig("customerDocFileExtension", "");
|
|
if (documentExtension.ToLower().Contains(fileExtension.ToLower()))
|
|
{
|
|
string fileName = customerId + "_" + documentType + "_" + DateTime.Now.Hour.ToString() + DateTime.Now.Millisecond.ToString() + "_" + registeredDate.Replace("-", "_") + fileExtension;
|
|
string path = GetStatic.GetCustomerFilePath() + "CustomerDocument\\" + registeredDate.Replace("-", "\\") + "\\" + membershipId;
|
|
if (!Directory.Exists(path))
|
|
Directory.CreateDirectory(path);
|
|
doc.SaveAs(path + "/" + fileName);
|
|
fName = fileName;
|
|
}
|
|
else
|
|
{
|
|
fName = "notValid";
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
fName = "";
|
|
}
|
|
return fName;
|
|
}
|
|
private void GetSignature()
|
|
{
|
|
var customerId = Request.Form["customerId"];
|
|
var response = GetSignatrueHtml("Staff Visit - Customer Register(Customer Signature)", customerId);
|
|
Response.ContentType = "text/plain";
|
|
var serializer = new JavaScriptSerializer();
|
|
var json = serializer.Serialize(response);
|
|
Response.Write(json);
|
|
Response.End();
|
|
}
|
|
public string GetSignatrueHtml(string fileDescription, string sessionId)
|
|
{
|
|
var membershipId = Request.Form["membershipId"];
|
|
var customerId = Request.Form["customerId"];
|
|
var registerDate = Request.Form["registerDate"];
|
|
var documentDetails = _cd.GetDocumentByCustomerIdNew(customerId, fileDescription, sessionId);
|
|
string imageUrl = "";
|
|
if (documentDetails != null)
|
|
{
|
|
foreach (DataRow item in documentDetails.Rows)
|
|
{
|
|
var fileName = item["fileName"].ToString();
|
|
imageUrl = "/Handler/CustomerSignature.ashx?registerDate=" + Convert.ToDateTime(registerDate).ToString("yyyy-MM-dd") + "&customerId=" + customerId + "&membershipNo=" + membershipId + "&fileName=" + fileName;
|
|
}
|
|
}
|
|
return imageUrl;
|
|
}
|
|
}
|
|
}
|