コード例 #1
0
        //
        // GET: /Specials/

        public PartialViewResult RestaurantSpecials(string RestaurantId, string ProductTypeId, string SourceAccountId, string Status, string Type = null)
        {
            RestaurantSpecialsViewModel model = new RestaurantSpecialsViewModel();

            try
            {
                Logger.Log("Get Specials for RestaurantId= " + RestaurantId);
                model.SpecialsList = SpecialsModel.GetTodayByRestaurantId(new Guid(RestaurantId)) ?? new List <SpecialsEntity>();

                var crmMember = Session["CrmMember"] as CrmMember;
                if (crmMember != null)
                {
                    ViewBag.MemberCardNo    = crmMember.Uid;
                    ViewBag.SourceAccountId = crmMember.SourceAccountId;

                    #region 原來邏輯

                    OrderModel odm           = new OrderModel();
                    Order      order         = null;
                    Order      FastFoodOrder = null;
                    //Type == "FastFood"表明此店为快餐店。
                    if (!string.IsNullOrEmpty(Type) && Type == "FastFood")
                    {
                        FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crmMember.Uid);
                    }
                    else
                    {
                        order = odm.SelectUnFinishedOrder(crmMember.Uid);
                    }

                    string OrderId = "";
                    if (order != null || FastFoodOrder != null)
                    {
                        OrderId         = (order != null ? order.Id.ToString() : FastFoodOrder.Id.ToString());
                        ViewBag.OrderId = OrderId;
                        /* 显示用户已点菜数量*/
                        MyMenuModel   myMenu = new MyMenuModel();
                        List <MyMenu> mymenu = myMenu.getMyMenuListData(crmMember.Uid, OrderId, Type);
                        ViewBag.MyMenuListData = mymenu;
                    }

                    #endregion
                }
            }
            catch (Exception ex)
            {
                //TODO
                Logger.Log(ex);
            }
            ViewBag.Status = Status;
            return(PartialView(model));
        }
コード例 #2
0
        //
        // GET: /Company/

        public ActionResult Rst(string id)
        {
            NewRestaurantAbstract p = null;
            object obj = System.Web.HttpRuntime.Cache.Get("id" + id);

            if (obj != null)
            {
                p = obj as NewRestaurantAbstract;
            }
            if (p == null)
            {
                RestaurantModel rdb = new RestaurantModel();
                p = rdb.GetRestaurentById(id);
                System.Web.HttpRuntime.Cache.Add("id" + id, p, null, DateTime.Now.AddHours(2),
                                                 TimeSpan.Zero, CacheItemPriority.Normal, null);

                var crmMember = Session["CrmMember"] as CrmMember;
                if (crmMember != null)
                {
                    ViewBag.MemberCardNo    = crmMember.Uid;
                    ViewBag.SourceAccountId = crmMember.SourceAccountId;

                    Order FastFoodOrder = null;

                    //如果为自动点餐和快捷点餐。如果还有未过期的订单则跳转到订单详情 ViewBag.AutoOrderCount=1 有订单
                    ViewBag.AutoOrderCount = 0;
                    OrderModel odm = new OrderModel();
                    FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crmMember.Uid);
                    if (FastFoodOrder != null)
                    {
                        ViewBag.AutoOrderCount = 1;
                        ViewBag.OrderId        = FastFoodOrder.Id;
                    }
                }
            }
            ViewData["special"]          = SpecialsModel.GetTodayByRestaurantId(new Guid(id));
            ViewData["AllSpecial"]       = SpecialsModel.GetAllByRestaurantId(new Guid(id));
            ViewData["RestaurantImages"] = RestaurantImageDBModel.GetRestaurantImages(new Guid(id));
            return(View(p));
        }