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.
 
 
 
 
 

272 lines
11 KiB

using Newtonsoft.Json;
using Swift.API.Common;
using Swift.API.Common.Enum;
using Swift.API.TPAPIs;
using Swift.DAL.OnlineAgent;
using Swift.web.Library;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
namespace Swift.web.MobileRemit.Admin.Reports
{
public partial class CustomerRegistrationStatus : System.Web.UI.Page
{
private string ViewFunctionId = "41501000";
private readonly RemittanceLibrary _sl = new RemittanceLibrary();
private readonly StaticDataDdl _sdd = new StaticDataDdl();
private readonly OnlineCustomerDao _cd = new OnlineCustomerDao();
protected void Page_Load(object sender, EventArgs e)
{
Authenticate();
//btnUpdate.Enabled = true;
btnReset.Enabled = true;
btnActivate.Enabled = false;
if (!IsPostBack)
{
PopulateDdl();
cusData.Visible = false;
moreData.Visible = false;
kycData.Visible = false;
registrationTypeDiv.Visible = false;
}
}
private void Authenticate()
{
_sl.CheckAuthentication(ViewFunctionId);
}
private void PopulateDdl()
{
_sdd.SetDDL(ref ddlCustomerType, "exec proc_sendPageLoadData @flag='search-cust-by-for-status'", "VALUE", "TEXT", "", "");
}
protected void clickBtnForGetCustomerDetails_Click(object sender, EventArgs e)
{
PopulateCustomerData();
}
private void PopulateCustomerData()
{
string[] customer = txtSearchData.Value.Split('|');
var customerId = customer[0];
var customerSource = customer[1];
//var membershipId = txtSearchData.Value["membershipId"].ToString();
//var source = txtSearchData.
DataSet ds = _cd.GetCustomerRegistrationStatusReport(GetStatic.GetUser(), customerId, customerSource);
if (ds != null)
{
var customerDetails = ds.Tables[0];
var details = ds.Tables[1];
if (customerDetails.Rows.Count > 0)
{
PopulateCustomerDetails(customerDetails);
}
else
{
custDetails.InnerHtml = "";
}
if (details.Rows.Count > 0)
{
PopulateDetails(details);
}
if (ds.Tables.Count > 1)
{
var kycDetails = ds.Tables[2];
if (kycDetails.Rows.Count >= 1)
{
PopulateKycDetails(kycDetails);
}
else
{
tblKycDetail.InnerHtml = "";
}
}
}
}
private void PopulateDetails(DataTable customerDetails)
{
email.Text = customerDetails.Rows[0]["email"].ToString();
idType.Text = customerDetails.Rows[0]["detailTitle"].ToString();
idNumber.Text = customerDetails.Rows[0]["idNumber"].ToString();
membershipId.Text = customerDetails.Rows[0]["membershipId"].ToString();
if (customerDetails.Rows[0]["registrationType"] != DBNull.Value)
{
rbKycType.SelectedValue = customerDetails.Rows[0]["registrationType"].ToString();
}
cusData.Visible = true;
registrationTypeDiv.Visible = true;
if ((customerDetails.Rows[0]["createdFrom"].ToString() == "C") || (customerDetails.Rows[0]["createdFrom"].ToString() == "O"))
{
if (customerDetails.Rows[0]["mobileApprovedDate"].ToString() == "")
{
btnActivate.Enabled = true;
}
}
else
{
btnActivate.Enabled = false;
}
if (customerDetails.Rows[0]["approvedBy"].ToString() != "")
{
//btnUpdate.Enabled = false;
btnReset.Enabled = false;
}
else if (customerDetails.Rows[0]["customerSource"].ToString() == "temp")
{
btnReset.Enabled = false;
}
else
{
//btnUpdate.Enabled = true;
btnReset.Enabled = true;
}
}
private void PopulateCustomerDetails(DataTable customerDetails)
{
moreData.Visible = true;
var str = new StringBuilder("");
var sn = 1;
foreach (DataRow dr in customerDetails.Rows)
{
str.Append("<tr>");
str.Append("<td style=\"width:0%;\">" + sn + "</td>");
str.Append("<td style=\"width:9%;\">" + dr["PARTICULARS"].ToString() + "</td>");
str.Append("<td style=\"width:10%;\">" + dr["COMPLETE"].ToString() + "</td>");
str.Append("<td style=\"width:8%;\">" + dr["DT"].ToString() + "</td>");
str.Append("</tr>");
sn++;
}
custDetails.InnerHtml = str.ToString();
}
private void PopulateKycDetails(DataTable kycDetails)
{
kycData.Visible = true;
var str = new StringBuilder("");
var str1 = new StringBuilder("");
var sn = 1;
var r = kycDetails.Rows[0];
str1.Append("<tr>");
str1.Append("<td><b>Plans Selected At</b></td>" + "<td>" + r["planSelectedDate"].ToString() + "</td>");
str1.Append("<td><b>Document Submitted At</b></td>" + "<td>" + r["accepteddate"].ToString() + "</td></tr>");
str1.Append("<tr><td><b>Accepted At</b></td>" + "<td>" + r["documentSubmittedDate"].ToString() + "</td>");
str1.Append("<td><b>Comparision Data At</b></td>" + "<td>" + r["ekycSubmittedDate"].ToString() + "</td>");
str1.Append("</tr>");
Tbody2.InnerHtml = str1.ToString();
foreach (DataRow dr in kycDetails.Rows)
{
str.Append("<tr>");
str.Append("<td style=\"width:1%;\">" + sn + "</td>");
str.Append("<td style=\"width:15%;\">" + dr["TrustDocId"].ToString() + "</td>");
str.Append("<td style=\"width:13%;\">" + dr["verificationType"].ToString() + "</td>");
str.Append("<td style=\"width:13%;\">" + dr["state"].ToString() + "</td>");
//str.Append("<td style=\"width:13%;\">" + dr["planSelectedDate"].ToString() + "</td>");
//str.Append("<td style=\"width:13%;\">" + dr["accepteddate"].ToString() + "</td>");
//str.Append("<td style=\"width:12%;\">" + dr["documentSubmittedDate"].ToString() + "</td>");
//str.Append("<td style=\"width:12%;\">" + dr["ekycSubmittedDate"].ToString() + "</td>");
str.Append("</tr>");
sn++;
}
tblKycDetail.InnerHtml = str.ToString();
}
//protected void update_Click(object sender, EventArgs e)
//{
// string customerId = txtSearchData.Value.Split('|')[0];
// string customerSource = txtSearchData.Value.Split('|')[1];
// string kycType = rbKycType.SelectedValue;
// var dbResult = _cd.UpdateKycType(customerId, kycType, customerSource, GetStatic.GetUser());
// GetStatic.AlertMessage(this.Page, dbResult.Msg);
//}
protected void reset_Click(object sender, EventArgs e)
{
string customerId = txtSearchData.Value.Split('|')[0];
// string customerSource = txtSearchData.Value.Split('|')[1];
var dbResult = _cd.ClearCustomerKYC(customerId, GetStatic.GetUser());
if (dbResult.ErrorCode == "1")
{
GetStatic.AlertMessage(this.Page, dbResult.Msg);
}
else
{
GetStatic.AlertMessage(this.Page, "Customer KYC has been successfully cleared.");
}
}
protected void activate_Click(object sender, EventArgs e)
{
string customerId = txtSearchData.Value.Split('|')[0];
var custompass = PasswordGenerator.GenerateRandomNumericPassword();
var membershipId = Request.Form["membershipId"];
var dbRes = _cd.ActivateMobileLogin(GetStatic.GetUser(), customerId, custompass, membershipId);
if (dbRes.ErrorCode == "0")
{
DataRow result = _cd.GetDetailsWithPinNo(customerId, GetStatic.GetUser());
//CustomerDetails cd = _cd.GetUserDetails(selecteduserId);
var email = result["userName"].ToString();
List<Mapping> bodyMappings = new List<Mapping>();
bodyMappings.Add(new Mapping() { SValue = "CustomerName", SText = result["FullName"].ToString() });
bodyMappings.Add(new Mapping() { SValue = "CustomerId", SText = customerId });
bodyMappings.Add(new Mapping() { SValue = "Address", SText = result["Address1"].ToString() });
bodyMappings.Add(new Mapping() { SValue = "EMAIL_ID", SText = email });
bodyMappings.Add(new Mapping() { SValue = "PASS_WORD", SText = result["Password"].ToString() });
bodyMappings.Add(new Mapping() { SValue = "PIN_NO", SText = result["PinNo"].ToString() });
SendNotificationRequestMobile request = new SendNotificationRequestMobile()
{
IsBulkNotification = false,
UserName = email,
ProcessId = Guid.NewGuid().ToString(),
ProviderId = NotifyTemplate.PIN_PASSWORD_EMAIL.ToString(),
NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(),
Template = NotifyTemplate.PIN_PASSWORD_EMAIL,
Recipients = new List<RecipientViewModel>()
{
new RecipientViewModel()
{
NotificationContent = new NotificationDTO() {
Body = JsonConvert.SerializeObject(bodyMappings),
//Title will be set by mapping json
},
Address= email
}
}
};
var res = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL);
txtSearchData.Text = "";
cusData.Visible = false;
registrationTypeDiv.Visible = false;
GetStatic.AlertMessage(this, dbRes.Msg);
}
else
{
GetStatic.AlertMessage(this, dbRes.Msg);
}
}
}
}