コード例 #1
0
ファイル: UserResourceBLL.cs プロジェクト: evelh/Done
        //对页面SysManage.aaspx的数据填充
        public Dictionary <string, object> GetDownList()
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("DateFormat", new d_general_dal().GetDictionary(new d_general_table_dal().GetById((int)GeneralTableEnum.DATE_DISPLAY_FORMAT)));              // 日期格式
            dic.Add("NumberFormat", new d_general_dal().GetDictionary(new d_general_table_dal().GetById((int)GeneralTableEnum.NUMBER_DISPLAY_FORMAT)));          // 数字格式
            dic.Add("TimeFormat", new d_general_dal().GetDictionary(new d_general_table_dal().GetById((int)GeneralTableEnum.TIME_DISPLAY_FORMAT)));              // 时间格式(正数)
            dic.Add("EmailType", new d_general_dal().GetDictionary(new d_general_table_dal().GetById((int)GeneralTableEnum.EMAILTYPE)));
            dic.Add("Sex", new d_general_dal().GetDictionary(new d_general_table_dal().GetById((int)GeneralTableEnum.SEX)));
            dic.Add("NameSuffix", new d_general_dal().GetDictionary(new d_general_table_dal().GetById((int)GeneralTableEnum.NAME_SUFFIX)));

            //权限
            var Security_Level = new sys_security_level_dal().FindListBySql("select id,name from sys_security_level where delete_time=0");

            dic.Add("Security_Level", Security_Level);

            //地址
            var Position = new sys_organization_location_dal().FindListBySql("select id,name from sys_organization_location where delete_time=0");

            dic.Add("Position", Position);
            // Position
            dic.Add("Outsource_Security", new d_general_dal().GetDictionary(new d_general_table_dal().GetById((int)GeneralTableEnum.OUTSOURCE_SECURITY)));
            //var location=new sys_organization_location_dal()
            //Position
            return(dic);
        }
コード例 #2
0
        public ERROR_CODE UpdateSecurityLevel(sys_security_level seclev, long user_id)
        {
            var user = UserInfoBLL.GetUserInfo(user_id);

            if (user == null)
            {   // 查询不到用户,用户丢失
                return(ERROR_CODE.USER_NOT_FIND);
            }
            var older = GetSecurityLevel(seclev.id);
            var old   = GetSecurityLevel(seclev.id);

            old.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            old.update_user_id = user_id;
            old.name           = seclev.name;
            old.is_active      = seclev.is_active;
            bool k = new sys_security_level_dal().Update(old);

            if (k == false)
            {
                return(ERROR_CODE.ERROR);
            }
            var add_account_log = new sys_oper_log()
            {
                user_cate           = "用户",
                user_id             = user.id,
                name                = user.name,
                phone               = user.mobile == null ? "" : user.mobile,
                oper_time           = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now),
                oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.SECURITY_LEVEL,
                oper_object_id      = seclev.id,// 操作对象id
                oper_type_id        = (int)OPER_LOG_TYPE.UPDATE,
                oper_description    = new sys_security_level_dal().CompareValue(old, older),
                remark              = "修改权限点关联模板"
            };                                              // 创建日志

            new sys_oper_log_dal().Insert(add_account_log); // 插入日志

            return(ERROR_CODE.SUCCESS);
        }
コード例 #3
0
        /// <summary>
        /// 复制安全等级
        /// </summary>
        /// <param name="user_id"></param>
        /// <param name="id"></param>
        /// <param name="copy_id"></param>
        /// <returns></returns>
        public bool CopySecurityLevel(long user_id, int id, out int copy_id)
        {
            var s1 = new sys_security_level_dal().FindById(id);

            copy_id = -1;
            if (s1 == null)
            {
                return(false);
            }
            sys_security_level s = new sys_security_level();

            s.id              = copy_id = (int)(_dal.GetNextIdCom());
            s.name            = "(copy of)" + s1.name;
            s.is_active       = 1;
            s.is_active       = 0;
            s.license_type_id = s1.license_type_id;
            s.create_time     = s.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            s.create_user_id  = s.update_user_id = user_id;
            ss_dal.Insert(s);
            //更新复制插入语句
            //insert into sys_security_level_limit(id,security_level_id,limit_id,limit_type_value_id)  select (select f_nextval('seq_com')),3,limit_id,limit_type_value_id from  sys_security_level_limit where security_level_id=2

            try {
                if (ssl_dal.ExecuteSQL($"insert into sys_security_level_limit(id,security_level_id,limit_id,limit_type_value_id)  select (select f_nextval('seq_com')),{copy_id},limit_id,limit_type_value_id from  sys_security_level_limit where security_level_id={id}") != 130)
                {
                    return(false);
                }
            } catch {
                return(false);
            }

            sys_security_level_module_dal ssm_dal = new sys_security_level_module_dal();

            try {
                if (ssm_dal.ExecuteSQL($"insert into `sys_security_level_module` (`id`, `security_level_id`, `module_id`, `module_limit_id`, `module_limit_value`, `module_value`) select (select f_nextval('seq_com')),{copy_id}, `module_id`, `module_limit_id`, `module_limit_value`, `module_value` from sys_security_level_module where security_level_id={id}") <= 0)
                {
                    return(false);
                }
            } catch {
                return(false);
            }

            var user = UserInfoBLL.GetUserInfo(user_id);

            if (user == null)
            {   // 查询不到用户,用户丢失
                return(false);
            }
            try {
                var add_account_log = new sys_oper_log()
                {
                    user_cate           = "用户",
                    user_id             = user.id,
                    name                = user.name,
                    phone               = user.mobile == null ? "" : user.mobile,
                    oper_time           = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now),
                    oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.SECURITY_LEVEL,
                    oper_object_id      = s.id,// 操作对象id
                    oper_type_id        = (int)OPER_LOG_TYPE.ADD,
                    oper_description    = ss_dal.AddValue(s),
                    remark              = "新增权限点关联模板"
                };                                              // 创建日志
                new sys_oper_log_dal().Insert(add_account_log); // 插入日志
            } catch {
            }

            return(true);
        }