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.

626 lines
29 KiB

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