Exemple #1
0
        //
        // GET: /Order/
        //public ActionResult Index(string SourceAccountId, string RestaurantId, string Status = null, string Date = null, string Time = null, string Type = null)
        //{
        //    if (Date != null & Time != null)
        //    {
        //        if (Time.Equals("0"))
        //        {
        //            DateTime data = Convert.ToDateTime(Date);
        //            data = data.AddHours(9);
        //            ViewBag.BookTime = data;
        //        }
        //        else if (Time.Equals("1"))
        //        {
        //            DateTime data = Convert.ToDateTime(Date);
        //            data = data.AddHours(16);
        //            ViewBag.BookTime = data;
        //        }
        //    }
        //    OrderModel odb = new OrderModel();
        //    ViewBag.ProductListData = odb.getProductListInfoData(RestaurantId);
        //    Session["begindm"] = RestaurantId;
        //    ViewBag.SourceAccountId = SourceAccountId;
        //    ViewBag.RestaurantId = RestaurantId;
        //    ViewBag.Status = Status;
        //    ViewBag.RstType = Type;
        //    CrmMemberModel cdb = new CrmMemberModel();
        //    if (SourceAccountId != null && SourceAccountId != "")
        //    {
        //        List<CrmMember> crm = cdb.getCrmMemberListInfoData(SourceAccountId);
        //        ViewBag.MemberCardNo = crm.First().Uid;
        //        string MemberCardNo = crm.First().Uid;
        //        OrderModel odm = new OrderModel();
        //        List<Order> order = null;
        //        List<FastFoodOrder> FastFoodOrder = null;
        //        if (!string.IsNullOrEmpty(Type) && Type == "FastFood")
        //        {
        //            FastFoodOrder = odm.selOrderByMemberId(crm.First().Uid);
        //        }
        //        else { order = odm.SelUnFinValidOrder(crm.First().Uid); }
        //        string OrderId = "";
        //        if ((order != null && order.Count > 0) || (FastFoodOrder != null && FastFoodOrder.Count > 0))
        //        {
        //            ViewBag.OrderId = order.First().Id;
        //            OrderId = order.First().Id.ToString();
        //            /* 显示用户已点菜数量*/
        //            MyMenuModel myMenu = new MyMenuModel();
        //            List<MyMenu> mymenu = myMenu.getMyMenuListData(MemberCardNo, OrderId);
        //            ViewBag.MyMenuListData = mymenu;
        //        }
        //    }
        //    return View();
        //}
        public ActionResult Begin(string id, string name, string type = null, string CityId = null, string CityName = null)
        {
            try
            {
                Session["SourceAccountId"] = name;
                Session["CompanyId"] = id;
                ViewBag.CompanyId = id;
                OrderModel odm = new OrderModel();
                CrmMemberModel cdb = new CrmMemberModel();
                List<CrmMember> crm = cdb.getCrmMemberListInfoData(name);
                ViewBag.MemberCardNo = crm.First().Uid;

                Session["CrmMember"] = crm.First();

                //  Session["MemberCardNo"] = crm.First().Uid;
                if (!string.IsNullOrEmpty(CityName)) { ViewBag.cityName = CityName; }

                //根据type来判断是否是快捷预定(Quick)或智能点餐(Auto)
                if (string.IsNullOrEmpty(type) && type != "Quick" && type != "Auto")
                {
                    //判断该用户在该店面预定的时间是否小于当前时间,如果是,弹出“我的订单”选择“修改”
                    //或者“新预定”框体。修改默认显示当前订单内容   如果订单是未完成状态则直接跳转到点餐页面

                    //  ViewBag.CompanyId = id;

                    Order info = new Order();
                    Order unFinishedOrder = odm.SelectUnFinishedOrder(crm.First().Uid);
                    int status = 0;
                    if (unFinishedOrder != null)
                    {
                        DateTime bookTime = unFinishedOrder.DiningDate;

                        if (DateTime.Now < bookTime.AddHours(5))
                        {
                            ViewBag.RecOrder = 1;
                            status = 1;
                            //return RedirectToAction("MY", "Order", new { id = id, name = name });
                        }
                    }
                    if (status != 1)
                    {
                        Order paidOrder = odm.SelectPaidOrder(crm.First().Uid);
                        ViewBag.isCurTime = 0;
                        if (paidOrder != null)
                        {
                            DateTime bookTime = paidOrder.DiningDate;

                            if (DateTime.Now < bookTime)
                            {
                                ViewBag.isCurTime = 1;

                            }
                        }
                    }
                }
                Order FastFoodOrder = null;

                //如果为自动点餐和快捷点餐。如果还有未过期的订单则跳转到订单详情 ViewBag.AutoOrderCount=1 有订单
                ViewBag.AutoOrderCount = 0;
                if (!string.IsNullOrEmpty(type) && (type == "Auto" || type == "Quick"))
                {

                    FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crm.First().Uid);
                    if (FastFoodOrder != null)
                    {
                        ViewBag.AutoOrderCount = 1;
                        ViewBag.OrderId = FastFoodOrder.Id;
                    }
                }

                string dm = Session["begindm"] != null ? Session["begindm"].ToString() : "";
                // if (string.IsNullOrEmpty(dm))
                //  {

                //  List<RestaurantAbstract> p = null;
                // object obj = System.Web.HttpRuntime.Cache.Get("id" + id);
                // if (obj != null)
                // {
                //   p = obj as List<RestaurantAbstract>;
                // }
                // if (p == null)
                // {
                RestaurantModel rdb = new RestaurantModel();
                //CityId = string.IsNullOrEmpty(CityId) ? "510100" : CityId;
                List<RestaurantAbstract> p = rdb.getRestaurentState(id);
                // System.Web.HttpRuntime.Cache.Add("id" + id, p, null, DateTime.Now.AddHours(2),
                // TimeSpan.Zero, CacheItemPriority.Normal, null);
                //  }
                ViewBag.SourceAccountId = name;
                ViewBag.type = type;
                return View(p);
                // }
                //  return RedirectToAction("Index","Order", new { SourceAccountId = id, RestaurantId = dm });
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return Content("页面加载错误");
            }
        }
Exemple #2
0
        public FileContentResult GetImagesRst(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                RestaurantModel rm = new RestaurantModel();
                List<RestaurantAbstract> list = rm.getImageRst(id);
                if (list != null && list.Count > 0)
                {
                    RestaurantAbstract info = list.First();
                    if (info != null)
                    {
                        if (info.Photo != null)
                        {
                            return File(info.Photo, "jpg", "image_" + id + ".jpg");
                        }

                    }

                }
            }
            return File(new byte[] { }, "jpg", "image_" + id + ".jpg");
        }