示例#1
0
        private void LoadRes(string typeRes)
        {
            PrivilegeService _proxy = Common.Util.CreateProxy();

            currentResLists = new List <Neusoft.HISFC.BizLogic.Privilege.Model.Resource>();
            using (_proxy as IDisposable)
            {
                currentResLists = _proxy.QueryResourcesByType(typeRes);

                List <Neusoft.HISFC.BizLogic.Privilege.Model.Resource> list;
                list = new List <Neusoft.HISFC.BizLogic.Privilege.Model.Resource>(currentResLists);
            }

            AddPrivilegeResControl();
        }
        private void InitComboBox()
        {
            InitCmbType();
            InitCmbImage();

            if (currentRole.ParentId == "roleadmin" || currentRole.ID == "roleadmin")
            {
                PrivilegeService _proxy = Common.Util.CreateProxy();
                using (_proxy as IDisposable)
                {
                    currentResourceList = _proxy.QueryResourcesByType(pageJudge);
                }
            }
            else
            {
                currentResourceList = new List <Neusoft.HISFC.BizLogic.Privilege.Model.Resource>();
                PrivilegeService _proxy = Common.Util.CreateProxy();
                using (_proxy as IDisposable)
                {
                    IList <RoleResourceMapping> newRoleResourcelist = _proxy.QueryByTypeRoleId(pageJudge, currentRole.ParentId);
                    foreach (RoleResourceMapping newRoleResource in newRoleResourcelist)
                    {
                        if (newRoleResource.Resource != null && newRoleResource.Resource.Id != null)
                        {
                            bool Judge = true;
                            if (currentResourceList.Count == 0)
                            {
                                currentResourceList.Add(newRoleResource.Resource);
                            }
                            else
                            {
                                foreach (Neusoft.HISFC.BizLogic.Privilege.Model.Resource newRes in currentResourceList)
                                {
                                    if (newRoleResource.Resource.Id == newRes.Id)
                                    {
                                        Judge = false;
                                        break;
                                    }
                                }

                                if (Judge)
                                {
                                    currentResourceList.Add(newRoleResource.Resource);
                                }
                            }
                        }
                    }
                }
            }
            if (currentResourceList.Count != 0)
            {
                FiltrateList();
            }
            cbResource.DataSource    = currentResourceList;
            cbResource.ValueMember   = "Id";
            cbResource.SelectedIndex = -1;

            if (pageUpdate == JudgeOperate)
            {
                if (controlRoleResource.Resource.Id != null)
                {
                    cbResource.SelectedValue = controlRoleResource.Resource.Id;
                }
            }
        }