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.

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