예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        user_identity = Request["id"] ?? string.Empty;
        rd = Request["rd"] ?? string.Empty;

        if (!IsPostBack)
        {
            if (user_identity != string.Empty)
            {
                lblUserName.Text = LoginUser.FullName;

                List<TempDepartment> departments = new List<TempDepartment>();
                foreach (Department department in LoginUser.Departments)
                {
                    foreach (string group in department.Groups)
                    {
                        TempDepartment tempDepartment = new TempDepartment();
                        tempDepartment.ID = department.ID;
                        tempDepartment.Name = department.Name;
                        tempDepartment.Group = group;
                        departments.Add(tempDepartment);
                    }
                }
                ListView1.DataSource = departments;
                ListView1.DataBind();
            }
        }
    }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        user_identity = Request["id"] ?? string.Empty;
        rd = Request["rd"] ?? string.Empty;

        if (!IsPostBack)
        {
            if (user_identity != string.Empty)
            {
                //一般User
                lblUserName.Text = LoginUser.FullName;

                List<TempDepartment> departments = new List<TempDepartment>();
                foreach (Department department in LoginUser.Departments)
                {
                    foreach (string group in department.Groups)
                    {
                        TempDepartment tempDepartment = new TempDepartment();
                        tempDepartment.ID = department.ID;
                        tempDepartment.Name = department.Name;
                        tempDepartment.Group = group;
                        departments.Add(tempDepartment);
                    }
                }
                ListView1.DataSource = departments;
                ListView1.DataBind();

                //管理端
                List<RoleUser> rus = ctx.RoleUser.Where(r => r.user_id == LoginUser.Identity).OrderBy(r => r.role_id).ToList();

                if (rus.Count != 0)
                {
                    ListView2.DataSource = rus;
                    ListView2.DataBind();
                }
                else
                {
                    lblManagerTitle.Visible = false;
                }
            }
        }
    }