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.

119 lines
4.0 KiB

  1. using Swift.DAL.BL.Remit.DomesticOperation.UserWiseTxnLimit;
  2. using Swift.DAL.SwiftDAL;
  3. using Swift.web.Library;
  4. using System;
  5. using System.Data;
  6. using System.Web.UI;
  7. namespace Swift.web.Remit.DomesticOperation.UserWiseTxnLimit
  8. {
  9. public partial class Manage : Page
  10. {
  11. private const string ViewFunctionId = "20181100";
  12. private const string AddEditFunctionId = "20181110";
  13. private readonly UserWiseTxnLimitDao obj = new UserWiseTxnLimitDao();
  14. private readonly StaticDataDdl sdd = new StaticDataDdl();
  15. protected void Page_Load(object sender, EventArgs e)
  16. {
  17. if (!IsPostBack)
  18. {
  19. Authenticate();
  20. MakeNumericTextBox();
  21. userName.Text = sdd.GetLoginUserName(GetUserId().ToString());
  22. if (GetId() > 0)
  23. {
  24. PopulateDataById();
  25. }
  26. }
  27. }
  28. private void MakeNumericTextBox()
  29. {
  30. Misc.MakeNumericTextbox(ref sendPerDay);
  31. Misc.MakeNumericTextbox(ref sendPerTxn);
  32. Misc.MakeNumericTextbox(ref payPerDay);
  33. Misc.MakeNumericTextbox(ref payPerTxn);
  34. Misc.MakeNumericTextbox(ref cancelPerDay);
  35. Misc.MakeNumericTextbox(ref cancelPerTxn);
  36. }
  37. #region Method
  38. protected string GetUserName()
  39. {
  40. return "User's Full Name : " + sdd.GetUserName(GetUserId().ToString());
  41. }
  42. private long GetId()
  43. {
  44. return GetStatic.ReadNumericDataFromQueryString("limitId");
  45. }
  46. protected long GetUserId()
  47. {
  48. return GetStatic.ReadNumericDataFromQueryString("userId");
  49. }
  50. private void Authenticate()
  51. {
  52. sdd.CheckAuthentication(ViewFunctionId + "," + AddEditFunctionId);
  53. }
  54. private void PopulateDataById()
  55. {
  56. DataRow dr = obj.SelectById(GetStatic.GetUser(), GetId().ToString());
  57. if (dr == null)
  58. return;
  59. sendPerDay.Text = GetStatic.FormatData(dr["sendPerDay"].ToString(), "M");
  60. sendPerTxn.Text = GetStatic.FormatData(dr["sendPerTxn"].ToString(), "M");
  61. sendTodays.Text = GetStatic.FormatData(dr["sendTodays"].ToString(), "M");
  62. payPerDay.Text = GetStatic.FormatData(dr["payPerDay"].ToString(), "M");
  63. payPerTxn.Text = GetStatic.FormatData(dr["payPerTxn"].ToString(), "M");
  64. payTodays.Text = GetStatic.FormatData(dr["payTodays"].ToString(), "M");
  65. cancelPerDay.Text = GetStatic.FormatData(dr["cancelPerDay"].ToString(), "M");
  66. cancelPerTxn.Text = GetStatic.FormatData(dr["cancelPerTxn"].ToString(), "M");
  67. cancelTodays.Text = GetStatic.FormatData(dr["cancelTodays"].ToString(), "M");
  68. }
  69. private void Update()
  70. {
  71. DbResult dbResult = obj.Update(GetStatic.GetUser(), GetId().ToString(), GetUserId().ToString(),
  72. sendPerDay.Text, sendPerTxn.Text, payPerDay.Text, payPerTxn.Text, cancelPerDay.Text, cancelPerTxn.Text);
  73. ManageMessage(dbResult);
  74. }
  75. private void ManageMessage(DbResult dbResult)
  76. {
  77. //GetStatic.SetMessage(dbResult);
  78. //if (dbResult.ErrorCode == "0")
  79. //{
  80. // Response.Redirect("List.aspx");
  81. //}
  82. //else
  83. //{
  84. // GetStatic.SetMessageBox(Page);
  85. //}
  86. var mes = GetStatic.ParseResultJsPrint(dbResult);
  87. mes = mes.Replace("<center>", "");
  88. mes = mes.Replace("</center>", "");
  89. var scriptName = "CallBack";
  90. var functionName = "CallBack('" + mes + "');";
  91. GetStatic.CallBackJs1(Page, scriptName, functionName);
  92. }
  93. #endregion Method
  94. #region Element Method
  95. protected void btnSave_Click(object sender, EventArgs e)
  96. {
  97. Update();
  98. }
  99. #endregion Element Method
  100. }
  101. }