Пример #1
0
        public override UserInfo GetByUserName(string token, string userName, int companyId)
        {
            using (var session = Factory.Create <ISession>(token))
            {
                var result = session.QueryFirstOrDefault <CzdmModel>(
                    ByNameORCodeSql, new CzdmModel
                {
                    UserCode = userName,
                    UserName = userName
                });
                IEnumerable <UserRestaurant> userRestaurants = null;
                var userinfo = ConvertToInfo(result);
                if (userinfo != null)
                {
                    if (userinfo.IsTechnicalAssistance)
                    {
                        var needInit = session.ExecuteScalar(IsHaveRestaurant, new
                        {
                            CompanyId = companyId
                        }).ObjToInt();
                        if (userinfo.Permission <= 0)
                        {
                            var permissionList = EnumToList.ConvertEnumToList(typeof(Permission));
                            var permissionSum  = permissionList.Sum(p => p.Key);
                        }
                        if (needInit <= 0)
                        {
                            var restaurantId = session.Execute(InsertRestaurantInit, new R_Restaurant()
                            {
                                Name         = "初始化餐厅",
                                R_Company_Id = companyId
                            });
                            var marketId = session.Execute(InsertMarket, new R_Market()
                            {
                                Name            = "早市",
                                R_Restaurant_Id = restaurantId,
                                StartTime       = "06:00",
                                EndTime         = "12:00"
                            });
                        }
                        userRestaurants = session.Query <UserRestaurant>(GetAllRestaurant, new
                        {
                            R_Company_Id = companyId
                        });
                    }
                    else
                    {
                        userRestaurants = session.Query <UserRestaurant>(GetUserRestaurants, new
                        {
                            UserId       = userinfo.UserId,
                            R_Company_Id = companyId
                        });
                    }

                    userinfo.ManagerRestaurant = string.Join(",", userRestaurants.Select(p => p.RestaurantId));
                }
                return(userinfo);
                //return ConvertToInfo(result);
            }
        }
Пример #2
0
        public ActionResult OrderSearchList()
        {
            var currentUser = OperatorProvider.Provider.GetCurrent();

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

            ViewBag.OrderTypes = orderTypes;

            //订单状态
            var statusList = EnumToList.ConvertEnumToList(typeof(CyddStatus));

            statusList = statusList.Where(x => x.Key < 8 || x.Key == (int)CyddStatus.反结).ToList();
            var marketList = _marketRep.GetList(currentUser.DepartmentId.ToInt());
            var tableList  = _tableRep.GetList(new TableSearchDTO()
            {
                RestaurantId = currentUser.DepartmentId.ToInt()
            });

            ViewBag.MarketList     = marketList;
            ViewBag.StatusList     = statusList;
            ViewBag.RestaurantId   = currentUser.DepartmentId.ToInt();
            ViewBag.IsDelete       = (currentUser.Permission & (int)Permission.除订单) > 0 ? true : false;
            ViewBag.IsSearchDelete = (currentUser.Permission & (int)Permission.查看删除订单) > 0 ? true : false;
            ViewBag.CustomerList   = _oldCustRepository.GetListByStatus(null);
            ViewBag.TableList      = tableList;
            return(View());
        }
Пример #3
0
        public ActionResult NewOrderList()
        {
            var currentUser = OperatorProvider.Provider.GetCurrent();
            var resIds      = currentUser.ManagerRestaurant.Join(",").Split(',');

            //餐厅
            var restaurants = _restaurantRepository.GetList(resIds);

            ViewBag.Restaurants = restaurants;

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

            ViewBag.CustomerSources = customerSources;

            //订单状态
            var statusList = EnumToList.ConvertEnumToList(typeof(CyddStatus));

            statusList = statusList.Where(x => x.Key != (int)CyddStatus.预定).ToList();

            ViewBag.StatusList   = statusList;
            ViewBag.RestaurantId = currentUser.DepartmentId.ToInt();

            return(View());
        }
