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.
413 lines
18 KiB
413 lines
18 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.Text;
|
|
using System.Web;
|
|
using System.Web.Script.Serialization;
|
|
using System.Web.UI;
|
|
using Swift.API.Common.Helper;
|
|
namespace Swift.web.MobileRemit.Admin.Operation
|
|
{
|
|
public partial class EditCustomerForActivation : 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 = "30110000";
|
|
private const string AddFunctionIdFromMobile = "30110010";
|
|
private const string SaveEditIdFromMobile = "30110020";
|
|
|
|
private const string ViewFunctionIdFromAgent = "20203000";
|
|
private const string AddFunctionIdFromAgent = "20400030";
|
|
private const string SaveEditIdFromAgent = "30110020";
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
Authenticate();
|
|
signatureDiv.Visible = true;
|
|
isDisplaySignature.Visible = true;
|
|
|
|
GetStatic.PrintMessage(Page);
|
|
|
|
addEditPanel.Attributes.Add("style", "display:" + "");
|
|
otherVerificationTypeNo.Visible = false;
|
|
// divOccupation.Visible = false;
|
|
displayCounterVisit.Visible = false;
|
|
|
|
var MethodName = Request.Form["MethodName"];
|
|
if (!IsPostBack)
|
|
{
|
|
Authenticate();
|
|
PopulateDdl();
|
|
GetCustomerDocument();
|
|
|
|
if (MethodName == "GetCustomerDetails")
|
|
{
|
|
GetCustomerDetails();
|
|
}
|
|
if (MethodName == "GetAddressDetailsByZipCode")
|
|
{
|
|
GetAddressDetailsByZipCode();
|
|
}
|
|
if (MethodName == "GetImageUrl")
|
|
{
|
|
GetImageUrl();
|
|
}
|
|
|
|
if (GetVerificationType() == "verify")
|
|
{
|
|
SaveEditedData.Text = "Verify";
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
protected string GetCustomerId()
|
|
{
|
|
return GetStatic.ReadQueryString("customerId", "");
|
|
}
|
|
protected string GetReferalId()
|
|
{
|
|
return GetStatic.ReadQueryString("code", "");
|
|
}
|
|
protected string GetRequestFrom()
|
|
{
|
|
return GetStatic.ReadQueryString("requestFrom", "");
|
|
}
|
|
protected string GetVerificationType()
|
|
{
|
|
return GetStatic.ReadQueryString("type", "");
|
|
}
|
|
private void Authenticate()
|
|
{
|
|
|
|
_sl.CheckAuthentication(GetFunctionIdByUserType(SaveEditIdFromAgent, SaveEditIdFromMobile));
|
|
|
|
|
|
string eId = GetStatic.ReadQueryString("customerId", "");
|
|
|
|
var hasRight = false;
|
|
if (eId == "")
|
|
{
|
|
hasRight = _sl.HasRight(GetFunctionIdByUserType(AddFunctionIdFromAgent, AddFunctionIdFromMobile));
|
|
}
|
|
else
|
|
{
|
|
hasRight = _sl.HasRight(GetFunctionIdByUserType(SaveEditIdFromAgent, SaveEditIdFromMobile));
|
|
}
|
|
}
|
|
|
|
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);
|
|
|
|
var json = GetStatic.DataTableToJson(dr);
|
|
|
|
GetStatic.JsonResponse(json, this);
|
|
}
|
|
private void GetCustomerDetails()
|
|
{
|
|
string eId = GetCustomerId();
|
|
var dt = _cd.GetDetailsForEditCustomer(eId, GetStatic.GetUser());
|
|
Response.ContentType = "text/plain";
|
|
var json = DataTableToJson(dt);
|
|
Response.Write(json);
|
|
Response.End();
|
|
}
|
|
|
|
private void GetCustomerDocument()
|
|
{
|
|
string eId = GetCustomerId();
|
|
var dt = _cd.GetDocumentForEditCustomerActivate(eId, GetStatic.GetUser());
|
|
|
|
if (dt != null)
|
|
{
|
|
|
|
var str = new StringBuilder("");
|
|
var sn = 1;
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
|
|
str.Append("<tr>");
|
|
str.Append("<td>" + sn + "</td>");
|
|
str.Append("<td>" + dr["documentType"].ToString() + "</td>");
|
|
str.Append("<td>" + dr["fileType"].ToString() + "</td>");
|
|
str.Append("<td>" + dr["fileName"].ToString() + "</td>");
|
|
str.Append("<td>" + dr["uploadedDate"].ToString() + "</td>");
|
|
str.Append("</tr>");
|
|
sn++;
|
|
}
|
|
docdetails.InnerHtml = str.ToString();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
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)
|
|
{
|
|
|
|
Page.Validate("ActivateVG");
|
|
if (Page.IsValid)
|
|
{
|
|
string eId = GetStatic.ReadQueryString("customerId", "");
|
|
string createdFrom = hdnCreatedFrom.Value;
|
|
string verifyType = GetStatic.ReadQueryString("type", "");
|
|
|
|
if (!_sl.HasRight(GetFunctionIdByUserType(SaveEditIdFromAgent, SaveEditIdFromMobile)))
|
|
{
|
|
GetStatic.AlertMessage(this, "You are not authorized to Edit Customer!");
|
|
return;
|
|
}
|
|
|
|
if (!email.Text.IsValidEmail())
|
|
{
|
|
GetStatic.AlertMessage(this, "Invalid Email format of customer! Unable to proceed for activation.");
|
|
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;
|
|
}
|
|
|
|
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["txtStreet"];
|
|
|
|
OnlineCustomerModel customerModel = new OnlineCustomerModel()
|
|
{
|
|
flag = "customer-register-core",
|
|
firstName = trimmedfirstName,
|
|
middleName = trimmedMiddleName,
|
|
lastName1 = trimmedlastName,
|
|
gender = genderList.SelectedValue,
|
|
customerType = "4700",
|
|
country = countryList.Text,
|
|
address = addressLine1.Text,
|
|
zipCode = zipCode.Text,
|
|
street = Request.Form["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,
|
|
ReferralId = GetReferalId()
|
|
|
|
};
|
|
|
|
if (hdnCustomerId.Value != "")
|
|
{
|
|
customerModel.customerId = hdnCustomerId.Value;
|
|
customerModel.flag = "customer-editeddata";
|
|
}
|
|
|
|
var dbResult = _cd.RegisterCustomerNewAgent(customerModel);
|
|
|
|
if (dbResult.ErrorCode == "0")
|
|
{
|
|
// saveCustomerDocument(dbResult);
|
|
var custompass = PasswordGenerator.GenerateRandomPassword();
|
|
var dbRes = _cd.ActivateMobileLogin(GetStatic.GetUser(), GetCustomerId(), custompass, Request.Form["membershipId"]);
|
|
GetStatic.AlertMessage(this, dbRes.Msg);
|
|
if (dbRes.ErrorCode == "0")
|
|
{
|
|
Response.Redirect("/MobileRemit/Admin/Operation/LetterForCustomerFromMobile.aspx?createdFrom=" + createdFrom + "&customerId=" + GetCustomerId() + "&membershipId=" + Request.Form["membershipId"] + "");
|
|
}
|
|
// Approve(sender, e, createdFrom, "approve");
|
|
}
|
|
else
|
|
GetStatic.SetMessage(dbResult.ErrorCode, dbResult.Msg);
|
|
}
|
|
// Page_Load(sender, e);
|
|
//return;
|
|
}
|
|
|
|
//protected void Approve(object sender, EventArgs e, string createdFrom, string verifyType)
|
|
//{
|
|
// // string userCreatedFrm = GetStatic.ReadQueryString("createdUserFrom", "");
|
|
// var q = GetRequestFrom();
|
|
// DataSet ds = new DataSet();
|
|
// if (GetRequestFrom() == "agent")
|
|
// {
|
|
// ds = _cd.ApprovePending(GetCustomerId(), GetStatic.GetUser(), "");
|
|
// }
|
|
// else
|
|
// {
|
|
// ds = _cd.ApprovePendingFromMobile(GetCustomerId(), GetStatic.GetUser(), createdFrom, verifyType, GetReferalId());
|
|
// }
|
|
|
|
// 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.Extra2.ToLower() == "approved")
|
|
// {
|
|
// //Response.Redirect("/AgentNew/Transaction/Letters/LetterForCustomerFromMobile.aspx?createdFrom=" + userCreatedFrm + "&customerId=" + GetCustomerId() + "&membershipId=" + ds.Tables[1].Rows[0]["account"].ToString() + "");
|
|
// Response.Redirect("/MobileRemit/Admin/Operation/LetterForCustomerFromMobile.aspx?createdFrom=" + createdFrom + "&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();
|
|
|
|
}
|
|
|
|
|
|
protected void CVotherOccupation_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
|
|
{
|
|
|
|
if (occupation.SelectedValue == "11383" && occupationText.Text == "")
|
|
{
|
|
args.IsValid = false;
|
|
}
|
|
else
|
|
args.IsValid = true;
|
|
}
|
|
protected void CVotherVerification_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
|
|
{
|
|
|
|
if (idType.SelectedValue == "11402" && otherVerificationTypeNo.Text == "")
|
|
{
|
|
args.IsValid = false;
|
|
}
|
|
else
|
|
args.IsValid = true;
|
|
}
|
|
|
|
protected void occupation_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|