示例#1
0
        public ActionResult Add(MenuDto data)
        {
            using (var db = SessionProvider.CreateSession())
            {
                data.Category = shared.CategoryEnum.Menu;

                var newgrid = db.Session.Menu.Add(data);
                return new JSONNetResult(newgrid);
            }
        }
示例#2
0
 public ResponseModel Update([FromBody] MenuDto model, int menuId)
 {
     menuService.Update(model);
     return(new ResponseModel());
 }
示例#3
0
 public IActionResult Form(MenuDto model)
 {
     _menuService.Data = model;
     return(SuccessJsonResult());
 }
示例#4
0
 public virtual void Updatemenu(MenuDto menu)
 {
     Domain.Menu model = AutoMapper.Mapper.Map <Domain.Menu>(menu);
     _MenuRepository.Update(model);
 }
        public bool InsertOrUpdate(MenuDto dto)
        {
            var menu = _menuRepository.InsertOrUpdate(Mapper.Map <Menu>(dto));

            return(menu == null ? false : true);
        }
示例#6
0
 public override MenuDto Add(MenuDto newitem)
 {
     throw new NotImplementedException();
 }
        public ActionResult TodayOrders()
        {
            var model = new ReservationModels.TodayOrdersDto();

            IViewerFactory <OrderView> factory = new OrderViewFactory();

            var list = factory.Query(new Criteria(new
            {
                MenuDate = DateTime.Today,
                MenuType = (int)MenuDto.GetMenuLunchOrSupper(0, false)
            }));

            if (list != null && list.Count > 0)
            {
                var mapper = OrderDto.ConfigMapper().CreateMapper();

                model.Orders = mapper.Map <IEnumerable <OrderDto> >(list.AsEnumerable()).ToList();
            }

            model.DeliveryZones = Delivery.Cache.DeliveryZoneList;

            // 判断当前时间是否可进行大班长确认过
            model.CanApprovedNow = MenuDto.GetMenuLunchOrSupper().Equals(MenuTypeEnum.None);

            // 查找今日的菜单,判断是否大班长确认过
            var currentMenus = Menu.Cache.MenuListActiveToday.FindAll(x =>
                                                                      x.MenuType.Equals(MenuDto.GetMenuLunchOrSupper(0, false)));

            model.IsMenuApproved = currentMenus.Exists(x => x.IsApproved);

            model.ApproverInfo = model.IsMenuApproved ? currentMenus[0].Remark : string.Empty;

            return(View(model));
        }
 public ContentResult Add(MenuDto dto)
 {
     _menuService.AddMenu(dto);
     return(ResultSuccess <string>("添加成功"));
 }
示例#9
0
 public int Save(MenuDto menu)
 {
     _service.AddNew(menu);
     return(menu.id);
 }
示例#10
0
        private IEnumerable <Right_Privilege> GetChildPermissions(List <MenuDto> list, MenuDto item, Role currRole)
        {
            List <Right_Privilege> privileges = new List <Right_Privilege>();
            var query = list.Where(a => a.ParentId == item.ID).OrderBy(a => a.SerialNumber);

            foreach (var child in query)
            {
                Right_Privilege dtopil = new Right_Privilege()
                {
                    cateName = child.Name,
                    cateId   = child.ID,
                    catePid  = child.ID
                };
                dtopil.cateQuanxian = new List <Right_Control>()
                {
                    new Right_Control()
                    {
                        quanxian   = "查看",
                        quanxianid = child.ID,
                        state      = 0
                    }
                };
                if (currRole != null && currRole.RoleMenus.Any(a => a.MenuId.Equals(child.ID)))
                {
                    dtopil.cateQuanxian[0].state = 1;
                }
                dtopil.childCateList = new List <Right_Privilege>();
                if (child.Type == 1)
                {
                    dtopil.childCateList.AddRange(GetChildPermissions(list, child, currRole));
                }
                dtopil.cateQuanxian.AddRange(GetChildMenus(list, child, currRole));
                privileges.Add(dtopil);
            }
            return(privileges);
        }
示例#11
0
        public async Task <IActionResult> Save(MenuDto model)
        {
            await service.SaveAsync(model);

            return(JsonData(model));
        }
