| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace WebForm
- {
- public partial class Default : WebForm.Common.BasePage
- {
- protected int RoleLength;
- protected string DefaultRoleID;
- protected void Page_Load(object sender, EventArgs e)
- {
- string loginMsg = string.Empty;
- if (!Common.Tools.CheckLogin(out loginMsg))
- {
- Response.Redirect("Login.aspx");
- return;
- }
- #region 得到用户角色相关的信息
- RoadFlow.Platform.UsersRole buserRole = new RoadFlow.Platform.UsersRole();
- RoadFlow.Platform.Role brole = new RoadFlow.Platform.Role();
- var roles = buserRole.GetByUserID(RoadFlow.Platform.Users.CurrentUserID);
- RoleLength = roles.Count;
- DefaultRoleID = string.Empty;
- string rolesOptions = string.Empty;
- if (roles.Count > 0)
- {
- var mainRole = roles.Find(p => p.IsDefault);
- DefaultRoleID = mainRole != null ? mainRole.RoleID.ToString() : roles.First().RoleID.ToString();
- List<RoadFlow.Data.Model.Role> roleList = new List<RoadFlow.Data.Model.Role>();
- foreach (var role in roles)
- {
- var role1 = brole.Get(role.RoleID);
- if (role1 == null)
- {
- continue;
- }
- roleList.Add(role1);
- }
- rolesOptions = brole.GetRoleOptions("", "", roleList);
- }
- #endregion
- this.UserName.Text = CurrentUserName;
- this.CurrentTime.Text = RoadFlow.Utility.DateTimeNew.Now.ToDateWeekString();
- this.RoleOptions.Text = rolesOptions;
-
- }
- protected override bool CheckUrl(bool isEnd = true)
- {
- return true;
- }
- protected override bool CheckLogin(bool isRedirect = true)
- {
- return true;
- }
- }
- }
|