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.

100 lines
4.0 KiB

  1. using Swift.DAL.Remittance.BonusManagement;
  2. using Swift.DAL.SwiftDAL;
  3. using Swift.web.Component.Grid;
  4. using Swift.web.Component.Grid.gridHelper;
  5. using Swift.web.Library;
  6. using System;
  7. using System.Collections.Generic;
  8. namespace Swift.web.AgentPanel.Bonus_Management
  9. {
  10. public partial class RedeemRequestList : System.Web.UI.Page
  11. {
  12. protected const string GridName = "grid_Redeem";
  13. private const string ViewFunctionId = "40122500";
  14. private readonly SwiftLibrary _swiftLibrary = new SwiftLibrary();
  15. readonly BonusManagementDao _redeemDao = new BonusManagementDao();
  16. private readonly SwiftGrid _grid = new SwiftGrid();
  17. protected void Page_Load(object sender, EventArgs e)
  18. {
  19. Authenticate();
  20. LoadGrid();
  21. }
  22. private void Authenticate()
  23. {
  24. _swiftLibrary.CheckAuthentication(ViewFunctionId);
  25. }
  26. private void LoadGrid()
  27. {
  28. var dbResult = GetStatic.GetMessage();
  29. if (dbResult != null)
  30. {
  31. if (dbResult.Msg != null || dbResult.Msg != "")
  32. {
  33. GetStatic.PrintSuccessMessage(this, dbResult.Msg);
  34. DbResult dbres = new DbResult();
  35. dbres.Msg = "";
  36. GetStatic.SetMessage(dbres);
  37. }
  38. }
  39. _grid.FilterList = new List<GridFilter>
  40. {
  41. new GridFilter("stat", "Status", "1:EXEC proc_statusLists @flag = 'redeemStatus'"),
  42. new GridFilter("userName", "Customer User Name(Email)", "LT"),
  43. new GridFilter("agent", "Agent", "LT")
  44. };
  45. _grid.ColumnList = new List<GridColumn>
  46. {
  47. new GridColumn("SN", "SN", "", "T"),
  48. new GridColumn("userName", "Customer User Name<br>ID", "", "T"),
  49. new GridColumn("customerName", "Customer<br>Name", "", "T"),
  50. new GridColumn("redeemedDate", "Redeemed<br>Date", "", "T"),
  51. new GridColumn("agent", "Agent", "", "T"),
  52. new GridColumn("award", "Gift<br>Item", "", "T"),
  53. new GridColumn("milageEarned", "Total Bonus<br>Point", "", "T"),
  54. new GridColumn("redeemed", "Redeemed", "", "T"),
  55. new GridColumn("availableBonus", "Bonus<br>Available", "", "T"),
  56. new GridColumn("approvedBy", "Approved<br>By", "", "T"),
  57. new GridColumn("remarks","Remarks","","T"),
  58. new GridColumn("stat","Status","","T"),
  59. };
  60. _grid.GridType = 1;
  61. _grid.GridName = GridName;
  62. _grid.GridDataSource = SwiftGrid.GridDS.RemittanceDB;
  63. _grid.ShowFilterForm = true;
  64. _grid.ShowPagingBar = true;
  65. _grid.PageSize = 50;
  66. _grid.GridWidth = 800;
  67. _grid.GridMinWidth = 800;
  68. _grid.RowIdField = "refNo";
  69. _grid.ThisPage = "RedeemRequest";
  70. _grid.AllowCustomLink = true;
  71. _grid.AllowDelete = false;
  72. _grid.InputPerRow = 3;
  73. _grid.CustomLinkVariables = "refNo,customerId,redeemed,isApproved,ishanded,award";
  74. _grid.CustomLinkText = "<input id='btn1' type='button' value='Gift Handover' onclick='giftHandedOver(@refNo,@customerId)' style='display:@isApproved' class='btn btn-primary'/><input id='btn2' type='button' value='Receipt' onclick='openReceipt(@refNo,@customerId)' style='display:@ishanded' class='btn btn-primary'/>";
  75. _grid.SetComma();
  76. string sql = "EXEC [proc_bonusRedeemHistoryAdmin] @flag='status'";
  77. rpt_grid.InnerHtml = _grid.CreateGrid(sql);
  78. }
  79. protected void btnHandedOver_Click(object sender, EventArgs e)
  80. {
  81. string redeemId = hdnRedeemId.Value;
  82. string customerId = hdnCustomerId.Value;
  83. var dbRes = _redeemDao.GiftHandedOver(redeemId, customerId, GetStatic.GetUser());
  84. if (dbRes.ErrorCode.Equals("0"))
  85. {
  86. GetStatic.PrintSuccessMessage(this, dbRes.Msg);
  87. LoadGrid();
  88. }
  89. }
  90. }
  91. }