Example #1
0
        public importRole()
        {
            ouLevelService   = (IOULevelService)GetObject("OULevelService");
            privilegeService = (IPrivilegeService)GetObject("PrivilegeService");
            roleService      = (IRoleService)GetObject("RoleService");

            // 级别
            IList list = ouLevelService.FindAll();

            if (list == null || list.Count == 0)
            {
                Exception e = new Exception("导入角色信息前必须先导入级别信息!");
                logger.Error(e.Message, e);
                throw e;
            }
            foreach (OULevel sys in list)
            {
                allOULevel.Add(sys.Code, sys);
            }
            privilegeList = privilegeService.FindAll();
        }
Example #2
0
        /// <summary>
        /// 绑定级别列表
        /// </summary>
        /// <param name="toBind">要绑定到的列表</param>
        /// <param name="curLevelCode">当前级别的编码</param>
        /// <param name="curLevelName">当前级别的名称</param>
        public static void BindUseDropDownList(DropDownList toBind, string curLevelCode, string curLevelName)
        {
            IList list = ouLevelService.FindAll();

            //添加空白选项
            OULevel ouLevel = new OULevel();

            ouLevel.ID   = Constants.BLANK_INT_VALUE;
            ouLevel.Unid = " ";
            ouLevel.Name = "未配置";
            ouLevel.Code = Constants.BLANK_STRING_VALUE;
            list.Insert(0, ouLevel);

            // 处理级别被删除的特例情况
            bool isIn = false;

            foreach (OULevel item in list)
            {
                if (item.Code == curLevelCode)
                {
                    isIn = true;
                    break;
                }
            }
            if (!isIn && !string.IsNullOrEmpty(curLevelCode) && !Constants.BLANK_STRING_VALUE.Equals(curLevelCode, StringComparison.OrdinalIgnoreCase))
            {
                // 创建一个已丢失的选项
                ouLevel      = new OULevel();
                ouLevel.ID   = Constants.BLANK_INT_VALUE;
                ouLevel.Unid = " ";
                ouLevel.Name = curLevelName + "[已被删除的级别]";
                ouLevel.Code = curLevelCode;
                list.Add(ouLevel);
            }

            toBind.DataSource     = list;
            toBind.DataTextField  = "Name";
            toBind.DataValueField = "Code";
            toBind.DataBind();
        }
Example #3
0
 public importOUInfo()
 {
     ouInfoService  = (IOUInfoService)GetObject("OUInfoService");
     ouLevelService = (IOULevelService)GetObject("OULevelService");
     ouLevelList    = ouLevelService.FindAll();
 }