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.

112 lines
4.1 KiB

  1. using Newtonsoft.Json;
  2. using Swift.DAL.BL.System.GeneralSettings;
  3. using Swift.DAL.SwiftDAL;
  4. using Swift.web.Component.Grid;
  5. using Swift.web.Component.Grid.gridHelper;
  6. using Swift.web.Library;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Data;
  10. using System.Linq;
  11. using System.Web;
  12. using System.Web.UI;
  13. using System.Web.UI.WebControls;
  14. namespace Swift.web.Remit.Administration.ReferralSetup
  15. {
  16. public partial class ReferPointMasterSetup : System.Web.UI.Page
  17. {
  18. private const string ViewFunctionId = "90400000";
  19. private const string GridName = "grd_bldom";
  20. private readonly SwiftGrid grid = new SwiftGrid();
  21. private readonly RemittanceLibrary swiftLibrary = new RemittanceLibrary();
  22. private readonly StaticDataDao _obj = new StaticDataDao();
  23. protected void Page_Load(object sender, EventArgs e)
  24. {
  25. //Authenticate();
  26. var methodName = Request.Form["MethodName"];
  27. if (!IsPostBack)
  28. {
  29. if (methodName == "ConfirmSave")
  30. {
  31. UpdateRewardAmount();
  32. }
  33. GetStatic.PrintMessage(Page);
  34. }
  35. LoadGrid();
  36. }
  37. private void LoadGrid()
  38. {
  39. grid.FilterList = new List<GridFilter>
  40. {
  41. new GridFilter("Points", "Reward Points", "LT"),
  42. // new GridFilter("is_Active","Active","T")
  43. };
  44. grid.ColumnList = new List<GridColumn>
  45. {
  46. new GridColumn("RowId", "Id", "", "T"),
  47. new GridColumn("Points", "Reward Value", "", "T"),
  48. new GridColumn("isActive", "Is Active", "", "T")
  49. };
  50. grid.GridDataSource = SwiftGrid.GridDS.RemittanceDB;
  51. grid.GridName = GridName;
  52. grid.GridType = 1;
  53. grid.ShowAddButton = true;
  54. grid.ShowFilterForm = true;
  55. grid.ShowPagingBar = true;
  56. grid.AllowEdit = false;
  57. grid.SortOrder = "ASC";
  58. grid.CustomLinkColumnHeader = "Action";
  59. grid.AddButtonTitleText = "Add New";
  60. grid.RowIdField = "RowId";
  61. grid.ThisPage = "ReferPointMasterSetup.aspx";
  62. grid.InputPerRow = 5;
  63. grid.AllowCustomLink = true;
  64. grid.AlwaysShowFilterForm = true;
  65. grid.AllowEdit = false;
  66. grid.AllowDelete = false;
  67. //grid.EditText = "<a href='Manage.aspx?RowId=@detailTitle'>" + "<img src='/images/edit.gif' border='0' alt='Edit' /></a>";
  68. //grid.AddPage = "manage.aspx?Id=" + (GetId() == 0 ? Id() : GetId()) + "";
  69. var link = "&nbsp;<a class=\"btn btn-xs btn-primary\" title=\"Edit\" onclick=\"return editAmount('@Points,@RowId')\">Edit</a>";
  70. grid.CustomLinkText = link;
  71. grid.CustomLinkVariables = "Points,RowId";
  72. string sql = "EXEC proc_InsertRewardPoints @flag = 'GET-MASTER'";
  73. DataTable gridData = new DataTable();
  74. grid.SetComma();
  75. rpt_grid.InnerHtml = grid.CreateGrid(sql);
  76. }
  77. private void Authenticate()
  78. {
  79. swiftLibrary.CheckAuthentication(ViewFunctionId);
  80. }
  81. protected void UpdateRewardAmount()
  82. {
  83. var newPts = Request.Form["rewardAmount"];
  84. var oldPts = Request.Form["oldRewardAmt"];
  85. var id = Request.Form["rowId"];
  86. DbResult _res = new DbResult();
  87. if (!string.IsNullOrEmpty(newPts))
  88. {
  89. _res = _obj.UpdateById(GetStatic.GetUser(), id, newPts, oldPts);
  90. }
  91. else
  92. {
  93. GetStatic.AlertMessage(this, "Please enter email address to update!!");
  94. }
  95. Response.ContentType = "text/plain";
  96. Response.Write(JsonConvert.SerializeObject(_res));
  97. Response.End();
  98. }
  99. }
  100. }