RoadFlow2.1 临时演示

Default.aspx.cs 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. namespace WebForm
  8. {
  9. public partial class Default : WebForm.Common.BasePage
  10. {
  11. protected int RoleLength;
  12. protected string DefaultRoleID;
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. string loginMsg = string.Empty;
  16. if (!Common.Tools.CheckLogin(out loginMsg))
  17. {
  18. Response.Redirect("Login.aspx");
  19. return;
  20. }
  21. #region 得到用户角色相关的信息
  22. RoadFlow.Platform.UsersRole buserRole = new RoadFlow.Platform.UsersRole();
  23. RoadFlow.Platform.Role brole = new RoadFlow.Platform.Role();
  24. var roles = buserRole.GetByUserID(RoadFlow.Platform.Users.CurrentUserID);
  25. RoleLength = roles.Count;
  26. DefaultRoleID = string.Empty;
  27. string rolesOptions = string.Empty;
  28. if (roles.Count > 0)
  29. {
  30. var mainRole = roles.Find(p => p.IsDefault);
  31. DefaultRoleID = mainRole != null ? mainRole.RoleID.ToString() : roles.First().RoleID.ToString();
  32. List<RoadFlow.Data.Model.Role> roleList = new List<RoadFlow.Data.Model.Role>();
  33. foreach (var role in roles)
  34. {
  35. var role1 = brole.Get(role.RoleID);
  36. if (role1 == null)
  37. {
  38. continue;
  39. }
  40. roleList.Add(role1);
  41. }
  42. rolesOptions = brole.GetRoleOptions("", "", roleList);
  43. }
  44. #endregion
  45. this.UserName.Text = CurrentUserName;
  46. this.CurrentTime.Text = RoadFlow.Utility.DateTimeNew.Now.ToDateWeekString();
  47. this.RoleOptions.Text = rolesOptions;
  48. }
  49. protected override bool CheckUrl(bool isEnd = true)
  50. {
  51. return true;
  52. }
  53. protected override bool CheckLogin(bool isRedirect = true)
  54. {
  55. return true;
  56. }
  57. }
  58. }