示例#12
0
 public UpdateMenuCommand(MenuDto menu)
 {
     Menu = menu;
 }
        /// <summary>
        /// 删除菜单
        /// </summary>
        /// <param name="dto">传入菜单信息</param>
        public void DeleteMenu(MenuDto dto)
        {
            Menu entity = _menuRepository.Get(SafeConvert.ToInt64(dto.Id));

            _menuRepository.Delete(entity);
        }
        /// <summary>
        /// 添加菜单
        /// </summary>
        /// <param name="dto">传入菜单信息</param>
        public void AddMenu(MenuDto dto)
        {
            Menu entity = dto.ToEntity <Menu>();

            _menuRepository.Add(entity);
        }
示例#15
0
 public void Modify(MenuDto menu)
 {
     _service.Modify(menu);
 }
示例#16
0
 public menu_update_insertupdate_rpc(string exchangeName, MenuDto dto)
 {
     base.MessageBodyByte = ByteConvertHelper.Object2Bytes(dto);
     base.exchangeName    = exchangeName;
     base.MessageRouter   = this.GetType().Name;
 }
        public async Task <string> GetUserRightAsync()
        {
            //获取当前用户的角色
            var user = await _userManager.GetUserAsync(HttpContext.User);

            //获取当前用户的 角色
            var roles = await _iTUserRepository.GetUserRolesAsync(Guid.Parse("A0C2A91A-AB72-4FC2-9CF6-13332A499F6C"));

            if (roles == null || roles.Count <= 0)
            {
                return(ApiRequestResult.Error("用户暂无任何菜单权限").ToString());
            }
            //获取角色菜单
            var userRights = new List <TRight>();

            foreach (var item in roles)
            {
                var roleRights = await _iTRoleRepository.GetRoleRightsAsync(item.RoleId);

                if (roleRights == null || roleRights.Count <= 0)
                {
                    continue;
                }
                foreach (var roleRight in roleRights)
                {
                    var right = await _iTRightRepository.GetAsync(c => c.Id == roleRight.RightId);

                    userRights.Add(right);
                }
            }

            var list = userRights.Distinct(new RightComparer());

            //父菜单
            var parents   = list.Where(c => c.ParentId == null);
            var rightDtos = new List <MenuDto>();

            foreach (var parent in parents)
            {
                var rightDto = new MenuDto
                {
                    //Id = parent.Id,
                    Icon  = parent.RightIcon,
                    Name  = parent.RightName,
                    Title = parent.RightName,
                    Jump  = parent.RightUrl,
                };
                //获取子菜单
                var subRights = list.Where(c => c.ParentId == parent.Id).Select(c =>
                                                                                new MenuDto
                {
                    //Id = c.Id,
                    Icon  = c.RightIcon,
                    Name  = c.RightName,
                    Title = c.RightName,
                    Jump  = c.RightUrl,
                }).ToList();
                rightDto.List = subRights;
                rightDtos.Add(rightDto);
            }
            return(JsonConvert.SerializeObject(
                       new MenuResult()
            {
                Code = 0,
                Msg = "",
                Data = rightDtos
            }
                       ));
        }
示例#18
0
 public ContentResult Modify(MenuDto dto)
 {
     _menuService.ModifyMenu(dto);
     return(ResultSuccess <string>("修改成功"));
 }
