Ejemplo n.º 1
0
        private bool UpdateSecyurity()
        {
            sys_security_level sys = new sys_security_level();

            if (!string.IsNullOrEmpty(this.sys_security_level_name.Text.Trim().ToString()))
            {
                sys.name = this.sys_security_level_name.Text.Trim().ToString();
            }
            //激活
            if (this.active.Checked)
            {
                sys.is_active = 1;
            }
            else
            {
                sys.is_active = 0;
            }
            sys.id = id;
            //更新sys_security_level表
            var res = sys_security.UpdateSecurityLevel(sys, GetLoginUserId());

            if (res == ERROR_CODE.ERROR)
            {
                Response.Write("<script>alert(\"权限等级名称修改失败\");</script>");
                return(false);
            }
            if (res == ERROR_CODE.USER_NOT_FIND)               // 用户丢失
            {
                Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                Response.Redirect("Login.aspx");
            }
            return(true);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }