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.

97 lines
3.0 KiB

  1. using System;
  2. using Swift.DAL.BL.System.GeneralSettings;
  3. using Swift.web.Library;
  4. using System.Data;
  5. using Swift.DAL.SwiftDAL;
  6. namespace Swift.web.SwiftSystem.GeneralSetting.MessageSetting
  7. {
  8. public partial class ManageMessageBroadCast : System.Web.UI.Page
  9. {
  10. private const string ViewFunctionId = "10111100";
  11. private const string AddEditFunctionId = "10111110";
  12. readonly MessageBroadCastDao mbcd = new MessageBroadCastDao();
  13. private readonly RemittanceLibrary _sl = new RemittanceLibrary();
  14. protected void Page_Load(object sender, EventArgs e)
  15. {
  16. if (!IsPostBack)
  17. {
  18. Authenticate();
  19. if (GetId() > 0)
  20. {
  21. PopulateDataById();
  22. }
  23. else
  24. {
  25. PopulateDdl(null);
  26. }
  27. }
  28. }
  29. #region Method
  30. protected long GetId()
  31. {
  32. return GetStatic.ReadNumericDataFromQueryString("msgBroadCastId");
  33. }
  34. private void PopulateDdl(DataRow dr)
  35. {
  36. var _sdd = new StaticDataDdl();
  37. _sdd.SetStaticDdlTitle(ref userType, "7300", GetStatic.GetRowData(dr, "userType"), "All");
  38. }
  39. private void Authenticate()
  40. {
  41. _sl.CheckAuthentication(ViewFunctionId + "," + AddEditFunctionId);
  42. }
  43. private void PopulateDataById()
  44. {
  45. DataRow dr = mbcd.SelectById(GetStatic.GetUser(), GetId().ToString());
  46. if (dr == null)
  47. return;
  48. country.Text = dr["countryName"].ToString();
  49. country.Value = dr["countryId"].ToString();
  50. agent.Text = dr["agentName"].ToString();
  51. agent.Value = dr["agentId"].ToString();
  52. branch.Text = dr["branchName"].ToString();
  53. branch.Value = dr["branchId"].ToString();
  54. isActive.Text = dr["isActive"].ToString();
  55. msgTitle.Text = dr["msgTitle"].ToString();
  56. msgDetail.Text = dr["msgDetail"].ToString();
  57. PopulateDdl(dr);
  58. }
  59. protected void Update()
  60. {
  61. DbResult dbResult = mbcd.Update(country.Value, agent.Value, msgDetail.Text ,branch.Value,
  62. isActive.Text, msgTitle.Text, GetStatic.GetUser(), GetId().ToString(),userType.Text);
  63. ManageMessage(dbResult);
  64. }
  65. protected void ManageMessage(DbResult dbResult)
  66. {
  67. GetStatic.SetMessage(dbResult);
  68. if (dbResult.ErrorCode == "0")
  69. {
  70. Response.Redirect("ListMessageBroadCast.aspx");
  71. }
  72. else
  73. GetStatic.PrintMessage(Page, dbResult);
  74. }
  75. #endregion
  76. #region Element Method
  77. protected void btnBack_Click(object sender, EventArgs e)
  78. {
  79. Response.Redirect("ListMessageBroadCast.aspx");
  80. }
  81. protected void btnClick_Save(object sender, EventArgs e)
  82. {
  83. Update();
  84. }
  85. #endregion
  86. }
  87. }