コード例 #1
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());
        }
コード例 #2
0
        private void GetListToViewBag(Area pht)
        {
            List <Area> phts = bll.Areas.ToList();

            if (pht != null)
            {
                Area pht0 = phts.Find(i => i.Id == pht.Id);
                if (pht0 != null)
                {
                    phts.Remove(pht0);//删除本身,编辑时不能让自己成为自己的子节点
                }
            }
            SelectList list = new SelectList(phts, "Id", "Name");

            ViewBag.List = list.AsEnumerable();

            ViewBag.EnumList = EnumToList.EnumToListChoice <AreaTypes>();
            //List<SelectListItem> list2 = new List<SelectListItem>();
            //var enumtype = typeof(Types);
            //foreach (var obj in Enum.GetValues(enumtype))
            //{
            //    list2.Add(new SelectListItem { Text = obj.ToString(), Value = obj.ToString() });
            //}

            //ViewBag.EnumList = list2;
        }
コード例 #3
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);
            }
        }
コード例 #4
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());
        }
コード例 #5
0
ファイル: CheckOutController.cs プロジェクト: OpuZm/NHRTest
        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());
        }
コード例 #6
0
        private void GetListToViewBag()
        {
            List <Area> Pts    = bll.Areas.ToList();
            SelectList  PtList = new SelectList(Pts, "Id", "Name");

            ViewBag.PtList = PtList.AsEnumerable();

            ViewBag.Abutment_DevTypesList  = EnumToList.EnumToListChoice <Abutment_DevTypes>();
            ViewBag.Abutment_StatusList    = EnumToList.EnumToListChoice <Abutment_Status>();
            ViewBag.Abutment_RunStatusList = EnumToList.EnumToListChoice <Abutment_RunStatus>();
        }
コード例 #7
0
        private void GetListToViewBag()
        {
            List <Area>            areaList  = bll.Areas.ToList();
            SelectList             selList   = new SelectList(areaList, "Id", "Name");
            IList <SelectListItem> TypeItem  = EnumToList.EnumToListChoice <ArchorTypes>();
            IList <SelectListItem> StartItem = EnumToList.EnumToListChoice <IsStart>();

            ViewBag.selList   = selList.AsEnumerable();
            ViewBag.TypeItem  = TypeItem;
            ViewBag.StartItem = StartItem;
        }
コード例 #8
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());
        }
コード例 #9
0
        private void GetListToViewBag()
        {
            List <Area> Pts    = bll.Areas.ToList();
            SelectList  PtList = new SelectList(Pts, "Id", "Name");

            ViewBag.PtList = PtList.AsEnumerable();

            List <CardRole> CardRoles    = bll.CardRoles.ToList();
            SelectList      CardRoleList = new SelectList(CardRoles, "Id", "Name");

            ViewBag.CardRoleList = CardRoleList.AsEnumerable();

            ViewBag.EnumList            = EnumToList.EnumToListChoice <RepeatDay>();
            ViewBag.TimeSettingTypeList = EnumToList.EnumToListChoice <TimeSettingType>();
            ViewBag.AreaAccessTypeList  = EnumToList.EnumToListChoice <AreaAccessType>();
        }
コード例 #10
0
        private void GetListToViewBag()
        {
            List <Area> Pts    = bll.Areas.ToList();
            SelectList  PtList = new SelectList(Pts, "Id", "Name");

            ViewBag.PtList = PtList.AsEnumerable();

            List <LocationCard> Tags    = bll.LocationCards.ToList();
            SelectList          TagList = new SelectList(Tags, "Id", "Name");

            ViewBag.TagList = TagList.AsEnumerable();

            ViewBag.EnumList = EnumToList.EnumToListChoice <RepeatDay>();

            List <SelectListItem> RepeatTypeList = new List <SelectListItem>();

            RepeatTypeList.Add(new SelectListItem {
                Text = "每天", Value = "每天"
            });
            RepeatTypeList.Add(new SelectListItem {
                Text = "星期一", Value = "星期一"
            });
            RepeatTypeList.Add(new SelectListItem {
                Text = "星期二", Value = "星期二"
            });
            RepeatTypeList.Add(new SelectListItem {
                Text = "星期三", Value = "星期三"
            });
            RepeatTypeList.Add(new SelectListItem {
                Text = "星期四", Value = "星期四"
            });
            RepeatTypeList.Add(new SelectListItem {
                Text = "星期五", Value = "星期五"
            });
            RepeatTypeList.Add(new SelectListItem {
                Text = "星期六", Value = "星期六"
            });
            RepeatTypeList.Add(new SelectListItem {
                Text = "星期天", Value = "星期天"
            });
            RepeatTypeList.Add(new SelectListItem {
                Text = "一次", Value = "一次"
            });
            ViewBag.RepeatTypeList = RepeatTypeList;
        }
コード例 #11
0
        private void GetDepListToViewBag(Department dep)
        {
            List <Department> deps = bll.Departments.ToList();

            if (dep != null)
            {
                Department dep0 = deps.Find(i => i.Id == dep.Id);
                if (dep0 != null)
                {
                    deps.Remove(dep0);//删除本身,编辑时不能让自己成为自己的子节点
                }
            }
            SelectList             list     = new SelectList(deps, "Id", "Name");
            IList <SelectListItem> listItem = EnumToList.EnumToListChoice <DepartType>();

            ViewBag.List    = list.AsEnumerable();
            ViewBag.selList = listItem;
        }
コード例 #12
0
        private void GetListToViewBag(Area pht)
        {
            List <Area> phts = bll.Areas.ToList();

            if (pht != null)
            {
                Area pht0 = phts.Find(i => i.Id == pht.Id);
                if (pht0 != null)
                {
                    phts.Remove(pht0);//删除本身,编辑时不能让自己成为自己的子节点
                }
            }
            SelectList list = new SelectList(phts, "Id", "Name");

            ViewBag.List = list.AsEnumerable();

            ViewBag.EnumList = EnumToList.EnumToListChoice <AreaTypes>();
        }
コード例 #13
0
ファイル: RestaurantService.cs プロジェクト: OpuZm/NHRTest
        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);
        }