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.

106 lines
4.6 KiB

  1. using Swift.DAL.Remittance.CashAndVault;
  2. using Swift.web.Component.Grid;
  3. using Swift.web.Component.Grid.gridHelper;
  4. using Swift.web.Library;
  5. using System;
  6. using System.Collections.Generic;
  7. namespace Swift.web.Remit.CashAndVault
  8. {
  9. public partial class List : System.Web.UI.Page
  10. {
  11. protected const string GridName = "cashAndVault";
  12. private string ViewFunctionId = "20178000";
  13. private const string AddFunctionId = "20178030";
  14. private const string EditFunctionId = "20178010";
  15. private const string ApproveFunctionId = "20178020";
  16. private const string ActiveInActiveFunctionId = "20178040";
  17. private readonly RemittanceLibrary _sl = new RemittanceLibrary();
  18. private CashAndVaultDao CAVDao = new CashAndVaultDao();
  19. private readonly SwiftGrid _grid = new SwiftGrid();
  20. protected void Page_Load(object sender, EventArgs e)
  21. {
  22. Authenticate();
  23. if (!IsPostBack)
  24. {
  25. GetStatic.PrintMessage(Page);
  26. }
  27. LoadGrid();
  28. }
  29. private void Authenticate()
  30. {
  31. _sl.CheckAuthentication(ViewFunctionId);
  32. }
  33. private void LoadGrid()
  34. {
  35. _grid.FilterList = new List<GridFilter>
  36. {
  37. };
  38. _grid.ColumnList = new List<GridColumn>
  39. {
  40. new GridColumn("SN", "SN", "", "T"),
  41. new GridColumn("agentName", "Agent/Branch", "", "T"),
  42. new GridColumn("RULE_TYPE", "Rule Type", "", "T"),
  43. new GridColumn("IS_ACTIVE", "Active Status", "", "T"),
  44. new GridColumn("cashHoldLimit", "Cash Hold Limit", "", "M"),
  45. };
  46. _grid.GridType = 1;
  47. _grid.GridDataSource = SwiftGrid.GridDS.RemittanceDB;
  48. _grid.GridName = GridName;
  49. _grid.ShowPagingBar = true;
  50. _grid.AllowApprove = _sl.HasRight(ApproveFunctionId);
  51. _grid.ApproveFunctionId = ApproveFunctionId;
  52. _grid.AlwaysShowFilterForm = false;
  53. _grid.ShowFilterForm = false;
  54. _grid.RowIdField = "cashHoldLimitId";
  55. _grid.ThisPage = "List.aspx";
  56. _grid.InputPerRow = 4;
  57. _grid.GridMinWidth = 700;
  58. _grid.GridWidth = 100;
  59. _grid.AllowEdit = false;
  60. _grid.IsGridWidthInPercent = true;
  61. _grid.AddPage = "ManageBranchWiseLimit.aspx";
  62. _grid.AllowCustomLink = true;
  63. string userWiseLink = "";
  64. if (_sl.HasRight(EditFunctionId))
  65. {
  66. userWiseLink += "<a href =\"ManageBranchWiseLimit.aspx?cashHoldLimitId=@cashHoldLimitId&agentId=@agentId\"><span class=\"action-icon\"> <btn class=\"btn btn-xs btn-primary\" data-toggle=\"tooltip\" data-placement=\"top\" title = \"Edit\"> <i class=\"fa fa-pencil\" ></i></btn></span></a>&nbsp;&nbsp;";
  67. }
  68. userWiseLink += "<span class=\"action-icon\"> <btn class=\"btn btn-xs btn-default\" data-toggle=\"tooltip\" data-placement=\"top\" title = \"Assign Limit User Wise\"> <a href =\"UserWiseLimitList.aspx?cashHoldLimitId=@cashHoldLimitId&agentId=@agentId&selectedAgentName=@agentName\"><i class=\"fa fa-list\" ></i></a></btn></span>";
  69. //userWiseLink += "&nbsp;&nbsp;<a class=\"btn btn-xs btn-danger\" title=\"In-Active\" href=\"javascript:void(0);\" onclick=\"ActiveInActive('@cashHoldLimitId')\"><i class=\"fa fa-times\"></i></a>";
  70. _grid.CustomLinkText = userWiseLink;
  71. _grid.CustomLinkVariables = "cashHoldLimitId,agentId,agentName";
  72. string sql = "EXEC PROC_CASHANDVAULT @flag = 's' ";
  73. _grid.SetComma();
  74. rpt_grid.InnerHtml = _grid.CreateGrid(sql);
  75. }
  76. public string GetFunctionIdByUserType(string functionIdAgent, string functionIdAdmin)
  77. {
  78. return (GetStatic.GetUserType() == "HO") ? functionIdAdmin : functionIdAgent;
  79. }
  80. protected void btnUpdate_Click(object sender, EventArgs e)
  81. {
  82. var status = hddisActive.Value.ToString();
  83. var cashholdLimitIdVal = hddcashHoldLimitId.Value.ToString();
  84. var res = CAVDao.UpdateActiveInActiveStatus(GetStatic.GetUser(), status, cashholdLimitIdVal, "B");
  85. if (res.ErrorCode == "0")
  86. {
  87. GetStatic.AlertMessage(this.Page, res.Msg);
  88. Response.Redirect("List.aspx");
  89. }
  90. else
  91. {
  92. GetStatic.AlertMessage(this.Page, res.Msg);
  93. }
  94. }
  95. }
  96. }