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.

246 lines
9.4 KiB

  1. using Newtonsoft.Json;
  2. using Swift.DAL.OnlineAgent;
  3. using Swift.DAL.SwiftDAL;
  4. using Swift.web.Library;
  5. using System;
  6. using System.Data;
  7. using System.Web.Script.Serialization;
  8. namespace Swift.web.KJBank.CustomerNameChecking
  9. {
  10. public partial class Manage : System.Web.UI.Page
  11. {
  12. private const string ViewFunctionId = "20134200";
  13. private RemittanceLibrary _rl = new RemittanceLibrary();
  14. private readonly OnlineCustomerDao _dao = new OnlineCustomerDao();
  15. protected void Page_Load(object sender, EventArgs e)
  16. {
  17. Authenticate();
  18. }
  19. private void Authenticate()
  20. {
  21. _rl.CheckSession();
  22. if (!IsPostBack)
  23. {
  24. PopulateDDL();
  25. }
  26. }
  27. public void PopulateDDL()
  28. {
  29. _rl.SetDDL(ref ddlGender, "EXEC proc_online_dropDownList @flag='GenderList'", "valueId", "detailTitle", "", "Select.."); //Gender
  30. _rl.SetDDL(ref ddlIdType, "EXEC proc_online_dropDownList @flag='idType'", "valueId", "detailTitle", "", "Select.."); //Id Type
  31. _rl.SetDDL(ref ddlBankName, "EXEC proc_dropDownList @flag='banklist'", "bankCode", "text", "", "Select.."); // Bank Name
  32. _rl.SetDDL(ref ddlCountry, "EXEC proc_online_dropDownList @flag='allCountrylist'", "countryId", "countryName", "", "Select.."); ; //Country Name
  33. }
  34. protected void btnViewDetail_Click(object sender, EventArgs e)
  35. {
  36. DataRow dr = null;
  37. string sBy = searchBy.Text;
  38. string sValue = searchValue.Text;
  39. try
  40. {
  41. if (!string.IsNullOrWhiteSpace(sValue))
  42. {
  43. dr = _dao.GetCustomerDetailForVerification(sBy, GetStatic.GetUser(), sValue);
  44. }
  45. else
  46. {
  47. hiddenSearch.Visible = false;
  48. hiddenError.Visible = true;
  49. errorMsg.InnerText = "Searchvalue field can not be empty!!";
  50. return;
  51. }
  52. if (dr != null)
  53. {
  54. if (dr["code"].ToString() == "0")
  55. {
  56. hiddenSearch.Visible = true;
  57. hiddenError.Visible = false;
  58. customerName.Text = dr["name"].ToString();
  59. mobile.Text = dr["mobile"].ToString();
  60. ddlGender.SelectedValue = dr["gender"].ToString();
  61. ddlIdType.SelectedValue = dr["idType"].ToString();
  62. idNumber.Text = dr["idNumber"].ToString();
  63. dob.Text = dr["dob"].ToString();
  64. ddlBankName.SelectedValue = dr["bankCode"].ToString();
  65. accountNumber.Text = dr["accountNo"].ToString();
  66. ddlCountry.SelectedValue = dr["country"].ToString();
  67. hddbankCode.Value = dr["bankCode"].ToString();
  68. hddobpId.Value = dr["obpId"].ToString();
  69. hddwallletNo.Value = dr["wallletNo"].ToString();
  70. }
  71. else
  72. {
  73. hiddenSearch.Visible = false;
  74. hiddenError.Visible = true;
  75. errorMsg.InnerText = "Sorry No Record Found!!";
  76. }
  77. }
  78. else
  79. {
  80. hiddenSearch.Visible = false;
  81. hiddenError.Visible = true;
  82. errorMsg.InnerText = "No record found from database for searched value!!";
  83. }
  84. }
  85. catch (Exception ex)
  86. {
  87. hiddenSearch.Visible = false;
  88. hiddenError.Visible = true;
  89. errorMsg.InnerText = ex.Message.ToString();
  90. }
  91. }
  92. protected void btnVerification_Click(object sender, EventArgs e)
  93. {
  94. try
  95. {
  96. var request = new RealNameRequest();
  97. request.institution = ddlBankName.Text;
  98. request.no = accountNumber.Text;
  99. var IdNo = idNumber.Text.Replace("-", "");
  100. //주민번호
  101. if (ddlIdType.Text == "8008")
  102. {
  103. request.realNameDivision = "01";
  104. request.realNameNo = IdNo;
  105. }
  106. //외국인등록번호
  107. else if (ddlIdType.Text == "1302")
  108. {
  109. request.realNameDivision = "02";
  110. request.realNameNo = IdNo;
  111. }
  112. //여권번호는 조합주민번호로 변경
  113. else if (ddlIdType.Text == "10997")
  114. {
  115. var gender = (ddlGender.Text == "97" ? "7" : "8");
  116. var country = "";
  117. switch (ddlCountry.Text)
  118. {
  119. case "238":
  120. country = "1";
  121. break;
  122. case "113":
  123. country = "2";
  124. break;
  125. case "45":
  126. country = "3";
  127. break;
  128. default:
  129. country = "4";
  130. break;
  131. }
  132. request.realNameDivision = "04";
  133. var DateB = dob.Text.Split('/');
  134. request.realNameNo = String.Format("{0}{1}{2}{3}",
  135. DateB[2].Substring(2) + DateB[0] + DateB[1],
  136. gender,
  137. country,
  138. IdNo.Substring(IdNo.Length - 5));
  139. }
  140. string requestBody = JsonConvert.SerializeObject(request);
  141. var response = KJBankAPIConnection.GetRealNameCheck(requestBody);
  142. if (response.ErrorCode == "0")
  143. {
  144. response.Msg = response.Msg.Split(':')[1];
  145. response.Msg = response.Msg.Replace("}", "");
  146. response.Msg = response.Msg.Trim();
  147. if (!string.IsNullOrWhiteSpace(response.Msg))
  148. {
  149. GetStatic.AlertMessage(Page, "Success - Customer Account Name: " + response.Msg);
  150. }
  151. }
  152. else
  153. {
  154. GetStatic.AlertMessage(Page, "Fail - Validation failed");
  155. }
  156. }
  157. catch (Exception ex)
  158. {
  159. GetStatic.AlertMessage(Page, "Fail - Validation failed");
  160. }
  161. }
  162. //private void ManageSaved() {
  163. // try
  164. // {
  165. // var requestObj = new PartnerServiceAccountRequest()
  166. // {
  167. // processDivision = "02",
  168. // institution = hddbankCode.Value,
  169. // depositor = ddlBankName.SelectedItem.Text,
  170. // no = accountNumber.Text,
  171. // virtualAccountNo = hddwallletNo.Value,
  172. // obpId = hddobpId.Value
  173. // };
  174. // /*
  175. // * @Max 추가
  176. // * */ var idNum = idNumber.Text.Replace("-", "");
  177. // //주민번호 if (ddlIdType.SelectedValue == "8008") { requestObj.realNameDivision = "01";
  178. // requestObj.realNameNo = idNum; } //외국인등록번호 else if (ddlIdType.SelectedValue == "1302") {
  179. // requestObj.realNameDivision = "02"; requestObj.realNameNo = idNum; } //여권번호는 조합주민번호로 변경
  180. // else if (ddlIdType.SelectedValue == "10997") { requestObj.realNameDivision = "04";
  181. // //조합주민번호(생년월일-성별-국적-여권번호(마지막5자리)) requestObj.realNameNo = String.Format("{0}{1}{2}{3}",
  182. // dob.Text, ddlGender.SelectedValue, ddlCountry.SelectedValue, idNum.Substring(idNum.Length
  183. // - 5)); }
  184. // requestObj.depositor = acNameInBank.Text;
  185. // DbResult dbResult = SendNotificationToKjBank(requestObj); if (dbResult == null) {
  186. // GetStatic.AlertMessage(Page, "Internal Error : Database result is null");
  187. // }
  188. // else if (!string.IsNullOrWhiteSpace(dbResult.Id))
  189. // {
  190. // ManageSaved();
  191. // GetStatic.AlertMessage(Page, "Customer Detail updated");
  192. // }
  193. // else
  194. // {
  195. // GetStatic.AlertMessage(Page, "Customer detail not pushed to KJ Bank, please contact HO!");
  196. // }
  197. // }
  198. // catch (Exception ex)
  199. // {
  200. // GetStatic.AlertMessage(Page, ex.Message);
  201. // }
  202. //}
  203. private DbResult SendNotificationToKjBank(PartnerServiceAccountRequest obj)
  204. {
  205. string body = new JavaScriptSerializer().Serialize((obj));
  206. var resp = KJBankAPIConnection.CustomerRegistration(body);
  207. return resp;
  208. }
  209. protected void btnClear_Click(object sender, EventArgs e)
  210. {
  211. Hide();
  212. }
  213. public void Hide()
  214. {
  215. hiddenSearch.Visible = false;
  216. hiddenError.Visible = false;
  217. }
  218. }
  219. }