示例#19
0
 public int Save(MenuDto menu)
 {
     _srvMenu.AddNew(menu);
     return(menu.id);
 }
        // GET: Reservation

        public ActionResult Index()
        {
            var model = new ReservationModels.IndexDto();

            var menuType = MenuDto.GetMenuLunchOrSupper();

            var menuA = Menu.Cache.MenuListActiveToday.Find(x =>
                                                            x.MenuType == menuType && x.MenuFlag == "A");
            var menuB = Menu.Cache.MenuListActiveToday.Find(x =>
                                                            x.MenuType == menuType && x.MenuFlag == "B");

            var mapper = MenuDto.ConfigMapper().CreateMapper();

            if (menuA != null)
            {
                model.MenuA = mapper.Map <MenuDto>(menuA);
            }

            if (menuB != null)
            {
                model.MenuB = mapper.Map <MenuDto>(menuB);
            }

            // 可以订餐,无相关订餐历史记录
            if (menuA != null && menuB != null && CanReserveNow(new[] { menuA.ID, menuB.ID }))
            {
                model.MenuDate      = DateTime.Today;
                model.DeliveryZones = Delivery.Cache.DeliveryZoneList;

                // 设置当前用户的默认送餐区域,先判断用户的职务,再判断用户的班组
                if (_authorizedUser != null)
                {
                    var rela = _repo.Single <RelationTeamPositionDelivery>(x => x.Position == _authorizedUser.Position) ??
                               _repo.Single <RelationTeamPositionDelivery>(x => x.Team == _authorizedUser.Team);

                    if (rela != null)
                    {
                        model.MyDefaultDeliveryZone = Delivery.Cache.Load(rela.DeliveryGuid);
                    }
                }

                if (menuType.Equals(MenuTypeEnum.Lunch))
                {
                    model.MenuStyle = "green";
                }
                else if (menuType.Equals(MenuTypeEnum.Supper))
                {
                    model.MenuStyle = "purple";
                }

                model.CanReserveNow = true;
            }
            else
            {
                model.CanReserveNow = false;
            }

            // 获取今天最新订餐记录
            if (menuA != null && menuB != null)
            {
                model.MyCurrentOrder = GetMyCurrentOrder(new[] { menuA.ID, menuB.ID });
            }

            return(View(model));
        }
示例#21
0
 public void Modify(MenuDto menu)
 {
     _srvMenu.Modify(menu);
 }
示例#22
0
        public async Task <MenusDto> Get(Param parameters)
        {
            PagedList <MenuDto> menuDtos = new PagedList <MenuDto>();

            var queryable = _unitOfWork.Menu.GetAll()
                            .Where(x => x.IsVisible == true);

            switch (parameters.SearchBy.ToLower())
            {
            case "description":
                queryable = queryable.Where(x => x.Title.Contains(parameters.SearchText));
                break;
            }

            switch (parameters.SortBy.ToLower())
            {
            case "description":
                switch (parameters.SortDirection.ToLower())
                {
                case "desc":
                    queryable = queryable.OrderByDescending(x => x.Title);
                    break;

                case "asc":
                    queryable = queryable.OrderBy(x => x.Title);
                    break;

                default:
                    queryable = queryable.OrderByDescending(x => x.CreatedDate);
                    break;
                }
                break;

            case "createddate":
                switch (parameters.SortDirection.ToLower())
                {
                case "desc":
                    queryable = queryable.OrderByDescending(x => x.CreatedDate);
                    break;

                case "asc":
                    queryable = queryable.OrderBy(x => x.CreatedDate);
                    break;

                default:
                    queryable = queryable.OrderByDescending(x => x.CreatedDate);
                    break;
                }
                break;
            }

            var pagedMenus = await PagedList <Menu> .CreateAsync(queryable, parameters.PageNumber, parameters.PageSize);

            if (pagedMenus != null)
            {
                foreach (var Menu in pagedMenus)
                {
                    MenuDto dto = _mapper.Map <MenuDto>(Menu);
                    menuDtos.Add(dto);
                }
            }

            MenusDto menus = new MenusDto();

            menus.Menus       = menuDtos;
            menus.CurrentPage = pagedMenus.CurrentPage;
            menus.PageSize    = pagedMenus.PageSize;
            menus.TotalCount  = pagedMenus.TotalCount;
            menus.TotalPages  = pagedMenus.TotalPages;
            return(menus);
        }
示例#23
0
 //中间数据保存(创建时间和创建人)
 private void GenerateTempDatas(ref MenuDto menuDto)
 {
     temp.CreateTime = menuDto.CreateTime;
     temp.CreateUser = menuDto.CreateUser;
 }
示例#24
0
 public virtual void Addmenu(MenuDto menu)
 {
     Domain.Menu model = AutoMapper.Mapper.Map <Domain.Menu>(menu);
     _MenuRepository.Insert(model);
 }
        public ActionResult Index()
        {
            var model = new ConsoleModels.IndexDto();

            IViewerFactory <ReportView> factory = new ReportViewFactory();

            var list = factory.Query(new Criteria(new
            {
                MenuDate = DateTime.Today,
                MenuType = (int)MenuDto.GetMenuLunchOrSupper(0, false)
            }));

            if (list != null && list.Count > 0)
            {
                var mapper = ReportDto.ConfigMapper().CreateMapper();

                model.Reports = mapper.Map <IEnumerable <ReportDto> >(list.AsEnumerable()).ToList();

                // 查找今日的菜单,判断是否大班长确认过
                var currentMenus = Menu.Cache.MenuListActiveToday.FindAll(x =>
                                                                          x.MenuType.Equals(MenuDto.GetMenuLunchOrSupper(0, false)));

                model.ApproverInfo = currentMenus.Exists(x => x.IsApproved) ?
                                     currentMenus[0].Remark : string.Empty;
            }

            return(View(model));
        }