Пример #4
0
        public ActionResult Index(string req)
        {
            var list = EnumToList.ConvertEnumToList(typeof(CyddPayType));

            ViewBag.CyddPayTypeList = list.Where(x => x.Key > 0).ToList(); //EnumHelper.GetEnumDic<CyddPayType>(); //支付方式列表
            ViewBag.Req             = req;
            return(View());
        }
Пример #5
0
        public ActionResult DepositList(int orderId)
        {
            var includes = new [] { (int)CyddPayType.现金, (int)CyddPayType.微信, (int)CyddPayType.支付宝, (int)CyddPayType.银行卡 };

            //支付类型
            var payTypeList = EnumToList.ConvertEnumToList(typeof(CyddPayType));

            payTypeList         = payTypeList.Where(x => includes.Contains(x.Key)).ToList();
            ViewBag.PayTypeList = payTypeList;
            ViewBag.OrderId     = orderId;
            return(View());
        }
Пример #6
0
        public RestaurantPlatformDTO LoadPlatformInfo(int restaurantId)
        {
            string errMsg = null;

            if (restaurantId == 0)
            {
                errMsg = "无法读取当前餐厅信息,请确认此餐厅Id 有效!";
            }

            var restaurant = _resRepository.GetModel(restaurantId);

            if (restaurant == null && restaurant.Id <= 0)
            {
                errMsg = "无法读取当前餐厅信息,请确认此餐厅Id 有效!";
            }

            if (errMsg != null)
            {
                throw new Exception(errMsg);
            }

            var areaList  = _areaRep.GetList(restaurantId);
            var tableList = _tableRep.GetList(new TableSearchDTO()
            {
                RestaurantId = restaurantId
            });
            var tableStatusList = EnumToList.ConvertEnumToList(typeof(CythStatus));

            tableStatusList.Add(new BaseDto()
            {
                Key = 0, Text = "全部"
            });
            tableStatusList = tableStatusList.OrderBy(x => x.Key).ToList();

            var usedList    = tableList.Where(x => x.CythStatus == CythStatus.在用).ToList();
            var totalAmount = usedList.Where(p => p.IsVirtual == false).Sum(x => x.OrderNow.Sum(y => y.TotalAmount ?? 0));
            var totalGuest  = usedList.Where(p => p.IsVirtual == false).Sum(x => x.OrderNow.Sum(y => y.PersonNum));
            var usedCount   = usedList.Where(p => p.IsVirtual == false).Count();

            var dateItem = _extendItemRepository.GetModelList(restaurant.R_Company_Id, 10003).FirstOrDefault();

            foreach (var item in tableStatusList)
            {
                if (item.Key == 0)
                {
                    item.Value = tableList.Count.ToString();
                }
                else if (item.Key == (int)CythStatus.空置)
                {
                    item.Value = tableList.Where(x => x.CythStatus == CythStatus.空置).Count().ToString();
                }
                else if (item.Key == (int)CythStatus.在用)
                {
                    item.Value = usedCount.ToString();
                }
                else if (item.Key == (int)CythStatus.清理)
                {
                    item.Value = tableList.Where(x => x.CythStatus == CythStatus.清理).Count().ToString();
                }
            }

            var realUsedCount             = tableList.Count(x => x.CythStatus == CythStatus.在用 && x.IsVirtual == false);
            RestaurantPlatformDTO resInfo = new RestaurantPlatformDTO
            {
                AreaList             = areaList,
                BusinessDate         = dateItem != null ? dateItem.ItemValue : "",
                CurrentTableUsedRate = ((float)usedCount / (float)tableList.Count(p => p.IsVirtual == false) * 100).ToString("f2"),
                CurrentTotalAmount   = totalAmount,
                CurrentTotalGuestNum = totalGuest,
                TableList            = tableList,
                TableStatusList      = tableStatusList
            };

            return(resInfo);
        }