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.
 
 
 
 
 

193 lines
8.7 KiB

using Swift.DAL.OnlineAgent;
using Swift.web.Library;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Swift.web.Remit.Administration.CustomerSetup
{
public partial class ManageNew : 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 AddViewFunctionId = "20111300";
protected void Page_Load(object sender, EventArgs e)
{
Authenticate();
//displayCounterVisit.Visible = !CheckAddOrEdit();
var MethodName = Request.Form["MethodName"];
if (!IsPostBack)
{
//if (GetStatic.ReadQueryString("customerId", "") != "" || GetStatic.ReadQueryString("edit", "") == "true")
// divUploadImage.Visible = false;
//else
// divUploadImage.Visible = true;
if (MethodName == "GetCustomerDetails")
{
GetCustomerDetails();
}
if (MethodName == "GetAddressDetailsByZipCode")
{
GetAddressDetailsByZipCode();
}
PopulateDdl();
}
}
private void GetAddressDetailsByZipCode()
{
string customerId = Request.Form["customerId"];
string zipCode = Request.Form["zipCode"];
string rowID = Request.Form["RowID"];
var dr = _cd.GetAddressByZipCodeNew(zipCode, GetStatic.GetUser(), rowID, customerId);
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 Authenticate()
{
_sl.CheckAuthentication(AddViewFunctionId);
}
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 ddlOrganizationType, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=7002", "valueId", "detailTitle", "", "");
_sl.SetDDL(ref ddlnatureOfCompany, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=7003", "valueId", "detailTitle", "", "");
_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..");
}
protected void register_Click(object sender, EventArgs e)
{
string eId = GetStatic.ReadQueryString("customerId", "");
//if (email.Text.Equals(emailConfirm.Text))
//{
OnlineCustomerModel customerModel = new OnlineCustomerModel()
{
flag = "customer-register-core"
,
firstName = firstName.Text
,
middleName = middleName.Text
,
lastName1 = lastName.Text
,
gender = genderList.SelectedValue,
AdditionalAddress = txtAdditionalAddress.Text,
country = countryList.Text
,
address = addressLine1.Text
,
zipCode = zipCode.Text
,
street = hf_editable_townArea.Value,
city = city.Text,
//state = ddlState.SelectedValue,
state = ddlState.Text,
senderCityjapan = txtsenderCityjapan.Text,
email = email.Text
,
streetJapanese = Request.Form["txtStreet"],
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 = 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(),
remitanceAllowed = (rbRemitanceAllowed.SelectedValue == "Enabled" ? true : false),
onlineUser = (rbOnlineLogin.SelectedValue == "Enabled" ? true : false),
mobileUser = (rbOnlineLogin.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 = "",
MonthlyIncome = ddlSalary.Text.ToUpper(),
otherIdNumber = otherVerificationTypeNo.Text
};
if (hdnCustomerId.Value != "")
{
customerModel.customerId = hdnCustomerId.Value;
customerModel.flag = "customer-update-approve";
}
var dbResult = _cd.RegisterCustomerNew(customerModel);
GetStatic.CallJSFunction(this, "AfterSave('"+ dbResult.Msg + "')");
}
}
}