コード例 #1
0
        /// <summary>
        /// 加载产品权限
        /// </summary>
        private void BindSofts()
        {
            URBasicInfoService   biService      = new URBasicInfoService();
            URRightsService      rightService   = new URRightsService();
            List <Soft>          softs          = biService.GetSofts();
            List <ProjectSource> projectSources = biService.GetProjectSources();
            List <RightItem>     selectedSofts  = UserID > 0
                ? rightService.GetUserSoftRights(UserID)
                : rightService.GetRoleSoftRights(RoleID);
            List <RightItem> selectedProjectSources = UserID > 0
                ? rightService.GetUserProjectSourceRights(UserID)
                : rightService.GetRoleProjectSourceRights(RoleID);
            List <RightItem> resIds = new List <RightItem>();

            //产品管理员不能设置资源查看权限
            if (loginService.LoginUser.AccountType != UserTypeOptions.ProductAdmin && UserID > 0)
            {
                resIds = rightService.GetUserResRights(UserID);
            }

            softs.ForEach(soft =>
            {
                var item      = new ListItem("[" + soft.OutID.ToString().PadLeft(6, '0') + "]" + soft.Name, soft.ID.ToString());
                RightItem ri  = selectedSofts.FirstOrDefault(f => f.RightID == soft.ID);
                item.Selected = ri != null;
                item.Enabled  = ri == null || !ri.FromRole;
                item.Attributes.Add("stype", soft.SoftType.ToString());
                item.Attributes.Add("intype", "checkbox");
                if (soft.SoftType == SoftTypeOptions.InternalSoft || soft.SoftType == SoftTypeOptions.MultiSofts)
                {
                    cbkListSoft.Items.Add(item);
                }
                else
                {
                    cbkListSoftout.Items.Add(item);
                }
            });
            if (resIds.Count > 0)
            {
                txtResIdList.Text = string.Join(", ", resIds.Select(a => a.RightID.ToString()).ToArray());
            }
            projectSources.ForEach(projectSource =>
            {
                var item      = new ListItem("[" + projectSource.ProjectSourceID + "]" + projectSource.Name, projectSource.ProjectSourceID.ToString());
                RightItem ri  = selectedProjectSources.FirstOrDefault(f => f.RightID == projectSource.ProjectSourceID);
                item.Selected = ri != null;
                item.Enabled  = ri == null || !ri.FromRole;
                item.Attributes.Add("intype", "checkbox");
                cbkProjectSource.Items.Add(item);
            });
        }
コード例 #2
0
        protected void MyData_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            int PageSize  = this.pagecut.PageSize;
            int IndexSize = Convert.ToInt32(e.Parameters["start"]);

            if (IndexSize == -1)
            {
                IndexSize = 0;
            }
            int         pageIndex   = IndexSize / PageSize + 1;
            int         recordCount = 0;
            List <Soft> list        = biService.GetSofts((SoftTypeOptions)Convert.ToInt32(SelectSoftType.SelectedItem.Value), txtsoftName.Text, pageIndex, PageSize, ref recordCount);

            Store3.DataSource = list;
            Store3.DataBind();
            (Store3.Proxy[0] as PageProxy).Total = recordCount;
        }