public ActionResult GetTotalCountAndPrice(string uid, string orderId) { try { var totalCount = 0; var totalPrice = 0.00m; if (!string.IsNullOrEmpty(uid) && !string.IsNullOrEmpty(orderId)) { MyMenuModel myMenu = new MyMenuModel(); List <MyMenu> mymenu = myMenu.getMyMenuListData(uid, orderId, "FastFood"); if (mymenu != null) { foreach (var item in mymenu) { totalCount += item.ProductCount; totalPrice += item.ProductCount * item.UnitPrice; } } } var data = new { IsSuccessful = true, TotalCount = totalCount, TotalPrice = totalPrice }; return(Json(data, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Logger.Log(ex); var data = new { IsSuccessful = false }; return(Json(data, JsonRequestBehavior.AllowGet)); } }
// // GET: /MyMenu/ public ActionResult MyMenu(string MemberCardNo, string OrderId, string SourceAccountId, string RstType = null, string CompanyId = null) { ViewBag.SourceAccountId = SourceAccountId; ViewBag.OrderId = OrderId; ViewBag.MemberCardNo = MemberCardNo; string RestaurantId = Session["begindm"] != null ? Session["begindm"].ToString() : ""; ViewBag.RestaurantId = RestaurantId; if (OrderId != null && OrderId != "") { MyMenuModel odb = new MyMenuModel(); List <MyMenu> mymenu = odb.getMyMenuListData(MemberCardNo, OrderId, RstType); ViewBag.MyMenuListData = mymenu; decimal sum = 0; if (mymenu.Count > 0) { for (int i = 0; i < mymenu.Count; i++) { sum += mymenu[i].UnitPrice * mymenu[i].ProductCount; } } ViewBag.total = sum; } ViewBag.RstType = RstType; ViewBag.CompanyId = CompanyId; return(View()); }
// // 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)); }
// // GET: /Product/ public ActionResult getProductByProductTypeId(string RestaurantId, string ProductTypeId, string SourceAccountId, string Status, string Type = null) { List <ProductNew> p = null; //object obj = System.Web.HttpRuntime.Cache.Get("ProductType" + ProductTypeId); //if (obj != null) //{ // p = obj as List<ProductNew>; //} //if (p == null) //{ ProductModel pm = new ProductModel(); p = pm.getProductByProductTypeId(RestaurantId, ProductTypeId); // System.Web.HttpRuntime.Cache.Add("ProductType" + ProductTypeId, p, null, DateTime.Now.AddHours(2), // TimeSpan.Zero, CacheItemPriority.Normal, null); //} 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(); Order order = null; Order FastFoodOrder = null; //Type == "FastFood"表明此店为快餐店。 if (!string.IsNullOrEmpty(Type) && Type == "FastFood") { FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crm.First().Uid); } else { order = odm.SelectUnFinishedOrder(crm.First().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(MemberCardNo, OrderId, Type); ViewBag.MyMenuListData = mymenu; } } ViewBag.Status = Status; return(View(p)); }
public ActionResult stage2(string RestaurantId, string ProductTypeId, string TypeName, string SourceAccountId, string Status, string Type = null, string imgid = null, string peopleCount = null) { List <ProductNew> p = null; object obj = System.Web.HttpRuntime.Cache.Get("ProductType" + ProductTypeId); if (obj != null) { p = obj as List <ProductNew>; } if (p == null) { ProductModel pm = new ProductModel(); p = pm.getProductByProductTypeId(RestaurantId, ProductTypeId); System.Web.HttpRuntime.Cache.Add("ProductType" + ProductTypeId, p, null, DateTime.Now.AddHours(2), TimeSpan.Zero, CacheItemPriority.Normal, null); } CrmMemberModel cdb = new CrmMemberModel(); List <CrmMember> crm = cdb.getCrmMemberListInfoData(SourceAccountId); ViewBag.MemberCardNo = crm.First().Uid; ViewBag.TypeName = TypeName; ViewBag.Type = Type; ViewBag.imgid = imgid; ViewBag.peopleCount = peopleCount; ViewBag.SourceAccountId = SourceAccountId; ViewBag.RestaurantId = RestaurantId; /* 显示用户已点菜数量*/ OrderModel odm = new OrderModel(); Order FastFoodOrder = null; ViewBag.OrderId = null; FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crm.First().Uid); if (FastFoodOrder != null) { if (Type == "Auto") { Type = "FastFood"; } string OrderId = FastFoodOrder.Id.ToString(); ViewBag.OrderId = FastFoodOrder.Id; /* 显示用户已点菜数量*/ MyMenuModel myMenu = new MyMenuModel(); List <MyMenu> myAutoMenu = myMenu.getMyMenuListData(crm.First().Uid, OrderId, Type); ViewBag.MyAutoMenuListData = myAutoMenu; } return(View(p)); }
public ActionResult stage2(string RestaurantId, string ProductTypeId, string TypeName, string SourceAccountId, string Status, string Type = null, string imgid = null, string peopleCount=null) { List<ProductNew> p = null; object obj = System.Web.HttpRuntime.Cache.Get("ProductType" + ProductTypeId); if (obj != null) { p = obj as List<ProductNew>; } if (p == null) { ProductModel pm = new ProductModel(); p = pm.getProductByProductTypeId(RestaurantId, ProductTypeId); System.Web.HttpRuntime.Cache.Add("ProductType" + ProductTypeId, p, null, DateTime.Now.AddHours(2), TimeSpan.Zero, CacheItemPriority.Normal, null); } CrmMemberModel cdb = new CrmMemberModel(); List<CrmMember> crm = cdb.getCrmMemberListInfoData(SourceAccountId); ViewBag.MemberCardNo = crm.First().Uid; ViewBag.TypeName = TypeName; ViewBag.Type = Type; ViewBag.imgid = imgid; ViewBag.peopleCount = peopleCount; ViewBag.SourceAccountId = SourceAccountId; ViewBag.RestaurantId = RestaurantId; /* 显示用户已点菜数量*/ OrderModel odm = new OrderModel(); Order FastFoodOrder = null; ViewBag.OrderId = null; FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crm.First().Uid); if ( FastFoodOrder != null) { if (Type == "Auto") { Type = "FastFood"; } string OrderId =FastFoodOrder.Id.ToString(); ViewBag.OrderId = FastFoodOrder.Id; /* 显示用户已点菜数量*/ MyMenuModel myMenu = new MyMenuModel(); List<MyMenu> myAutoMenu = myMenu.getMyMenuListData(crm.First().Uid, OrderId, Type); ViewBag.MyAutoMenuListData = myAutoMenu; } return View(p); }
public ActionResult MyAutoMenus(string MemberCardNo, string OrderId, string SourceAccountId, string RstType, string Type = null, string peopleCount = null) { ViewBag.SourceAccountId = SourceAccountId; ViewBag.OrderId = OrderId; ViewBag.MemberCardNo = MemberCardNo; ViewBag.RstType = RstType; ViewBag.Type = Type; ViewBag.peopleCount = peopleCount; string RestaurantId = Session["begindm"] != null ? Session["begindm"].ToString() : ""; ViewBag.RestaurantId = RestaurantId; List <MyMenu> mymenu = null; MyMenuModel odb = new MyMenuModel(); if (OrderId != null && OrderId != "") { mymenu = odb.getMyMenuListData(MemberCardNo, OrderId, RstType); ViewBag.MyMenuListData = mymenu; decimal sum = 0, msum = 0; if (mymenu.Count > 0) { for (int i = 0; i < mymenu.Count; i++) { sum += mymenu[i].UnitPrice * mymenu[i].ProductCount; msum += mymenu[i].MemberPrice * mymenu[i].ProductCount; } } ViewBag.total = sum; ViewBag.mTotal = msum; } List <PresentProduct> presentProducts = null; presentProducts = odb.getPresentProductListData(RestaurantId); ViewBag.presentProducts = null; if (presentProducts != null && presentProducts.Count > 0) { ViewBag.presentProducts = presentProducts; } return(View(mymenu)); }
// // GET: /Product/ public ActionResult getProductByProductTypeId(string RestaurantId, string ProductTypeId, string SourceAccountId, string Status, string Type = null) { List<ProductNew> p = null; //object obj = System.Web.HttpRuntime.Cache.Get("ProductType" + ProductTypeId); //if (obj != null) //{ // p = obj as List<ProductNew>; //} //if (p == null) //{ ProductModel pm = new ProductModel(); p = pm.getProductByProductTypeId(RestaurantId, ProductTypeId); // System.Web.HttpRuntime.Cache.Add("ProductType" + ProductTypeId, p, null, DateTime.Now.AddHours(2), // TimeSpan.Zero, CacheItemPriority.Normal, null); //} 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(); Order order = null; Order FastFoodOrder = null; //Type == "FastFood"表明此店为快餐店。 if (!string.IsNullOrEmpty(Type) && Type == "FastFood") { FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crm.First().Uid); } else { order = odm.SelectUnFinishedOrder(crm.First().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(MemberCardNo, OrderId, Type); ViewBag.MyMenuListData = mymenu; } } ViewBag.Status = Status; return View(p); }
public ActionResult GetTotalCountAndPrice(string uid, string orderId) { try { var totalCount = 0; var totalPrice = 0.00m; if (!string.IsNullOrEmpty(uid) && !string.IsNullOrEmpty(orderId)) { MyMenuModel myMenu = new MyMenuModel(); List<MyMenu> mymenu = myMenu.getMyMenuListData(uid, orderId, "FastFood"); if (mymenu != null) { foreach (var item in mymenu) { totalCount += item.ProductCount; totalPrice += item.ProductCount * item.UnitPrice; } } } var data = new { IsSuccessful = true, TotalCount = totalCount, TotalPrice = totalPrice }; return Json(data, JsonRequestBehavior.AllowGet); } catch (Exception ex) { Logger.Log(ex); var data = new { IsSuccessful = false }; return Json(data, JsonRequestBehavior.AllowGet); } }