Beispiel #1
0
        public async Task <ObjectResultModule> YaeherRoleModuleList([FromBody] YaeherRoleModuleIn YaeherRoleModuleInfo)
        {
            if (!Commons.CheckSecret(YaeherRoleModuleInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;

            YaeherRoleModuleInfo.AndAlso(a => a.IsDelete == false);
            var values = await _yaeherRoleModuleService.YaeherRoleModuleList(YaeherRoleModuleInfo);

            YaeherModuleIn yaeherModuleIn = new YaeherModuleIn();

            yaeherModuleIn.AndAlso(a => a.IsDelete == false && a.Enabled == true);
            var ModuleList = await _yaeherModuleService.YaeherModule(yaeherModuleIn);

            var RoleAndModuleList = from Modules in ModuleList
                                    join RoleAndModule in values on Modules.Id equals RoleAndModule.ModuleId
                                    select new { Modules.Id, Modules.ParentId, Modules.Names, Modules.LinkUrls, Modules.Areas,
                                                 Modules.Controllers, Modules.Actionss, Modules.Icons, Modules.Codes, Modules.OrderSort,
                                                 Modules.Description, Modules.IsMenu,
                                                 RoleAndModule.RoleId };

            if (RoleAndModuleList.Count() == 0)
            {
                this.ObjectResultModule.StatusCode = 204;
                this.ObjectResultModule.Message    = "NoContent";
                this.ObjectResultModule.Object     = "";
            }
            else
            {
                YaeherRoleModuleJSon yaeherRoleModuleJSon = new YaeherRoleModuleJSon();
                foreach (var RoleModuls in RoleAndModuleList)
                {
                    yaeherRoleModuleJSon.ModuleId += RoleModuls.Id + ",";
                    yaeherRoleModuleJSon.RoleId    = RoleModuls.RoleId;
                }
                this.ObjectResultModule.Object     = yaeherRoleModuleJSon;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "YaeherRoleModuleList",
                OperContent = JsonHelper.ToJson(YaeherRoleModuleInfo),
                OperType    = "YaeherRoleModuleList",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(ObjectResultModule);
        }
Beispiel #2
0
        public async Task <ObjectResultModule> YaeherModuleUpperList([FromBody] YaeherModuleIn YaeherModuleInfo)
        {
            if (!Commons.CheckSecret(YaeherModuleInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;

            YaeherModuleInfo.AndAlso(a => a.IsDelete == false);
            YaeherModuleInfo.AndAlso(a => a.Enabled == true);
            var values = await _yaeherModuleService.YaeherModuleList(YaeherModuleInfo);

            if (values.Count == 0)
            {
                this.ObjectResultModule.StatusCode = 204;
                this.ObjectResultModule.Message    = "NoContent";
                this.ObjectResultModule.Object     = "";
            }
            else
            {
                this.ObjectResultModule.Object     = values;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "YaeherModuleUpperList",
                OperContent = JsonHelper.ToJson(YaeherModuleInfo),
                OperType    = "YaeherModuleUpperList",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(ObjectResultModule);
        }
Beispiel #3
0
        public async Task <ObjectResultModule> YaeherModuleList([FromBody] YaeherModuleIn YaeherModuleInfo)
        {
            if (!Commons.CheckSecret(YaeherModuleInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var      userid    = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            DateTime StartTime = new DateTime();
            DateTime EndTime   = new DateTime();

            if (!string.IsNullOrEmpty(YaeherModuleInfo.StartTime))
            {
                StartTime = DateTime.Parse(YaeherModuleInfo.StartTime);
                if (string.IsNullOrEmpty(YaeherModuleInfo.EndTime))
                {
                    YaeherModuleInfo.EndTime = DateTime.Now.ToString("yyyy-MM-dd");
                }
            }
            if (!string.IsNullOrEmpty(YaeherModuleInfo.EndTime))
            {
                EndTime = DateTime.Parse(YaeherModuleInfo.EndTime);
            }
            if (!string.IsNullOrEmpty(YaeherModuleInfo.StartTime))
            {
                YaeherModuleInfo.AndAlso(t => t.CreatedOn >= StartTime);
                YaeherModuleInfo.AndAlso(t => t.CreatedOn < EndTime.AddDays(+1));
            }
            if (!string.IsNullOrEmpty(YaeherModuleInfo.KeyWord))
            {
                YaeherModuleInfo.AndAlso(t => t.Names.Contains(YaeherModuleInfo.KeyWord) ||
                                         t.Actionss.Contains(YaeherModuleInfo.KeyWord) ||
                                         t.Areas.Contains(YaeherModuleInfo.KeyWord) ||
                                         t.Codes.Contains(YaeherModuleInfo.KeyWord));
            }
            if (!string.IsNullOrEmpty(YaeherModuleInfo.Enabled))
            {
                YaeherModuleInfo.AndAlso(t => t.Enabled == bool.Parse(YaeherModuleInfo.Enabled));
            }
            YaeherModuleInfo.AndAlso(a => a.IsDelete == false);
            var values = await _yaeherModuleService.YaeherModuleList(YaeherModuleInfo);

            if (values.Count == 0)
            {
                this.ObjectResultModule.StatusCode = 204;
                this.ObjectResultModule.Message    = "NoContent";
                this.ObjectResultModule.Object     = "";
            }
            else
            {
                this.ObjectResultModule.Object     = values;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "YaeherModuleList",
                OperContent = JsonHelper.ToJson(YaeherModuleInfo),
                OperType    = "YaeherModuleList",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(ObjectResultModule);
        }
Beispiel #4
0
        public async Task <ObjectResultModule> CreateYaeherModule([FromBody] Yaeher.YaeherAuth.Dto.YaeherModuleNode YaeherModuleInfo)
        {
            if (!Commons.CheckSecret(YaeherModuleInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var            userid         = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            YaeherModuleIn yaeherModuleIn = new YaeherModuleIn();

            yaeherModuleIn.AndAlso(a => a.IsDelete == false);
            yaeherModuleIn.AndAlso(a => a.LinkUrls == YaeherModuleInfo.LinkUrls);
            yaeherModuleIn.AndAlso(a => a.Names == YaeherModuleInfo.Names);
            yaeherModuleIn.AndAlso(a => a.Codes == YaeherModuleInfo.Codes);
            yaeherModuleIn.AndAlso(a => a.ParentId == YaeherModuleInfo.ParentId);
            yaeherModuleIn.AndAlso(a => a.Areas == YaeherModuleInfo.Areas);
            yaeherModuleIn.AndAlso(a => a.Controllers == YaeherModuleInfo.Controllers);
            yaeherModuleIn.AndAlso(a => a.IsMenu == YaeherModuleInfo.IsMenu);
            var ModuleList = await _yaeherModuleService.YaeherModule(yaeherModuleIn);

            if (ModuleList.Count() > 0)
            {
                this.ObjectResultModule.Object     = "";
                this.ObjectResultModule.StatusCode = 100;
                this.ObjectResultModule.Message    = "菜单已存在不可新增!";
                return(ObjectResultModule);
            }
            var CreateYaeherModule = new YaeherModule()
            {
                ParentId    = YaeherModuleInfo.ParentId,
                Names       = YaeherModuleInfo.Names,
                LinkUrls    = YaeherModuleInfo.LinkUrls,
                Areas       = YaeherModuleInfo.Areas,
                Controllers = YaeherModuleInfo.Controllers,
                Actionss    = YaeherModuleInfo.Actionss,
                Icons       = YaeherModuleInfo.Icons,
                Codes       = YaeherModuleInfo.Codes,
                OrderSort   = YaeherModuleInfo.OrderSort,
                Description = YaeherModuleInfo.Description,
                IsMenu      = YaeherModuleInfo.IsMenu,
                Enabled     = YaeherModuleInfo.Enabled,
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var result = await _yaeherModuleService.CreateYaeherModule(CreateYaeherModule);

            if (result.Id > 0)
            {
                this.ObjectResultModule.Object     = result;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            else
            {
                this.ObjectResultModule.Object     = "";
                this.ObjectResultModule.StatusCode = 400;
                this.ObjectResultModule.Message    = "error!";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "CreateYaeherModule",
                OperContent = JsonHelper.ToJson(YaeherModuleInfo),
                OperType    = "CreateYaeherModule",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(ObjectResultModule);
        }