Пример #1
0
        public List <UserDto> GetSales()
        {
            var res = _userRepository.GetByUsersSql("ZZ").Select(p => new UserDto()
            {
                UserId   = p.UserId,
                UserName = p.UserName,
                UserCode = p.UserCode
            }).ToList();

            return(res);
        }
Пример #2
0
        public ActionResult Reserve(int id = 0)
        {
            var currentUser            = OperatorProvider.Provider.GetCurrent();
            ReserveCreateDTO orderInfo = null;

            if (id > 0)
            {
                orderInfo = _orderRepository.GetOrderModel(id);
            }

            //客源类型
            var customerSources = _extendItemRepository
                                  .GetModelList(currentUser.CompanyId.ToInt(), 10002);

            ViewBag.CustomerSources = customerSources;

            //订单类型
            var orderTypes = _extendItemRepository
                             .GetModelList(currentUser.CompanyId.ToInt(), 10001);

            ViewBag.OrderTypes = orderTypes;

            var restaurantId = currentUser.DepartmentId.ToInt();
            var resModel     = _restaurantRepository.GetModel(restaurantId);

            var markets      = _marketRep.GetList(restaurantId);
            var customerList = _oldCustRepository.GetListByStatus(null);
            var areaList     = _areaRepository.GetList(currentUser.DepartmentId.ToInt());

            //var sellerResult = _oldUserRepository.GetAll<Smooth.IoC.UnitOfWork.ISession>();
            //var sellerList = AutoMapperExtend<CzdmModel, UserInfo>.ConvertToList(sellerResult, new List<UserInfo>());
            var sellerList = _orderRepository.GetDepartList();
            var sales      = _oldUserRepository.GetByUsersSql("ZZ");
            List <TableListDTO> conditionList = null;

            if (orderInfo != null)
            {
                conditionList = _tableRep.GetReseverChoseList(
                    new TableChoseSearchDTO()
                {
                    Market       = orderInfo.R_Market_Id,
                    RestaurantId = orderInfo.R_Restaurant_Id,
                    ReverDate    = (DateTime)orderInfo.ReserveDate
                });

                orderInfo.Tables.ForEach(
                    x =>
                {
                    conditionList.Add(new TableListDTO()
                    {
                        IsSelected   = true,
                        AreaId       = x.AreaId,
                        Name         = x.Name,
                        Id           = x.Id,
                        RestaurantId = x.RestaurantId,
                        Description  = x.Description
                    });
                });

                conditionList    = conditionList.OrderBy(x => x.Id).ToList();
                orderInfo.Tables = orderInfo.Tables.OrderBy(x => x.Id).ToList();

                markets.ForEach(
                    x =>
                {
                    x.IsDefault = false;
                    if (x.Id == orderInfo.R_Market_Id)
                    {
                        x.IsDefault = true;
                    }
                });
            }

            ViewBag.Markets      = markets;
            ViewBag.CustomerList = customerList;
            ViewBag.Restaurant   = resModel;

            var emptyTableList = _tableHandlerSers.GetTableList(
                new TableSearchDTO()
            {
                CythStatus   = CythStatus.空置,
                RestaurantId = currentUser.DepartmentId.ToInt(),
                CompanyId    = currentUser.CompanyId.ToInt(),
            });

            ViewBag.SearchTableList = conditionList;

            ViewBag.OrderInfo       = orderInfo;
            ViewBag.TableList       = emptyTableList;
            ViewBag.SellerList      = sellerList;
            ViewBag.CustomerSources = customerSources;
            ViewBag.restaurantId    = restaurantId;
            ViewBag.Areas           = areaList;
            ViewBag.UserName        = currentUser.UserName;
            ViewBag.LoginUserId     = currentUser.UserId;
            ViewBag.Sales           = sales;
            ViewBag.OrderTableIds   = orderInfo != null?string.Join(",", orderInfo.OrderTableIds) : "";

            return(View());
        }