Beispiel #1
0
 public override void InitDataPage()
 {
     UserTypeCID.Items.Clear();
     UserTypeCID.Items.Add(new ListItem("--全部--", ""));
     foreach (Sys_UserType objSys_UserType in objUserRule.Sys_UserType.Where(s => UserTypeList.Contains(s.UserTypeID)))
     {
         UserTypeCID.Items.Add(new ListItem(objSys_UserType.UserTypeName, objSys_UserType.UserTypeID.ToString()));
     }
 }
Beispiel #2
0
    public override void InitDataPage()
    {
        dropUserTypeCID.Items.Clear();

        foreach (Sys_UserType objSys_UserType in objUserRule.Sys_UserType.Where(s => UserTypeList.Contains(s.UserTypeID)))
        {
            dropUserTypeCID.Items.Add(new ListItem(objSys_UserType.UserTypeName, objSys_UserType.UserTypeID.ToString()));
        }
        List <string>   objAuthorizeGroupIDList = objUserRule.sys_authorizegroup.Where(s => s.ModuleTypeID == ModuleTypeID).Select(s => s.AuthorizeGroupID).ToList();
        List <Sys_Role> objSys_RoleList         = objUserRule.Sys_Role.Where(s => objAuthorizeGroupIDList.Contains(s.AuthorizeGroupID) && s.IsSystem == false && s.IsUserRole == false).ToList();

        if (UserID.IsNoNull())
        {
            List <string> RoleIDList = objUserRule.Sys_RoleUser.Where(s => s.UserID == UserID).Select(s => s.RoleID).ToList();
            if (RoleIDList.Count > 0)
            {
                foreach (Sys_Role objSys_Role in objSys_RoleList.Where(s => RoleIDList.Contains(s.RoleID)).OrderByDescending(s => s.CreateDate))
                {
                    chkRoleList.Items.Add(new ListItem()
                    {
                        Text = objSys_Role.RoleName, Value = objSys_Role.RoleID, Selected = true
                    });
                }
                foreach (Sys_Role objSys_Role in objSys_RoleList.Where(s => !RoleIDList.Contains(s.RoleID)).OrderByDescending(s => s.CreateDate))
                {
                    chkRoleList.Items.Add(new ListItem()
                    {
                        Text = objSys_Role.RoleName, Value = objSys_Role.RoleID
                    });
                }
            }
            else
            {
                foreach (Sys_Role objSys_Role in objSys_RoleList)
                {
                    chkRoleList.Items.Add(new ListItem()
                    {
                        Text = objSys_Role.RoleName, Value = objSys_Role.RoleID
                    });
                }
            }
        }
        else
        {
            foreach (Sys_Role objSys_Role in objSys_RoleList)
            {
                chkRoleList.Items.Add(new ListItem()
                {
                    Text = objSys_Role.RoleName, Value = objSys_Role.RoleID
                });
            }
        }
    }