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.

614 lines
29 KiB

  1. using Newtonsoft.Json;
  2. using Swift.DAL.BL.AgentPanel.Send;
  3. using Swift.DAL.OnlineAgent;
  4. using Swift.DAL.Remittance.Administration.ReceiverInformation;
  5. using Swift.DAL.SwiftDAL;
  6. using Swift.web.Library;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Data;
  10. using System.Linq;
  11. using System.Reflection;
  12. using System.Web;
  13. using System.Web.Script.Serialization;
  14. using System.Web.UI;
  15. using System.Web.UI.WebControls;
  16. namespace Swift.web.Remit.Administration.CustomerRegistration.Beneficiary
  17. {
  18. public partial class Manage : System.Web.UI.Page
  19. {
  20. private readonly RemittanceLibrary _sl = new RemittanceLibrary();
  21. private readonly OnlineCustomerDao _cd = new OnlineCustomerDao();
  22. private readonly ReceiverInformationDAO _receiver = new ReceiverInformationDAO();
  23. private SendTranIRHDao st = new SendTranIRHDao();
  24. private const string ViewFunctionId = "20207000";
  25. private const string ViewBenificiaryFunctionId = "20207030";
  26. private const string AddBenificiaryFunctionId = "20207010";
  27. private const string EditBenificiaryFunctionId = "20207020";
  28. private const string sendPageFunctionId = "20206030";
  29. private const string ViewFunctionIdAgent = "";
  30. private const string ViewBenificiaryFunctionIdAgent = "";
  31. private const string AddBenificiaryFunctionIdAgent = "";
  32. private const string EditBenificiaryFunctionIdAgent = "";
  33. protected void Page_Load(object sender, EventArgs e)
  34. {
  35. Authenticate();
  36. if (GetReceiverAddType().ToLower() == "s")
  37. {
  38. receiverList.Visible = false;
  39. }
  40. hideSearchDiv();
  41. receiverAccountNo.Attributes.Add("hidden", "hidden");
  42. if (!IsPostBack)
  43. {
  44. string reqMethod = Request.Form["MethodName"];
  45. switch (reqMethod)
  46. {
  47. case "PaymentModePcountry":
  48. LoadPaymentModeFromAjax();
  49. break;
  50. case "PopulatePaymentMode":
  51. LoadPaymentModeDDL();
  52. //PopulatePaymentModeAndPayoutPartner();
  53. break;
  54. case "PopulatePayoutPartner":
  55. LoadPayoutPartner();
  56. break;
  57. case "SaveReceiverDetails":
  58. SaveReceiverDetails();
  59. break;
  60. case "GetBankBranch":
  61. GetBankBranch();
  62. break;
  63. }
  64. var a = otherRelationshipTextBox.Text;
  65. if (a == "")
  66. {
  67. otherRelationDiv.Attributes.Add("style", "display:none");
  68. }
  69. string customerId = GetStatic.ReadQueryString("customerId", "");
  70. var result = _cd.GetCustomerDetails(customerId, GetStatic.GetUser());
  71. if (result != null)
  72. {
  73. hideCustomerId.Value = customerId;
  74. hideMembershipId.Value = result["membershipId"].ToString();
  75. txtCustomerName.InnerText = result["firstName"].ToString() + ' ' + result["middleName"].ToString() + ' ' + result["lastName1"].ToString();
  76. }
  77. string receiverId = GetStatic.ReadQueryString("receiverId", "");
  78. PopulateDDL();
  79. if (receiverId != "")
  80. {
  81. PopulateForm(receiverId);
  82. }
  83. }
  84. }
  85. private void hideSearchDiv()
  86. {
  87. var hide = GetStatic.ReadQueryString("hideSearchDiv", "").ToString();
  88. if (hide == "true")
  89. {
  90. hideSearchDivVal.Value = "true";
  91. }
  92. }
  93. private void SaveReceiverDetails()
  94. {
  95. string receiverId = GetStatic.ReadQueryString("receiverId", "");
  96. if (GetReceiverAddType().ToLower() != "s")
  97. {
  98. if (receiverId == "")
  99. {
  100. if (!_sl.HasRight(GetFunctionIdByUserType(AddBenificiaryFunctionIdAgent, AddBenificiaryFunctionId)))
  101. {
  102. DbResult Result = new DbResult()
  103. {
  104. ErrorCode = "1",
  105. Msg = "You are not authorized to Edit Receiver!"
  106. };
  107. //GetStatic.AlertMessage(this, "You are not authorized to Add Receiver!");
  108. //return;
  109. var jsonString1 = JsonConvert.SerializeObject(Result);
  110. Response.ContentType = "application/json";
  111. Response.Write(jsonString1);
  112. Response.End();
  113. }
  114. }
  115. else
  116. {
  117. if (!_sl.HasRight(GetFunctionIdByUserType(EditBenificiaryFunctionIdAgent, EditBenificiaryFunctionId)))
  118. {
  119. DbResult Result = new DbResult()
  120. {
  121. ErrorCode = "1",
  122. Msg = "You are not authorized to Edit Receiver!"
  123. };
  124. //GetStatic.AlertMessage(this, "You are not authorized to Add Receiver!");
  125. //return;
  126. var jsonString2 = JsonConvert.SerializeObject(Result);
  127. Response.ContentType = "application/json";
  128. Response.Write(jsonString2);
  129. Response.End();
  130. //GetStatic.AlertMessage(this, "You are not authorized to Edit Receiver!");
  131. //return;
  132. }
  133. }
  134. }
  135. var PaymentModeValue = Request.Form["paymentMode"].ToString();
  136. var trimmedReceiverFName = Request.Form["ReceiverFName"].ToString().ToUpper().Trim() == "" ? null : Request.Form["ReceiverFName"].ToString().ToUpper().Trim();
  137. var trimmedReceiverMName = Request.Form["ReceiverMName"].ToString().ToUpper().Trim() == "" ? null : Request.Form["ReceiverMName"].ToString().ToUpper().Trim();
  138. var trimmedReceiverLName = Request.Form["ReceiverLName"].ToString().ToUpper().Trim() == "" ? null : Request.Form["ReceiverLName"].ToString().ToUpper().Trim();
  139. BenificiarData benificiar = new BenificiarData();
  140. string Country = Request.Form["Country"].ToString();
  141. benificiar.Country = Country.Split('(')[0];
  142. benificiar.NativeCountry = Request.Form["nativeCountry"].ToString();
  143. benificiar.BenificiaryType = Request.Form["BenificiaryType"].ToString();
  144. benificiar.Email = Request.Form["Email"].ToString().ToUpper();
  145. benificiar.ReceiverFName = trimmedReceiverFName;
  146. benificiar.ReceiverMName = trimmedReceiverMName;
  147. benificiar.ReceiverLName = trimmedReceiverLName;
  148. benificiar.ReceiverAddress = Request.Form["ReceiverAddress"].ToString().ToUpper();
  149. benificiar.ReceiverCity = Request.Form["ReceiverCity"].ToString().ToUpper();
  150. benificiar.ContactNo = Request.Form["ContactNo"].ToString();
  151. benificiar.SenderMobileNo = Request.Form["SenderMobileNo"].ToString();
  152. benificiar.Relationship = Request.Form["Relationship"].ToString();
  153. benificiar.RelationshipOther = Request.Form["RelationshipOther"].ToString();
  154. benificiar.PlaceOfIssue = Request.Form["PlaceOfIssue"].ToString().ToUpper();
  155. benificiar.TypeId = Request.Form["TypeId"].ToString();
  156. benificiar.TypeValue = Request.Form["TypeValue"].ToString();
  157. benificiar.PurposeOfRemitance = Request.Form["PurposeOfRemitance"].ToString();
  158. benificiar.PurposeOfRemitanceOther = Request.Form["PurposeOfRemitanceOther"].ToString();
  159. benificiar.PaymentMode = Request.Form["PaymentMode"].ToString();
  160. benificiar.PayoutPatner = Request.Form["PayoutPatner"].ToString();
  161. benificiar.BankLocation = Request.Form["BankLocation"].ToString().ToUpper();
  162. benificiar.BankName = Request.Form["BankName"].ToString().ToUpper();
  163. benificiar.BenificaryAc = Request.Form["BenificaryAc"].ToString();
  164. benificiar.Remarks = Request.Form["Remarks"].ToString().ToUpper();
  165. benificiar.membershipId = Request.Form["membershipId"].ToString();
  166. benificiar.ReceiverId = Request.Form["ReceiverId"].ToString();
  167. benificiar.customerId = (Request.Form["hideCustomerId"].ToString() != "" ? Request.Form["hideCustomerId"].ToString() : null);
  168. benificiar.Flag = (Request.Form["hideBenificialId"].ToString() != "" ? "u" : "i");
  169. benificiar.GoodsType = Request.Form["goodsType"].ToString();
  170. benificiar.GoodsOrigin = Request.Form["goodsOrigin"].ToString();
  171. benificiar.PortOfShipment = Request.Form["portOfShipment"].ToString();
  172. benificiar.isFromMobile = (Request.Form["isFromPhone"].ToString() == "undefined" ? "false" : "true");
  173. var dbResult = _cd.UpdateBenificiarInformation(benificiar, GetStatic.GetUser());
  174. if (dbResult.ErrorCode == "0")
  175. {
  176. SaveBeneficiaryDocument(dbResult);
  177. if (GetReceiverAddType().ToLower() != "s")
  178. {
  179. GetStatic.SetMessage(dbResult);
  180. }
  181. }
  182. var jsonString = JsonConvert.SerializeObject(dbResult);
  183. Response.ContentType = "application/json";
  184. Response.Write(jsonString);
  185. Response.End();
  186. }
  187. private void LoadPaymentModeDDL()
  188. {
  189. var country = Request.Form["country"];
  190. var sql = "EXEC proc_online_sendPageLoadData @flag='payoutMethods'";
  191. sql += ",@country=" + _cd.FilterString(country.Split('(')[0]);
  192. var paymentList = _cd.ExecuteDataTable(sql);
  193. var paymentDdl = Mapper.DataTableToClass<DropDownModel>(paymentList);
  194. var jsonString = JsonConvert.SerializeObject(paymentDdl);
  195. Response.ContentType = "application/json";
  196. Response.Write(jsonString);
  197. Response.End();
  198. }
  199. public static class Mapper
  200. {
  201. public static IList<T> DataTableToClass<T>(DataTable Table) where T : class, new()
  202. {
  203. var dataList = new List<T>(Table.Rows.Count);
  204. Type classType = typeof(T);
  205. IList<PropertyInfo> propertyList = classType.GetProperties();
  206. if (propertyList.Count == 0)
  207. return new List<T>();
  208. List<string> columnNames = Table.Columns.Cast<DataColumn>().Select(column => column.ColumnName).ToList();
  209. try
  210. {
  211. foreach (DataRow dataRow in Table.AsEnumerable().ToList())
  212. {
  213. var classObject = new T();
  214. foreach (PropertyInfo property in propertyList)
  215. {
  216. if (property != null && property.CanWrite)
  217. {
  218. if (columnNames.Contains(property.Name))
  219. {
  220. if (dataRow[property.Name] != System.DBNull.Value)
  221. {
  222. object propertyValue = System.Convert.ChangeType(
  223. dataRow[property.Name],
  224. property.PropertyType
  225. );
  226. property.SetValue(classObject, propertyValue, null);
  227. }
  228. }
  229. }
  230. }
  231. dataList.Add(classObject);
  232. }
  233. return dataList;
  234. }
  235. catch
  236. {
  237. return new List<T>();
  238. }
  239. }
  240. }
  241. private void Authenticate()
  242. {
  243. if (GetReceiverAddType().ToLower() == "s")
  244. {
  245. _sl.CheckAuthentication(sendPageFunctionId);
  246. }
  247. else
  248. {
  249. _sl.CheckAuthentication(GetFunctionIdByUserType(ViewFunctionIdAgent, ViewFunctionId) + "," + GetFunctionIdByUserType(ViewBenificiaryFunctionIdAgent, ViewBenificiaryFunctionId));
  250. }
  251. string receiverId = GetStatic.ReadQueryString("receiverId", "");
  252. if (receiverId == "")
  253. {
  254. register.Enabled = _sl.HasRight(GetFunctionIdByUserType(AddBenificiaryFunctionIdAgent, AddBenificiaryFunctionId));
  255. register.Visible = _sl.HasRight(GetFunctionIdByUserType(AddBenificiaryFunctionIdAgent, AddBenificiaryFunctionId));
  256. }
  257. else
  258. {
  259. register.Enabled = _sl.HasRight(GetFunctionIdByUserType(EditBenificiaryFunctionIdAgent, EditBenificiaryFunctionId));
  260. register.Visible = _sl.HasRight(GetFunctionIdByUserType(EditBenificiaryFunctionIdAgent, EditBenificiaryFunctionId));
  261. }
  262. }
  263. private void PopulateForm(string id)
  264. {
  265. var dr = _receiver.SelectReceiverInformationByReceiverId(GetStatic.GetUser(), id);
  266. if (null != dr)
  267. {
  268. string countryId = dr["countryId"].ToString();
  269. ddlCountry.SelectedValue = countryId;
  270. ddlBenificiaryType.SelectedValue = dr["receiverType"].ToString();
  271. txtEmail.Text = dr["email"].ToString();
  272. txtReceiverFName.Text = dr["firstName"].ToString();
  273. txtReceiverLName.Text = dr["lastName1"].ToString();
  274. txtReceiverMName.Text = dr["middleName"].ToString();
  275. txtReceiverAddress.Text = dr["address"].ToString();
  276. txtReceiverCity.Text = dr["city"].ToString();
  277. txtContactNo.Text = dr["homePhone"].ToString();
  278. txtSenderMobileNo.Text = dr["mobile"].ToString();
  279. txtPlaceOfIssue.Text = dr["placeOfIssue"].ToString();
  280. ddlIdType.SelectedValue = dr["idType"].ToString();
  281. txtIdValue.Text = dr["idNumber"].ToString();
  282. ddlPurposeOfRemitance.SelectedValue = dr["purposeOfRemit"].ToString();
  283. DDLBankBranch.SelectedValue = dr["bankLocation"].ToString();
  284. txtBankName.Text = dr["bankName"].ToString();
  285. txtBenificaryAc.Text = dr["receiverAccountNo"].ToString();
  286. txtRemarks.Text = dr["remarks"].ToString();
  287. hideCustomerId.Value = dr["customerId"].ToString();
  288. hideBenificialId.Value = dr["receiverId"].ToString();
  289. hideMembershipId.Value = dr["membershipId"].ToString();
  290. ddlNativeCountry.SelectedValue = dr["NativeCountry"].ToString();
  291. ddlRelationship.SelectedValue = dr["relationship"].ToString();
  292. if (dr["relationship"].ToString() == "11339")
  293. {
  294. otherRelationDiv.Attributes.Add("style", "");
  295. otherRelationshipTextBox.Text = dr["relationOther"].ToString();
  296. }
  297. else
  298. {
  299. otherRelationDiv.Attributes.Add("style", "display: none;");
  300. }
  301. if (dr["purposeOfRemit"].ToString() == "11347")
  302. {
  303. otherPurposeDiv.Attributes.Add("style", "");
  304. purposeOther.Text = dr["purposeOther"].ToString();
  305. }
  306. else
  307. {
  308. otherPurposeDiv.Attributes.Add("style", "display: none;");
  309. }
  310. if (dr["paymentMode"].ToString() != "2")
  311. {
  312. agentBankBranchDiv.Attributes.Add("style", "display: none;");
  313. }
  314. else
  315. {
  316. agentBankBranchDiv.Attributes.Add("style", "");
  317. }
  318. LoadPaymentModeDDL(dr["paymentMode"].ToString());
  319. LoadPayoutPartnerDDL(dr["payOutPartner"].ToString());
  320. LoadPayoutPartnerBranchDDL(dr["payOutPartner"].ToString(), countryId, dr["paymentMode"].ToString(), dr["bankLocation"].ToString());
  321. if (!string.IsNullOrEmpty(ddlIdType.SelectedValue) && !string.IsNullOrWhiteSpace(ddlIdType.SelectedValue) && ddlIdType.SelectedValue != "0")
  322. {
  323. idNumberErr.Attributes.Remove("hidden");
  324. txtIdValue.Attributes.Remove("disabled");
  325. }
  326. if (dr["purposeOfRemit"].ToString() == "11345")
  327. {
  328. goodsType.Text = dr["goodsType"].ToString();
  329. goodsOrigin.Text = dr["goodsOrigin"].ToString();
  330. portOfShipment.Text = dr["portOfShipment"].ToString();
  331. goodsInfoDiv.Attributes.Add("style", "");
  332. }
  333. else
  334. {
  335. goodsInfoDiv.Attributes.Add("style", "display: none;");
  336. }
  337. if (GetReceiverId() != "")
  338. {
  339. requiredClass.Visible = false;
  340. isFromPhoneDiv.Visible = false;
  341. }
  342. else
  343. {
  344. requiredClass.Visible = true;
  345. isFromPhoneDiv.Visible = true;
  346. }
  347. }
  348. }
  349. private void LoadPayoutPartner()
  350. {
  351. var countryId = Request.Form["country"].Split('(')[0];
  352. var paymentModeVal = Request.Form["paymentMode"];
  353. var sql = "EXEC proc_sendPageLoadData @flag='rec-select-agent', @countryId = '" + GetStatic.ReadWebConfig("domesticCountryId", "") + "',@pCountryId='" + countryId + "',@param = '" + paymentModeVal + "',@agentId='" + GetStatic.GetAgentId() + "',@user = '" + GetStatic.GetUser() + "'";
  354. var payoutPartnerList = _cd.ExecuteDataTable(sql);
  355. var payoutPartnerDdl = Mapper.DataTableToClass<DropDownModel>(payoutPartnerList);
  356. var jsonString = JsonConvert.SerializeObject(payoutPartnerDdl);
  357. Response.ContentType = "application/json";
  358. Response.Write(jsonString);
  359. Response.End();
  360. }
  361. private void LoadPayoutPartnerDDL(string partnerId)
  362. {
  363. var sql = "EXEC proc_sendPageLoadData @flag='rec-select-agent', @countryId = '" + GetStatic.ReadWebConfig("domesticCountryId", "") + "',@pCountryId='" + ddlCountry.SelectedValue + "',@param = '" + ddlPaymentMode.SelectedItem.Text + "',@agentId='" + GetStatic.GetAgentId() + "',@user = '" + GetStatic.GetUser() + "'";
  364. _sl.SetDDL(ref ddlPayoutPatner, sql, "bankId", "AGENTNAME", partnerId, "");
  365. if (ddlPaymentMode.SelectedValue == "2" || ddlPaymentMode.SelectedValue == "13")
  366. receiverAccountNo.Attributes.Remove("hidden");
  367. if(ddlPaymentMode.SelectedValue == "13")
  368. {
  369. beneficiaryAccount.InnerText = "Beneficiary Wallet No.";
  370. }
  371. }
  372. public void GetBankBranch()
  373. {
  374. string bankId = Request.Form["bankId"];
  375. string countryId = Request.Form["countryId"];
  376. string pMode = Request.Form["pMode"];
  377. string branchId = Request.Form["branchId"];
  378. if (pMode == "2" || ddlPaymentMode.SelectedValue == "13")
  379. receiverAccountNo.Attributes.Remove("hidden");
  380. if (ddlPaymentMode.SelectedValue == "13")
  381. {
  382. beneficiaryAccount.InnerText = "Beneficiary Wallet No.";
  383. }
  384. var dtResult = st.GetBranchReceiverAdd(GetStatic.GetUser(), countryId, pMode, bankId);
  385. var paymentDdl = Mapper.DataTableToClass<DropDownModel>(dtResult);
  386. var jsonString = JsonConvert.SerializeObject(paymentDdl);
  387. Response.ContentType = "application/json";
  388. Response.Write(jsonString);
  389. Response.End();
  390. }
  391. private void LoadPayoutPartnerBranchDDL(string bankId, string countryId, string pMode, string branchId)
  392. {
  393. if (pMode == "2" || pMode == "13")
  394. receiverAccountNo.Attributes.Remove("hidden");
  395. if (pMode == "13")
  396. {
  397. beneficiaryAccount.InnerText = "Beneficiary Wallet No.";
  398. }
  399. var dao = new RemittanceDao();
  400. string sql = "EXEC PROC_API_BANK_BRANCH_SETUP @flag='getBranch-new'";
  401. sql += " , @CountryId = " + dao.FilterString(countryId);
  402. sql += " , @PaymentMethod = " + dao.FilterString(pMode);
  403. sql += " , @user = " + dao.FilterString(GetStatic.GetUser());
  404. sql += " , @bankId = " + dao.FilterString(bankId);
  405. _sl.SetDDL(ref DDLBankBranch, sql, "agentId", "agentName", branchId, "");
  406. }
  407. private void PopulateDDL()
  408. {
  409. _sl.SetDDL(ref ddlIdType, "EXEC proc_online_dropDownList @flag='idType',@user='" + GetStatic.GetUser() + "'", "valueId", "detailTitle", "", "Select..");
  410. _sl.SetDDL(ref ddlCountry, "EXEC proc_online_dropDownList @flag='allCountrylistWithCode',@user='" + GetStatic.GetUser() + "'", "countryId", "countryName", "", "Select..");
  411. _sl.SetDDL(ref ddlNativeCountry, "EXEC proc_online_dropDownList @flag='allCountrylist',@user='" + GetStatic.GetUser() + "'", "countryId", "countryName", "", "Select..");
  412. _sl.SetDDL(ref ddlRelationship, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=2100", "valueId", "detailTitle", "", "Select..");
  413. _sl.SetDDL(ref ddlPurposeOfRemitance, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=3800", "valueId", "detailTitle", "8060", "Select..");
  414. _sl.SetDDL(ref ddlBenificiaryType, "EXEC proc_online_dropDownList @flag='dropdownList',@user='" + GetStatic.GetUser() + "',@parentId=4700", "valueId", "detailTitle", ddlBenificiaryType.SelectedValue, "");
  415. }
  416. protected string GetReceiverId()
  417. {
  418. return GetStatic.ReadQueryString("receiverId", "");
  419. }
  420. protected void register_Click(object sender, EventArgs e)
  421. {
  422. string receiverId = GetStatic.ReadQueryString("receiverId", "");
  423. BenificiarData benificiar = new BenificiarData()
  424. {
  425. Country = ddlCountry.SelectedItem.Text.Split('(')[0],
  426. NativeCountry = ddlNativeCountry.SelectedValue,
  427. BenificiaryType = ddlBenificiaryType.SelectedValue,
  428. Email = txtEmail.Text,
  429. ReceiverFName = txtReceiverFName.Text,
  430. ReceiverMName = txtReceiverMName.Text,
  431. ReceiverLName = txtReceiverLName.Text,
  432. ReceiverAddress = txtReceiverAddress.Text,
  433. ReceiverCity = txtReceiverCity.Text,
  434. ContactNo = txtContactNo.Text,
  435. SenderMobileNo = txtSenderMobileNo.Text,
  436. Relationship = ddlRelationship.SelectedItem.Text,
  437. PlaceOfIssue = txtPlaceOfIssue.Text,
  438. TypeId = ddlIdType.SelectedValue,
  439. TypeValue = txtIdValue.Text,
  440. PurposeOfRemitance = ddlPurposeOfRemitance.SelectedItem.Text,
  441. PaymentMode = ddlPaymentMode.SelectedValue,
  442. PayoutPatner = ddlPayoutPatner.SelectedValue,
  443. BankLocation = DDLBankBranch.SelectedValue,
  444. BankName = txtBankName.Text,
  445. BenificaryAc = txtBenificaryAc.Text,
  446. Remarks = txtRemarks.Text,
  447. OtherRelationDescription = otherRelationshipTextBox.Text,
  448. membershipId = hideMembershipId.Value,
  449. ReceiverId = hideBenificialId.Value,
  450. customerId = (hideCustomerId.Value != "" ? hideCustomerId.Value : null),
  451. Flag = (hideBenificialId.Value != "" ? "u" : "i")
  452. };
  453. var dbResult = _cd.UpdateBenificiarInformation(benificiar, GetStatic.GetUser());
  454. if (dbResult.ErrorCode == "0")
  455. {
  456. if (GetReceiverAddType().ToLower() == "s")
  457. {
  458. GetStatic.CallBackJs1(Page, "Call Back", "CallBack('" + dbResult.Id + "');");
  459. }
  460. else
  461. {
  462. GetStatic.SetMessage(dbResult);
  463. Response.Redirect("List.aspx?customerId=" + benificiar.customerId);
  464. return;
  465. }
  466. }
  467. else
  468. {
  469. GetStatic.AlertMessage(this, dbResult.Msg);
  470. return;
  471. }
  472. }
  473. public string GetReceiverAddType()
  474. {
  475. return GetStatic.ReadQueryString("AddType", "");
  476. }
  477. private void LoadPaymentModeDDL(string paymentId)
  478. {
  479. _sl.SetDDL(ref ddlPaymentMode, "EXEC proc_online_sendPageLoadData @flag='payoutMethods',@country='" + ddlCountry.SelectedItem.Text.Split('(')[0] + "'", "Key", "Value", paymentId, "");
  480. }
  481. private void LoadPaymentModeFromAjax()
  482. {
  483. var pCountry = Request.Form["pCountry"];
  484. var dt = _cd.LoadDataPaymentModeDdl(GetStatic.ReadWebConfig("domesticCountryId", ""), pCountry, "", null, "recModeByCountry", GetStatic.GetUser());
  485. Response.ContentType = "text/plain";
  486. var json = DataTableToJson(dt);
  487. Response.Write(json);
  488. Response.End();
  489. }
  490. public static string DataTableToJson(DataTable table)
  491. {
  492. if (table == null)
  493. return "";
  494. var list = new List<Dictionary<string, object>>();
  495. foreach (DataRow row in table.Rows)
  496. {
  497. var dict = new Dictionary<string, object>();
  498. foreach (DataColumn col in table.Columns)
  499. {
  500. dict[col.ColumnName] = string.IsNullOrEmpty(row[col].ToString()) ? "" : row[col];
  501. }
  502. list.Add(dict);
  503. }
  504. var serializer = new JavaScriptSerializer();
  505. string json = serializer.Serialize(list);
  506. return json;
  507. }
  508. protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
  509. {
  510. if (!string.IsNullOrWhiteSpace(ddlCountry.SelectedItem.Text))
  511. {
  512. LoadPaymentModeDDL("");
  513. LoadPayoutPartnerDDL(ddlPayoutPatner.SelectedValue);
  514. }
  515. }
  516. public string GetFunctionIdByUserType(string functionIdAgent, string functionIdAdmin)
  517. {
  518. return (GetStatic.GetUserType() == "HO") ? functionIdAdmin : functionIdAgent;
  519. }
  520. protected void ddlPayoutPatner_SelectedIndexChanged(object sender, EventArgs e)
  521. {
  522. LoadPayoutPartnerBranchDDL(ddlPayoutPatner.SelectedValue, ddlCountry.SelectedValue, ddlPaymentMode.SelectedValue, null);
  523. }
  524. private void SaveBeneficiaryDocument(DbResult dbresult)
  525. {
  526. var result = dbresult.Extra2.Split('|');
  527. var customerId = result[0];
  528. var membershipId = result[1];
  529. var registerDate = result[2];
  530. HttpFileCollection fileCollection = Request.Files;
  531. for (int i = 0; i < fileCollection.AllKeys.Length; i++)
  532. {
  533. HttpPostedFile file = fileCollection[i];
  534. if (file != null)
  535. {
  536. string documentTypeName = "";
  537. string documentType = "";
  538. string fileType = "";
  539. if (i == 0)
  540. {
  541. documentTypeName = "Beneficiary_Registration_Form";
  542. documentType = "11400";//11386
  543. }
  544. string fileName = (!string.IsNullOrWhiteSpace(file.FileName) ? GetStatic.UploadDocument(file, customerId, documentTypeName, membershipId, registerDate, out fileType) : GetStatic.UploadDocument(file, customerId, documentType, membershipId, registerDate, out fileType));
  545. CustomerDocument cm = new CustomerDocument();
  546. if (!string.IsNullOrEmpty(fileName) && fileName.ToLower() != "notvalid")
  547. _cd.UpdateCustomerDocument("", customerId, fileName, documentTypeName, fileType, documentType, GetStatic.GetUser());
  548. }
  549. }
  550. }
  551. }
  552. public class DropDownModel
  553. {
  554. public string Key { get; set; }
  555. public string Value { get; set; }
  556. public string bankId { get; set; }
  557. public string AGENTNAME { get; set; }
  558. public string agentId { get; set; }
  559. public string agentName { get; set; }
  560. }
  561. }