Example #1
0
        public static SysRoles QuerySysRolesByRecordId(string recordId)
        {
            if (string.IsNullOrWhiteSpace(recordId))
            {
                throw new ArgumentNullException("recordId");
            }

            ISysRoles factory = SysRolesFactory.GetFactory();

            return(factory.QuerySysRolesByRecordId(recordId));
        }
Example #2
0
        public static bool UpdateRole(SysRoles model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            ISysRoles factory = SysRolesFactory.GetFactory();
            bool      result  = factory.UpdateRole(model);

            if (result)
            {
                model = factory.QuerySysRolesByRecordId(model.RecordID);
                if (model != null)
                {
                    OperateLogServices.AddOperateLog <SysRoles>(model, OperateType.Update);
                }
            }
            return(result);
        }
Example #3
0
        public static bool DeleteRoleByRecordId(string recordId)
        {
            if (string.IsNullOrWhiteSpace(recordId))
            {
                throw new ArgumentNullException("recordId");
            }

            ISysRoles factory = SysRolesFactory.GetFactory();
            SysRoles  model   = factory.QuerySysRolesByRecordId(recordId);

            if (model != null && model.IsDefaultRole == YesOrNo.Yes)
            {
                throw new MyException("系统默认角色不能删除");
            }

            bool result = factory.DeleteRoleByRecordId(recordId);

            if (result)
            {
                OperateLogServices.AddOperateLog(OperateType.Delete, string.Format("RecordId:{0}", recordId));
            }
            return(result);
        }