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.

96 lines
3.5 KiB

  1. using Swift.DAL.Remittance.CashAndVault;
  2. using Swift.web.Library;
  3. using System;
  4. using System.Data;
  5. using System.Web;
  6. namespace Swift.web.Remit.CashAndVault
  7. {
  8. public partial class ManageUserWiseLimit1 : System.Web.UI.Page
  9. {
  10. protected const string GridName = "cashAndVault";
  11. private string ViewFunctionId = "20178000";
  12. private readonly RemittanceLibrary _sl = new RemittanceLibrary();
  13. private CashAndVaultDao cavDao = new CashAndVaultDao();
  14. protected void Page_Load(object sender, EventArgs e)
  15. {
  16. Authenticate();
  17. if (!IsPostBack)
  18. {
  19. GetStatic.PrintMessage(Page);
  20. Misc.MakeNumericTextbox(ref cashHoldLimit);
  21. Misc.MakeNumericTextbox(ref perTopUpLimit);
  22. PopulateData();
  23. headerPart.InnerText = "User limit Set up : (" + GetSelectedUserName() + ")";
  24. }
  25. }
  26. private void PopulateData()
  27. {
  28. string branchRuleId = GetBranchRuleId();
  29. var dt = cavDao.GetUserDetails(GetStatic.GetUser(), GetBranchRuleId(), GetUserRuleId(), GetAgentId(), GetUserId());
  30. foreach (DataRow dr in dt.Rows)
  31. {
  32. UserName.Text = dr["userName"].ToString();
  33. decimal cashHoldLimitDecVal = Convert.ToDecimal(dr["cashHoldLimit"].ToString());
  34. cashHoldLimit.Text = cashHoldLimitDecVal.ToString("#,0.00");
  35. ddlRuleType.SelectedValue = dr["ruleType"].ToString();
  36. }
  37. }
  38. protected string GetBranchRuleId()
  39. {
  40. return GetStatic.ReadQueryString("cashHoldLimitId", "");
  41. }
  42. protected string GetUserRuleId()
  43. {
  44. return GetStatic.ReadQueryString("cashHoldLimitUserId", "");
  45. }
  46. protected string GetSelectedUserName()
  47. {
  48. return GetStatic.ReadQueryString("selectedUserName", "");
  49. }
  50. protected string GetAgentId()
  51. {
  52. return GetStatic.ReadQueryString("agentId", "");
  53. }
  54. protected string GetUserId()
  55. {
  56. return GetStatic.ReadQueryString("userId", "");
  57. }
  58. private void Authenticate()
  59. {
  60. _sl.CheckAuthentication(ViewFunctionId);
  61. }
  62. protected void Save_Click(object sender, EventArgs e)
  63. {
  64. var agentId = Request.Form["UserName"];
  65. var cashLimit = Request.Form["cashHoldLimit"];
  66. var perTopUpLimitVal = "0";
  67. var ruleType = Request.Form["ddlruleType"];
  68. //var agentId = ddlAgentBranch.SelectedValue;
  69. //var cashLimit = cashHoldLimit.Text;
  70. //var perTopUpLimitVal = perTopUpLimit.Text;
  71. //var ruleType = ddlruleType.SelectedValue;
  72. var res = cavDao.SaveUserCashAndVault(GetStatic.GetUser(), GetAgentId(), cashLimit, perTopUpLimitVal, ruleType, GetBranchRuleId(), GetUserRuleId(), GetUserId());
  73. if (res.ErrorCode == "0")
  74. {
  75. HttpContext.Current.Session["message"] = res;
  76. Response.Redirect("UserWiseLimitList.aspx?cashHoldLimitId=" + GetBranchRuleId() + "&agentId=" + GetAgentId() + "");
  77. //GetStatic.AlertMessage(this, res.Msg);
  78. }
  79. else
  80. {
  81. HttpContext.Current.Session["message"] = res;
  82. Response.Redirect("UserWiseLimitList.aspx?cashHoldLimitId=" + GetBranchRuleId() + "&agentId=" + GetAgentId() + "");
  83. GetStatic.AlertMessage(this, res.Msg);
  84. }
  85. }
  86. }
  87. }