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.

114 lines
3.5 KiB

  1. using Swift.DAL.BL.Remit.DomesticOperation.CommissionSetup;
  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.Remit.Commission.CommissionGroupMapping
  9. {
  10. public partial class PackageAdd : System.Web.UI.Page
  11. {
  12. private string GridName = "";
  13. private const string ViewFunctionId = "20131400";
  14. private readonly SwiftGrid grid = new SwiftGrid();
  15. private readonly SwiftLibrary swiftLibrary = new SwiftLibrary();
  16. private CommGroupMappingDao _commGrp = new CommGroupMappingDao();
  17. protected void Page_Load(object sender, EventArgs e)
  18. {
  19. Authenticate();
  20. if (!IsPostBack)
  21. {
  22. GetStatic.PrintMessage(Page);
  23. }
  24. SetGrid(GetType());
  25. }
  26. private void SetGrid(string type)
  27. {
  28. if (type == "D")
  29. {
  30. GridName = "grid_DomesticPac";
  31. }
  32. if (type == "I")
  33. {
  34. GridName = "grid_InternationalPac";
  35. }
  36. LoadGrid(type);
  37. }
  38. private void LoadGrid(string type)
  39. {
  40. grid.FilterList = new List<GridFilter>
  41. {
  42. new GridFilter("detailTitle", "Code", "LT")
  43. };
  44. grid.ColumnList = new List<GridColumn>
  45. {
  46. new GridColumn("detailTitle", "Code", "", "T"),
  47. new GridColumn("detailDesc", "Description", "", "T")
  48. };
  49. grid.GridType = 1;
  50. grid.GridName = GridName;
  51. grid.ShowAddButton = false;
  52. grid.ShowFilterForm = true;
  53. grid.AlwaysShowFilterForm = false;
  54. grid.MultiSelect = true;
  55. grid.ShowCheckBox = true;
  56. grid.ShowPagingBar = true;
  57. grid.RowIdField = "valueId";
  58. grid.ThisPage = "PackageAdd.aspx";
  59. grid.GridDataSource = SwiftGrid.GridDS.RemittanceDB;
  60. grid.AllowEdit = false;
  61. grid.GridWidth = 800;
  62. string sql = "[proc_commissionPackageAdd] @flag ='grid',@type = " + grid.FilterString(type) + ",@groupId=" + grid.FilterString(GetGroupId());
  63. grid.SetComma();
  64. rpt_grid.InnerHtml = grid.CreateGrid(sql);
  65. }
  66. protected void btnAdd_Click(object sender, EventArgs e)
  67. {
  68. string rsList = grid.GetRowId(GridName);
  69. DbResult dbResult = _commGrp.AddCommissionGroup(GetStatic.GetUser(), GetGroupId(), rsList);
  70. ManageMessage(dbResult);
  71. }
  72. private string GetGroupId()
  73. {
  74. return GetStatic.ReadQueryString("groupId", "");
  75. }
  76. private string GetType()
  77. {
  78. return GetStatic.ReadQueryString("type", "");
  79. }
  80. private void Authenticate()
  81. {
  82. swiftLibrary.CheckAuthentication(ViewFunctionId);
  83. }
  84. private void ManageMessage(DbResult dbResult)
  85. {
  86. GetStatic.SetMessage(dbResult);
  87. if (dbResult.ErrorCode == "0")
  88. {
  89. Response.Redirect("CommissionGroup.aspx?groupId=" + GetGroupId());
  90. }
  91. else
  92. {
  93. GetStatic.PrintMessage(Page);
  94. //GetStatic.AlertMessageBox(Page);
  95. }
  96. }
  97. }
  98. }