|
|
using Newtonsoft.Json; using Swift.API.Common; using Swift.API.Common.Enum; using Swift.API.TPAPIs; using Swift.DAL.OnlineAgent; using Swift.DAL.SwiftDAL; using Swift.web.Component.Grid; using Swift.web.Component.Grid.gridHelper; using Swift.web.Library; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;
namespace Swift.web.Remit.Administration.CustomerRegistration { public partial class UpdateKYC : System.Web.UI.Page { private const string GridName = "grid_list"; private readonly RemittanceLibrary _sl = new RemittanceLibrary(); private readonly OnlineCustomerDao _cd = new OnlineCustomerDao(); private readonly SwiftLibrary _swiftLib = new SwiftLibrary(); private readonly SwiftGrid _grid = new SwiftGrid(); private readonly StaticDataDdl _sdd = new StaticDataDdl(); private const string ViewFunctionId = "20211000"; private const string UpdateKYCFunctionId = "20211010";
private const string ViewFunctionIdAgent = ""; private const string UpdateKYCFunctionIdAgent = "";
protected void Page_Load(object sender, EventArgs e) { Authenticate();
if (!IsPostBack) { PopulateDDL(); GetStatic.PrintMessage(Page); startDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); startDate.Attributes.Add("readonly", "readonly"); string customerId = GetStatic.ReadQueryString("customerId", ""); if (customerId != "") { HideSearchDiv(); var customerName = GetCustomerName(customerId); lblCustName.InnerText = customerName; string custInfo = (customerId == "" ? hdnCustomerId.Value : customerId) + "," + (customerName); GetStatic.CallBackJs1(Page, "customerDoc", "PopulateAutoComplete('" + custInfo + "')"); } } var custId = GetStatic.ReadQueryString("customerId", ""); if (GetCustomerId() != "" || custId != "") { PopulateCustomerData(); LoadGrid();
} else { GetStatic.CallBackJs1(Page, "hide Div", "HideNecessaryDiv()"); } DeleteRow(); }
private void PopulateCustomerData() { DataRow dr = _cd.GetCustomerData(GetStatic.GetUser(), GetCustomerId()); if (dr != null) { string Name = dr["fullname"].ToString(); string address = dr["address"].ToString(); string mobile = dr["mobile"].ToString(); customerName.Text = Name; customerAddress.Text = address; mobileNo.Text = mobile; } }
private void Authenticate() { _swiftLib.CheckAuthentication(GetFunctionIdByUserType(ViewFunctionIdAgent, ViewFunctionId)); save.Visible = _swiftLib.HasRight(GetFunctionIdByUserType(UpdateKYCFunctionIdAgent, UpdateKYCFunctionId)); save.Enabled = _swiftLib.HasRight(GetFunctionIdByUserType(UpdateKYCFunctionIdAgent, UpdateKYCFunctionId)); }
public void PopulateDDL() { var user = GetStatic.GetUser(); _sl.SetDDL(ref ddlStatus, "EXEC proc_online_dropDownList @flag='dropdownList',@parentId='7007',@user='" + user + "'", "valueId", "detailTitle", "", "Select.."); _sl.SetDDL(ref ddlMethod, "EXEC proc_online_dropDownList @flag='dropdownList',@parentId='7008',@user='" + user + "'", "valueId", "detailTitle", "", "Select.."); _sdd.SetDDL(ref ddlSearchBy, "exec proc_sendPageLoadData @flag='search-cust-by'", "VALUE", "TEXT", "", ""); }
protected void save_Click(object sender, EventArgs e) { DbResult _dbRes = new DbResult(); if (!_swiftLib.HasRight(GetFunctionIdByUserType(UpdateKYCFunctionIdAgent, UpdateKYCFunctionId))) { _dbRes.SetError("1", "You are not authorized to Update Data", null); GetStatic.AlertMessage(this, _dbRes.Msg); return; }
var selecteduserId = GetCustomerId(); var kycmethod = ddlMethod.SelectedValue; var kycstatus = ddlStatus.SelectedValue; var selecteddate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); var currentuser = GetStatic.GetUser(); var remarkstext = remarks.Text; var trackNo = trackingNo.Text; JsonResponse jsonRes = _cd.InsertCustomerKYC(currentuser, selecteduserId, kycmethod, kycstatus, selecteddate, remarkstext, trackNo); startDate.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); if (jsonRes.ResponseCode == "0") { try { CustomerDetails cd = _cd.GetUserDetails(selecteduserId);
List<Mapping> bodyMappings = new List<Mapping>();
bodyMappings.Add(new Mapping() { SValue = "CustomerName", SText = cd.FullName }); bodyMappings.Add(new Mapping() { SValue = "RefCode", SText = cd.MembershipId }); bodyMappings.Add(new Mapping() { SValue = "CustomerId", SText = cd.CustomerId.ToString() }); bodyMappings.Add(new Mapping() { SValue = "UserId", SText = cd.MembershipId }); bodyMappings.Add(new Mapping() { SValue = "FirstName", SText = cd.FirstName }); bodyMappings.Add(new Mapping() { SValue = "MiddleName", SText = cd.MiddleName }); bodyMappings.Add(new Mapping() { SValue = "LastName", SText = cd.LastName }); bodyMappings.Add(new Mapping() { SValue = "MobileNo", SText = cd.Mobile }); bodyMappings.Add(new Mapping() { SValue = "Address", SText = cd.Address }); bodyMappings.Add(new Mapping() { SValue = "EMAIL_ID", SText = cd.Email }); bodyMappings.Add(new Mapping() { SValue = "RegisteredDate", SText = cd.RegisteredDate.ToString() });
SendNotificationRequestMobile request = new SendNotificationRequestMobile() { IsBulkNotification = false, UserName = cd.Email, ProcessId = "KYC_Verification_Completed", ProviderId = NotifyTemplate.KYC_VERIFICATION_EMAIL.ToString(), NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(), Template = NotifyTemplate.KYC_VERIFICATION_EMAIL, Recipients = new List<RecipientViewModel>() { new RecipientViewModel() { NotificationContent = new NotificationDTO() { Body = JsonConvert.SerializeObject(bodyMappings), //Title will be set by mapping json
}, Address= cd.Email } } };
NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL); } catch (Exception ex) { GetStatic.LogError(ex); trackingNo.Text = ""; GetStatic.AlertMessage(this, jsonRes.Msg); string custInfo = selecteduserId + "," + GetCustomerName(selecteduserId); GetStatic.CallBackJs1(Page, "customerDoc", "PopulateAutoComplete('" + custInfo + "')"); LoadGrid(); //HttpContext.Current.Session["message"] = _dbRes;
//Response.Redirect(Request.RawUrl);
} GetStatic.AlertMessage(this, jsonRes.Msg); } else { ddlMethod.SelectedValue = ""; ddlStatus.SelectedValue = ""; HttpContext.Current.Session["message"] = jsonRes; GetStatic.AlertMessage(this, jsonRes.Msg); } }
public void LoadGrid() { _grid.FilterList = new List<GridFilter> { new GridFilter("detailTitle", "KYC Method", "1:EXEC proc_customerKYC @flag='dropdownListMethod'"), new GridFilter("detailTitle", "KYC Status", "1:EXEC proc_customerKYC @flag='dropdownListStatus'"), //new GridFilter("detailTitle", "KYC Method", "1:EXEC proc_customerKYC @flag='dropdownList'", "", "", true),
//new GridFilter("kycStatus", "kycStatus", "1:" + "EXEC [proc_customerKYC] @flag = 's'"),
////new GridFilter("fromDate", "Registered From", "d"),
//new GridFilter("toDate", "Registered To", "d"),
};
_grid.ColumnList = new List<GridColumn> { new GridColumn("kycStatus", "KYC Status", "", "T"), new GridColumn("trackingNo", "Tracking Number", "", "T"), new GridColumn("details", "Details(old Value:New Value)", "", "T"), new GridColumn("createdDate", "Modified Date", "", "D"), new GridColumn("createdBy", "Modified By", "", "T"), new GridColumn("kycMethod", "Method", "", "T"), new GridColumn("remarks", "Remarks", "", "T") };
_grid.GridType = 1; _grid.GridDataSource = SwiftGrid.GridDS.RemittanceDB; _grid.GridName = GridName; _grid.ShowPagingBar = true; _grid.AlwaysShowFilterForm = true; _grid.ShowFilterForm = false; _grid.RowIdField = "createdDate"; _grid.ThisPage = "List.aspx"; ; _grid.InputPerRow = 4; _grid.GridMinWidth = 700; _grid.GridWidth = 100; _grid.IsGridWidthInPercent = true; _grid.AddPage = "Manage.aspx"; _grid.AllowCustomLink = true; _grid.CustomLinkText = " <btn class=\"btn btn-xs btn-danger\" onclick=\"Delete('@rowId','@kycStatus')\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Delete\"> <i class=\"fa fa-trash\"></i></btn>"; _grid.CustomLinkVariables = "rowId,kycStatus"; _grid.SortOrder = "DESC"; _grid.SortBy = "createdDate";
string sql = "EXEC [proc_customerKYC] @flag = 's', @customerId =" + _sl.FilterString(GetCustomerId()); _grid.SetComma();
rpt_grid.InnerHtml = _grid.CreateGrid(sql); }
protected string GetCustomerId() { //string customerId= GetStatic.ReadQueryString("customerId", "");
string customerId = hdnCustomerId.Value; if (customerId == "") { customerId = GetStatic.ReadQueryString("customerId", ""); } return customerId; }
private void DeleteRow() { string id = _grid.GetCurrentRowId(GridName);
if (id == "") return; var user = GetStatic.GetUser(); DbResult dbResult = _cd.DeleteCustomerKYC(id, user); if (dbResult.ErrorCode == "0") { LoadGrid(); GetStatic.AlertMessage(this, dbResult.Msg); //HttpContext.Current.Session["message"] = dbResult;
//Response.Redirect(Request.RawUrl);
} else { HttpContext.Current.Session["message"] = dbResult; GetStatic.AlertMessage(this, dbResult.Msg); } string customerId = GetStatic.ReadQueryString("customerId", ""); if (customerId != "") {
GetStatic.CallBackJs1(Page, "Hide Search Div", "HideSearchDiv()"); } }
public string GetFunctionIdByUserType(string functionIdAgent, string functionIdAdmin) { return (GetStatic.GetUserType() == "HO") ? functionIdAdmin : functionIdAgent; }
public string GetCustomerName(string custName) { var res = _cd.GetCustomerData(GetStatic.GetUser(), GetCustomerId()); return res["fullName"].ToString(); } public string HideSearchDiv() { var hide = GetStatic.ReadQueryString("hideSearchDiv", "").ToString(); if (hide == "true") { displayOnlyOnEdit.Visible = false; } return null; } protected void delete_Click(object sender, EventArgs e) { var id = hdnRowId.Value; DbResult dbResult = _cd.DeleteCustomerKYC(id, GetStatic.GetUser()); if (dbResult.ErrorCode == "0") { LoadGrid(); GetStatic.AlertMessage(this, dbResult.Msg); //HttpContext.Current.Session["message"] = dbResult;
//Response.Redirect(Request.RawUrl);
} else { HttpContext.Current.Session["message"] = dbResult; GetStatic.AlertMessage(this, dbResult.Msg); } }
} }
|