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.
598 lines
29 KiB
598 lines
29 KiB
using Newtonsoft.Json;
|
|
using Swift.API.Common;
|
|
using Swift.API.Common.Enum;
|
|
using Swift.API.Common.SyncModel;
|
|
using Swift.API.ThirdPartyApiServices;
|
|
using Swift.API.TPAPIs;
|
|
using Swift.DAL.BL.System.Utility;
|
|
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.Net;
|
|
using System.Text.RegularExpressions;
|
|
using System.Web;
|
|
using System.Web.Script.Serialization;
|
|
using System.Web.Services;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace Swift.web.AgentNew.Administration.CustomerSetup.CustomerRegistration
|
|
{
|
|
public partial class Manage : Page
|
|
{
|
|
private readonly RemittanceLibrary _sl = new RemittanceLibrary();
|
|
private readonly OnlineCustomerDao _cd = new OnlineCustomerDao();
|
|
private readonly StaticDataDdl _sdd = new StaticDataDdl();
|
|
|
|
private const string AddViewFunctionId = "20203000";
|
|
private const string EditViewFunctionId = "20203000";
|
|
private const string AddFunctionId = "20203010";
|
|
private const string SignatureFunctionId = "20203030";
|
|
private const string EditFunctionId = "20203020";
|
|
private const string AddViewFunctionIdAgent = "20203000";
|
|
private const string EditViewFunctionIdAgent = "20203100";
|
|
private const string AddFunctionIdAgent = "20203010";
|
|
private const string EditFunctionIdAgent = "20203110";
|
|
private bool isEdit = Convert.ToBoolean(GetStatic.ReadQueryString("edit", "false"));
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
Authenticate();
|
|
signatureDiv.Visible = !CheckAddOrEdit() && _sl.HasRight(SignatureFunctionId);
|
|
isDisplaySignature.Value = !CheckAddOrEdit() && _sl.HasRight(SignatureFunctionId) ? "true" : "false";
|
|
GetStatic.PrintMessage(Page);
|
|
displayOnlyOnEdit.Visible = CheckAddOrEdit();
|
|
addEditPanel.Attributes.Add("style", "display:" + (CheckAddOrEdit() ? "none" : ""));
|
|
//displayCounterVisit.Visible = !CheckAddOrEdit();
|
|
if (GetStatic.ReadQueryString("hdnId", "").ToString() != "")
|
|
{
|
|
ShowPrintLink(GetStatic.ReadQueryString("hdnId", "").ToString());
|
|
}
|
|
else
|
|
{
|
|
linkDiv.Visible = false;
|
|
}
|
|
var MethodName = Request.Form["MethodName"];
|
|
if (!IsPostBack)
|
|
{
|
|
PopulateDdl();
|
|
//if (MethodName == "GetAddressDetailsByZipCode")
|
|
//{
|
|
// GetAddressDetailsByZipCode();
|
|
//}
|
|
if (MethodName == "GetCustomerDetails")
|
|
{
|
|
GetCustomerDetails();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void Authenticate()
|
|
{
|
|
if (CheckAddOrEdit())
|
|
_sl.CheckAuthentication(GetFunctionIdByUserType(EditViewFunctionIdAgent, EditViewFunctionId));
|
|
else
|
|
_sl.CheckAuthentication(GetFunctionIdByUserType(AddViewFunctionIdAgent, AddViewFunctionId));
|
|
|
|
string eId = GetStatic.ReadQueryString("customerId", "");
|
|
|
|
var hasRight = false;
|
|
if (eId == "")
|
|
{
|
|
hasRight = _sl.HasRight(GetFunctionIdByUserType(AddFunctionIdAgent, AddFunctionId));
|
|
register.Enabled = hasRight;
|
|
register.Visible = hasRight;
|
|
}
|
|
else
|
|
{
|
|
hasRight = _sl.HasRight(GetFunctionIdByUserType(EditFunctionIdAgent, EditFunctionId));
|
|
register.Enabled = hasRight;
|
|
register.Visible = hasRight;
|
|
}
|
|
}
|
|
|
|
private bool CheckAddOrEdit()
|
|
{
|
|
if (isEdit)
|
|
{
|
|
customerType.Attributes.Add("hidden", "hidden");
|
|
}
|
|
else
|
|
{
|
|
customerType.Attributes.Remove("hidden");
|
|
}
|
|
return isEdit;
|
|
}
|
|
|
|
private void PopulateForm(string eId)
|
|
{
|
|
var dr = _cd.GetCustomerDetails(eId, GetStatic.GetUser());
|
|
if (null != dr)
|
|
{
|
|
hdnCustomerId.Value = dr["customerId"].ToString();
|
|
firstName.Text = dr["firstName"].ToString();
|
|
middleName.Text = dr["middleName"].ToString();
|
|
lastName.Text = dr["lastName1"].ToString();
|
|
txtCompanyName.Text = dr["firstName"].ToString();
|
|
genderList.SelectedValue = dr["gender"].ToString();
|
|
countryList.SelectedValue = dr["country"].ToString();
|
|
addressLine1.Text = dr["address"].ToString();
|
|
zipCode.Text = dr["zipCode"].ToString();
|
|
city.Text = dr["city"].ToString();
|
|
email.Text = dr["email"].ToString();
|
|
hddOldEmailValue.Value = dr["email"].ToString();
|
|
emailConfirm.Text = dr["email"].ToString();
|
|
phoneNumber.Text = dr["telNo"].ToString();
|
|
mobile.Text = dr["mobile"].ToString();
|
|
nativeCountry.SelectedItem.Text = dr["nativeCountry"].ToString();
|
|
nativeCountry.SelectedItem.Value = dr["nativeCountryId"].ToString();
|
|
dob.Text = dr["dob"].ToString();
|
|
occupation.Text = dr["occupation"].ToString();
|
|
IssueDate.Text = dr["idIssueDate"].ToString();
|
|
ExpireDate.Text = dr["idExpiryDate"].ToString();
|
|
idType.SelectedValue = dr["idType"].ToString();
|
|
verificationTypeNo.Text = dr["idNumber"].ToString();
|
|
hddIdNumber.Value = dr["homePhone"].ToString();
|
|
txtMembershipId.Text = dr["membershipId"].ToString();
|
|
hdnMembershipNo.Value = dr["membershipId"].ToString();
|
|
txtMembershipId.Attributes.Add("readonly", "readonly");
|
|
txtRegistrationNo.Text = dr["registerationNo"].ToString();
|
|
txtDateOfIncorporation.Text = dr["dateofIncorporation"].ToString();
|
|
txtNameofAuthoPerson.Text = dr["nameOfAuthorizedPerson"].ToString();
|
|
//txtStreet.Text = dr["street"].ToString();
|
|
txtAdditionalAddress.Text = dr["additionalAddress"].ToString();
|
|
txtsenderCityjapan.Text = dr["cityUnicode"].ToString();
|
|
//txtstreetJapanese.Text = dr["streetUnicode"].ToString();
|
|
txtNameofEmployeer.Text = dr["nameOfEmployeer"].ToString();
|
|
rbRemitanceAllowed.SelectedValue = (dr["remittanceAllowed"].ToString().ToLower() == "true" ? "Enabled" : "Disabled");
|
|
rbOnlineLogin.SelectedValue = (dr["onlineUser"].ToString() == "Y" ? "Enabled" : "Disabled");
|
|
rbMobileLogin.SelectedValue = (dr["mobileUser"].ToString() == "Y" ? "Enabled" : "Disabled");
|
|
txtRemarks.Text = dr["remarks"].ToString();
|
|
txtSSnNo.Text = dr["SSNNO"].ToString();
|
|
//ddlSalary.Text = dr["monthlyIncome"].ToString();
|
|
if (!string.IsNullOrEmpty(dr["customerType"].ToString()) && !string.IsNullOrWhiteSpace(dr["customerType"].ToString()))
|
|
{
|
|
ddlCustomerType.SelectedValue = dr["customerType"].ToString();
|
|
}
|
|
if (!string.IsNullOrEmpty(dr["employeeBusinessType"].ToString()) && !string.IsNullOrWhiteSpace(dr["employeeBusinessType"].ToString()))
|
|
{
|
|
ddlEmployeeBusType.SelectedValue = dr["employeeBusinessType"].ToString();
|
|
}
|
|
if (!string.IsNullOrEmpty(dr["natureOfCompany"].ToString()) && !string.IsNullOrWhiteSpace(dr["natureOfCompany"].ToString()))
|
|
{
|
|
ddlnatureOfCompany.SelectedValue = dr["natureOfCompany"].ToString();
|
|
}
|
|
if (!string.IsNullOrEmpty(dr["organizationType"].ToString()) && !string.IsNullOrWhiteSpace(dr["organizationType"].ToString()))
|
|
{
|
|
ddlOrganizationType.SelectedValue = dr["organizationType"].ToString();
|
|
}
|
|
ddlPosition.SelectedValue = dr["position"].ToString();
|
|
//ddlVisaStatus.SelectedValue = dr["visaStatus"].ToString();
|
|
ddSourceOfFound.SelectedValue = dr["sourceOfFund"].ToString();
|
|
setStateDll(countryList.SelectedValue, zipCode.Text, dr["state"].ToString());
|
|
email.Enabled = (dr["isTxnMade"].ToString() == "Y") ? false : true;
|
|
emailConfirm.Enabled = (dr["isTxnMade"].ToString() == "Y") ? false : true;
|
|
hddTxnsMade.Value = dr["isTxnMade"].ToString();
|
|
if (dr["isTxnMade"].ToString() == "Y")
|
|
{
|
|
msgDiv.Visible = true;
|
|
msgLabel.Text = "Note: The customer has already made transactions in JME system, so the email can not be modified. For more info please contact HO.";
|
|
}
|
|
|
|
if (dr["idType"].ToString() == "8008")
|
|
{
|
|
expiryDiv.Attributes.Add("class", "col-md-4 col-sm-4 hidden");
|
|
}
|
|
else
|
|
{
|
|
expiryDiv.Attributes.Remove("class");
|
|
expiryDiv.Attributes.Add("class", "col-md-4 col-sm-4");
|
|
}
|
|
membershipDiv.Visible = true;
|
|
}
|
|
}
|
|
|
|
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 ddSourceOfFound, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=3900", "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");
|
|
}
|
|
|
|
[WebMethod]
|
|
public static string GetAddressByPostCode(string zipCode)
|
|
{
|
|
var postCode = zipCode.ToUpper();
|
|
string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":" + postCode;
|
|
string methodType = Utility.ReadWebConfig("methodType", "");
|
|
string countryName = "United Kingdom";
|
|
|
|
AddressRequest requestObj = new AddressRequest()
|
|
{
|
|
CountryIsoCode = countryName,
|
|
ProviderId = ProcessId,
|
|
MethodType = methodType,
|
|
TownName = postCode,
|
|
};
|
|
|
|
SyncStateCityTownService serviceObj = new SyncStateCityTownService();
|
|
var response = serviceObj.GetAddressList(requestObj);
|
|
string jsonResponse = JsonConvert.SerializeObject(response);
|
|
return jsonResponse;
|
|
|
|
}
|
|
|
|
protected void register_Click(object sender, EventArgs e)
|
|
{
|
|
string eId = GetStatic.ReadQueryString("customerId", "");
|
|
|
|
if (eId == "")
|
|
{
|
|
if (!_sl.HasRight(GetFunctionIdByUserType(AddFunctionIdAgent, AddFunctionId)))
|
|
{
|
|
GetStatic.AlertMessage(this, "You are not authorized to Add Customer!");
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!_sl.HasRight(GetFunctionIdByUserType(EditFunctionIdAgent, EditFunctionId)))
|
|
{
|
|
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(SignatureFunctionId) && !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 occupationVal = occupationHidden.Value;
|
|
//string street = Request.Form["ctl00$ContentPlaceHolder1$txtStreet"];
|
|
string address1 = Request["ctl00$ContentPlaceHolder1$address1"].ToString();
|
|
string city = Request["ctl00$ContentPlaceHolder1$city"].ToString();
|
|
string additionalAddress = Request["ctl00$ContentPlaceHolder1$txtAdditionalAddress"].ToString();
|
|
|
|
OnlineCustomerModel customerModel = new OnlineCustomerModel()
|
|
{
|
|
flag = "customer-register-core",
|
|
firstName = trimmedfirstName,
|
|
middleName = trimmedMiddleName,
|
|
lastName1 = trimmedlastName,
|
|
gender = genderList.SelectedValue,
|
|
customerType = ddlCustomerType.SelectedValue,
|
|
country = countryList.Text,
|
|
address = address1,
|
|
zipCode = zipCode.Text,
|
|
//streetJapanese = hf_editable_townArea.Value,
|
|
//street = Request.Form["ctl00$ContentPlaceHolder1$txtStreet"],
|
|
AdditionalAddress = additionalAddress,
|
|
city = city,
|
|
state = ddlStateHidden.Value,
|
|
senderCityjapan = txtsenderCityjapan.Text,
|
|
email = email.Text,
|
|
homePhone = phoneNumber.Text,
|
|
mobile = mobile.Text,
|
|
//visaStatus = ddlVisaStatus.SelectedValue,
|
|
employeeBusinessType = ddlEmployeeBusType.SelectedValue,
|
|
nativeCountry = nativeCountry.SelectedValue,
|
|
dob = dob.Text,
|
|
ssnNo = txtSSnNo.Text,
|
|
sourceOfFound = ddSourceOfFound.SelectedValue,
|
|
occupation = occupationVal,
|
|
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.ToUpper(),
|
|
IsCounterVisited = customerCounterVisit.Checked ? "Y" : "N",
|
|
customerPassword = customerPassword.Text,
|
|
agentId = GetStatic.GetAgent().ToInt(),
|
|
DocumentType = ddlDocType.SelectedValue,
|
|
occupationOther = occupationText.Text,
|
|
ReferralId = referralText.Value,
|
|
otherIdNumber = otherVerificationTypeNo.Text,
|
|
serviceUsedFor = Request.Form["chkSkip"]
|
|
};
|
|
|
|
if (hdnCustomerId.Value != "")
|
|
{
|
|
customerModel.customerId = hdnCustomerId.Value;
|
|
customerModel.flag = "customer-editeddata";
|
|
}
|
|
else
|
|
{
|
|
var custom = PasswordGenerator.GenerateRandomPassword();
|
|
customerModel.password = custom;
|
|
}
|
|
|
|
var dbResult = _cd.RegisterCustomerNew(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");
|
|
}
|
|
}
|
|
GetStatic.SetMessage(dbResult.ErrorCode, dbResult.Msg);
|
|
if (dbResult.ErrorCode == "0")
|
|
{
|
|
saveCustomerDocument(dbResult);
|
|
var customerDetails = _cd.GetRequiredCustomerDetails(dbResult.Id, GetStatic.GetUser());
|
|
string membershipId = Convert.ToString(customerDetails["membershipId"]);
|
|
string registrationDate = Convert.ToString(customerDetails["createdDate"]);
|
|
string totalPts = Convert.ToString(customerDetails["totalPoints"]);
|
|
string regPts = Convert.ToString(customerDetails["regPoints"]);
|
|
string tranPts = Convert.ToString(customerDetails["tranPoints"]);
|
|
List<Mapping> bodyMappings = new List<Mapping>();
|
|
bodyMappings.Add(new Mapping() { SValue = "CustomerName", SText = customerModel.firstName });
|
|
bodyMappings.Add(new Mapping() { SValue = "CustomerId", SText = dbResult.Id });
|
|
bodyMappings.Add(new Mapping() { SValue = "UserId", SText = membershipId });
|
|
bodyMappings.Add(new Mapping() { SValue = "FirstName", SText = customerModel.firstName });
|
|
bodyMappings.Add(new Mapping() { SValue = "MiddleName", SText = customerModel.middleName });
|
|
bodyMappings.Add(new Mapping() { SValue = "LastName", SText = customerModel.lastName1 });
|
|
bodyMappings.Add(new Mapping() { SValue = "MobileNo", SText = customerModel.mobile });
|
|
bodyMappings.Add(new Mapping() { SValue = "Address", SText = customerModel.address });
|
|
bodyMappings.Add(new Mapping() { SValue = "EMAIL_ID", SText = customerModel.email });
|
|
bodyMappings.Add(new Mapping() { SValue = "RegisteredDate", SText = registrationDate });
|
|
bodyMappings.Add(new Mapping() { SValue = "rewardPoint", SText = totalPts });
|
|
bodyMappings.Add(new Mapping() { SValue = "RegReward", SText = regPts });
|
|
bodyMappings.Add(new Mapping() { SValue = "TranReward", SText = tranPts });
|
|
//bodyMappings.Add(new Mapping() { SValue = "Password", SText = customerModel.password });
|
|
|
|
SendNotificationRequestMobile request = new SendNotificationRequestMobile()
|
|
{
|
|
IsBulkNotification = false,
|
|
UserName = customerModel.email,
|
|
ProviderId = Guid.NewGuid().ToString(),
|
|
NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(),
|
|
Template = NotifyTemplate.BASIC_REGISTRATION_EMAIL,
|
|
Recipients = new List<RecipientViewModel>()
|
|
{
|
|
new RecipientViewModel()
|
|
{
|
|
NotificationContent = new NotificationDTO() {
|
|
Body = JsonConvert.SerializeObject(bodyMappings),
|
|
//Title will be set by mapping json
|
|
},
|
|
Address= customerModel.email
|
|
}
|
|
}
|
|
};
|
|
JsonResponse jsonRes = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL);
|
|
|
|
string memberId = "";
|
|
if (dbResult.Msg.Split(':').Length > 1)
|
|
{
|
|
memberId = dbResult.Msg.Split(':')[1].Trim();
|
|
}
|
|
|
|
hdnCustomerId.Value = null;
|
|
if (CheckAddOrEdit())
|
|
{
|
|
Response.Redirect("Manage.aspx?edit=true&hdnId=" + memberId + "");
|
|
}
|
|
else
|
|
{
|
|
Response.Redirect("Manage.aspx?hdnId=" + memberId + "");
|
|
}
|
|
}
|
|
Page_Load(sender, e);
|
|
return;
|
|
}
|
|
|
|
private void saveCustomerDocument(DbResult dbresult)
|
|
{
|
|
var result = dbresult.Extra.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 = "ID_Front";
|
|
documentType = "11394";//11386
|
|
}
|
|
else if (i == 1)
|
|
{
|
|
documentTypeName = "ID_Back";
|
|
documentType = "11395";//"11387";
|
|
}
|
|
else if (i == 2)
|
|
{
|
|
documentTypeName = "Additional_ID_Front";
|
|
documentType = "11396";// "11389";
|
|
}
|
|
else if (i == 3)
|
|
{
|
|
documentTypeName = "Additional_ID_Back";
|
|
documentType = "11397";// "11395";
|
|
}
|
|
else if (i == 4)
|
|
{
|
|
documentTypeName = "Other_Document";
|
|
documentType = "11398";// "11390";
|
|
}
|
|
else
|
|
{
|
|
documentTypeName = "Registration_Form";
|
|
documentType = "11399";// "11393";
|
|
}
|
|
string fileName = (!string.IsNullOrWhiteSpace(file.FileName) ? GetStatic.UploadDocument(file, customerId, documentTypeName, membershipId, registerDate, out fileType) : GetStatic.UploadDocument(file, customerId, documentType, membershipId, registerDate, out fileType));
|
|
CustomerDocument cm = new CustomerDocument();
|
|
|
|
if (!string.IsNullOrEmpty(fileName) && fileName.ToLower() != "notvalid")
|
|
_cd.UpdateCustomerDocument("", customerId, fileName, documentTypeName, fileType, documentType, GetStatic.GetUser());
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ShowPrintLink(string membershipId)
|
|
{
|
|
linkDiv.Visible = true;
|
|
printLink.Attributes["href"] = "PrintDetails.aspx?membershipId=" + membershipId;
|
|
printLink.InnerText = "Print Details of " + membershipId + "";
|
|
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
public class CustomerAddress
|
|
{
|
|
public string errrorCode { get; set; }
|
|
public string msg { get; set; }
|
|
public string State { get; set; }
|
|
public string City { get; set; }
|
|
public string Street { get; set; }
|
|
}
|
|
|
|
private void GetAddressDetailsByZipCode()
|
|
{
|
|
string zipCode = Request.Form["zipCode"];
|
|
string rowID = Request.Form["RowID"];
|
|
string customerId = Request.Form["customerId"];
|
|
string action = Request.Form["action"];
|
|
var dr = _cd.GetAddressByZipCodeNew(zipCode, GetStatic.GetUser(), rowID, customerId, action);
|
|
|
|
var json = GetStatic.DataTableToJson(dr);
|
|
|
|
GetStatic.JsonResponse(json, this);
|
|
}
|
|
|
|
private void GetCustomerDetails()
|
|
{
|
|
string eId = Request.Form["Id"];
|
|
var dt = _cd.GetDetailsForEditCustomer(eId, GetStatic.GetUser());
|
|
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 setStateDll(string countryId, string zipCode, string stateId)
|
|
{
|
|
if (countryId != "")
|
|
{
|
|
_sl.SetDDL(ref ddlState, "EXEC proc_online_dropDownList @flag='state',@countryId='" + countryList.SelectedValue + "'", "stateId", "stateName", stateId, "Select..");
|
|
}
|
|
}
|
|
|
|
public string GetFunctionIdByUserType(string functionIdAgent, string functionIdAdmin)
|
|
{
|
|
return (GetStatic.GetUserType() == "HO") ? functionIdAdmin : functionIdAgent;
|
|
}
|
|
|
|
protected void clickBtnForGetCustomerDetails_Click(object sender, EventArgs e)
|
|
{
|
|
string eId = hdnCustomerId.Value;
|
|
if (eId != "")
|
|
{
|
|
PopulateForm(eId);
|
|
}
|
|
}
|
|
}
|
|
}
|