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.

85 lines
2.7 KiB

4 years ago
  1. using Common.Helper;
  2. using Repository.DAO;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.UI.WebControls;
  9. namespace JMEAgentSystem.Library.Remittance
  10. {
  11. public class RemittanceLibrary : RemittanceDao
  12. {
  13. public bool CheckAuthentication(string functionId)
  14. {
  15. CheckSession();
  16. if (!HasRight(functionId))
  17. {
  18. HttpContext.Current.Response.Redirect(GetStatic.GetAuthenticationPage());
  19. }
  20. return true;
  21. }
  22. public void CheckSession()
  23. {
  24. //var user = GetStatic.GetUser();
  25. //if (string.IsNullOrWhiteSpace(user))
  26. //{
  27. // HttpContext.Current.Response.Redirect(GetStatic.GetLogoutPage());
  28. //}
  29. //UserPool userPool = UserPool.GetInstance();
  30. //var loggedUser = GetStatic.GetLoggedInUser();
  31. //if (string.IsNullOrWhiteSpace(loggedUser.UserName))
  32. //{
  33. // HttpContext.Current.Response.Redirect(GetStatic.GetLogoutPage());
  34. //}
  35. //if (!userPool.IsUserExists(GetStatic.GetUser()))
  36. //{
  37. // HttpContext.Current.Response.Redirect(GetStatic.GetLogoutPage());
  38. //}
  39. }
  40. public bool HasRight(string functionId)
  41. {
  42. //var applicationUserDao = new ApplicationUserDao();
  43. //return applicationUserDao.HasRight(functionId, GetStatic.GetUser());
  44. return true;
  45. }
  46. public void SetDDL(ref DropDownList ddl, string sql, string valueField, string textField, string valueToBeSelected, string label)
  47. {
  48. var ds = ExecuteDataset(sql);
  49. ListItem item = null;
  50. if (ds.Tables.Count == 0)
  51. {
  52. if (label != "")
  53. {
  54. item = new ListItem(label, "");
  55. ddl.Items.Add(item);
  56. }
  57. return;
  58. }
  59. var dt = ds.Tables[0];
  60. ddl.Items.Clear();
  61. if (label != "")
  62. {
  63. item = new ListItem(label, "");
  64. ddl.Items.Add(item);
  65. }
  66. foreach (DataRow row in dt.Rows)
  67. {
  68. item = new ListItem();
  69. item.Value = row[valueField].ToString();
  70. item.Text = row[textField].ToString();
  71. if (row[valueField].ToString().ToUpper() == valueToBeSelected.ToUpper())
  72. item.Selected = true;
  73. ddl.Items.Add(item);
  74. }
  75. }
  76. }
  77. }