示例#26
0
        public async Task <MenusDto> Get(Param parameters)
        {
            PagedList <MenuDto> menuDtos = new PagedList <MenuDto>();

            var queryable = _unitOfWork.Menu.GetAll()
                            .Where(x => x.IsVisible == true);

            switch (parameters.SearchBy.ToLower())
            {
            case "description":
                queryable = queryable.Where(x => x.Title.Contains(parameters.SearchText));
                break;
            }

            switch (parameters.SortBy.ToLower())
            {
            case "description":
                switch (parameters.SortDirection.ToLower())
                {
                case "desc":
                    queryable = queryable.OrderByDescending(x => x.Title);
                    break;

                case "asc":
                    queryable = queryable.OrderBy(x => x.Title);
                    break;

                default:
                    queryable = queryable.OrderByDescending(x => x.CreatedDate);
                    break;
                }
                break;

            case "createddate":
                switch (parameters.SortDirection.ToLower())
                {
                case "desc":
                    queryable = queryable.OrderByDescending(x => x.CreatedDate);
                    break;

                case "asc":
                    queryable = queryable.OrderBy(x => x.CreatedDate);
                    break;

                default:
                    queryable = queryable.OrderByDescending(x => x.CreatedDate);
                    break;
                }
                break;
            }

            var pagedMenus = await PagedList <Menu> .CreateAsync(queryable, parameters.PageNumber, parameters.PageSize);

            if (pagedMenus != null)
            {
                foreach (var menu in pagedMenus)
                {
                    MenuDto dto = _mapper.Map <MenuDto>(menu);

                    if (!string.IsNullOrEmpty(menu.UserRoles))
                    {
                        var userRoleList = menu.UserRoles.Split(',').Select(int.Parse).ToList();
                        foreach (var item in userRoleList)
                        {
                            var role = await _unitOfWork.Role.Get(item);

                            dto.Roles.Add(_mapper.Map <RoleDto>(role));
                        }
                        ;
                    }

                    if (menu.MainMenuId > 0)
                    {
                        var mainMenu = await _unitOfWork.Menu.Get(menu.MainMenuId);

                        dto.MainMenuName = mainMenu.Title;
                    }

                    menuDtos.Add(dto);
                }
            }

            MenusDto menus = new MenusDto();

            menus.Menus       = menuDtos;
            menus.CurrentPage = pagedMenus.CurrentPage;
            menus.PageSize    = pagedMenus.PageSize;
            menus.TotalCount  = pagedMenus.TotalCount;
            menus.TotalPages  = pagedMenus.TotalPages;
            return(menus);
        }
示例#27
0
 /// <summary>
 /// 检查校验Save对象
 /// </summary>
 /// <param name="dto">Dto 对象</param>
 /// <returns></returns>
 private void CheckMenu(MenuDto dto)
 {
 }
 public async Task <ApiResponse> Add([FromBody] MenuDto param) =>
 await manager.Add(param);
示例#29
0
 public Service.Products.Model.Menu CreateUpdate(MenuDto model)
 {
     return(new Service.Products.Model.Menu(model.Title, model.Image, model.Description, model.CreatorUserId, model.CreationTime, model.LastModifierUserId, model.LastModificationTime, model.DeleterUserId, model.DeletionTime, model.IsDeleted, model.OrganizationUnitId));
 }
示例#30
0
 public ResponseModel Create([FromBody] MenuDto model)
 {
     menuService.Create(model);
     return(new ResponseModel());
 }
示例#31
0
 public ActionResult Edit(string moudleId, string menuId, string btnId, MenuDto dto)
 {
     SetMenuType(ref dto);
     menuService.Update(dto);
     return(RedirectToAction("Index", RouteData.Values));
 }
示例#32
0
 public abstract MenuDto Add(MenuDto newitem);
示例#33
0
 public CreateMenuCommand(MenuDto menu)
 {
     Menu = menu;
 }