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()); }
public ActionResult My(string id, string name) { ViewBag.CompanyId = id; ViewBag.SourceAccountId = name; OrderModel odm = new OrderModel(); CrmMemberModel cdb = new CrmMemberModel(); List <CrmMember> crm = cdb.getCrmMemberListInfoData(name); //Order info = new Order(); //List<Order> order = odm.selOrderId(crm.First().Uid); //List<FastFoodOrder> Quickorder = odm.selOrderByMemberId(crm.First().Uid); //string OrderId = "", QuickorderId=""; //if (order.Count > 0 || Quickorder.Count>0) //{ // ViewBag.OrderId = order.First().Id; // OrderId = order.First().Id.ToString(); // ViewBag.QuickorderId = order.First().Id; // QuickorderId = order.First().Id.ToString(); // if (OrderId == null || OrderId == "" || QuickorderId == null || QuickorderId == "") // { // ViewBag.MyOrderListData = null; // return View("myOrder"); // } string MemberCardNo = crm.First().Uid; ViewBag.MemberCardNo = crm.First().Uid; MyMenuModel odb = new MyMenuModel(); List <MyOrder> myOrder = odb.getMyOrderListData(MemberCardNo); List <MyOrder> myQuickOrder = odb.getMyOrderListData(MemberCardNo, "FastFood"); if (myQuickOrder != null && myQuickOrder.Count > 0) { ViewBag.MyQuickOrderListData = myQuickOrder; } if (myOrder != null && myOrder.Count > 0) { ViewBag.MyOrderListData = myOrder; } //decimal sum = 0; //if (myOrder.Count > 0) //{ // for (int i = 0; i < myOrder.Count; i++) // { // sum += myOrder[i].UnitPrice*myOrder[i].; // } //} //ViewBag.total = sum; // } return(View("myOrder")); }
// // 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)); }
public int SaveOrderDetails(string type, string productId, string unitPrice, string orderId, string productCount, string useStatus = null, string MemberCardNo = null, string RstType = null) { int i = 0; try { int count = 1; int.TryParse(productCount, out count); OrderDetailsModel odm = new OrderDetailsModel(); OrderDetails info = new OrderDetails(); MyMenuModel odb = new MyMenuModel(); List<OrderDetails> orderD = odm.getOrderDetailInfoData(productId, orderId); List<MyOrderDetail> detail = null; if (MemberCardNo != null) { detail = odb.getMyOrderDetailListData(MemberCardNo, orderId, RstType); } if (orderD.Count > 0 && useStatus != "04") { type = "Update"; info.ProductCount = count; info.CreateDate = DateTime.Now; info.ProductId = new Guid(productId); info.OrderId = new Guid(orderId); info.TotalPrice = Convert.ToDecimal(unitPrice) * count; } else { if (useStatus == "04") { if (detail != null && detail.Count > 0) { foreach (MyOrderDetail item1 in detail) { if (item1.UseState == "04") { //已经有赠送的菜。(先删除已有的赠送菜,再添加现选择有赠送菜) int j = odm.DelGiftOrderDetails(useStatus, orderId); } } } } info.DetailsId = Guid.NewGuid(); info.OrderId = new Guid(orderId); info.ProductId = new Guid(productId); info.UnitPrice = Convert.ToDecimal(unitPrice); info.TotalPrice = Convert.ToDecimal(unitPrice) * count; info.CreateDate = DateTime.Now; info.ProductCount = count; if (useStatus != "04") { info.UseState = "00"; } else { info.UseState = useStatus; } } i = odm.SaveOrderDetails(type, info); } catch (Exception ex) { Logger.Log(ex); i = 0; } return i; }
public ActionResult My(string id, string name) { ViewBag.CompanyId = id; ViewBag.SourceAccountId = name; OrderModel odm = new OrderModel(); CrmMemberModel cdb = new CrmMemberModel(); List<CrmMember> crm = cdb.getCrmMemberListInfoData(name); //Order info = new Order(); //List<Order> order = odm.selOrderId(crm.First().Uid); //List<FastFoodOrder> Quickorder = odm.selOrderByMemberId(crm.First().Uid); //string OrderId = "", QuickorderId=""; //if (order.Count > 0 || Quickorder.Count>0) //{ // ViewBag.OrderId = order.First().Id; // OrderId = order.First().Id.ToString(); // ViewBag.QuickorderId = order.First().Id; // QuickorderId = order.First().Id.ToString(); // if (OrderId == null || OrderId == "" || QuickorderId == null || QuickorderId == "") // { // ViewBag.MyOrderListData = null; // return View("myOrder"); // } string MemberCardNo = crm.First().Uid; ViewBag.MemberCardNo = crm.First().Uid; MyMenuModel odb = new MyMenuModel(); List<MyOrder> myOrder = odb.getMyOrderListData(MemberCardNo); List<MyOrder> myQuickOrder = odb.getMyOrderListData(MemberCardNo, "FastFood"); if (myQuickOrder != null && myQuickOrder.Count > 0) { ViewBag.MyQuickOrderListData = myQuickOrder; } if (myOrder != null && myOrder.Count > 0) { ViewBag.MyOrderListData = myOrder; } //decimal sum = 0; //if (myOrder.Count > 0) //{ // for (int i = 0; i < myOrder.Count; i++) // { // sum += myOrder[i].UnitPrice*myOrder[i].; // } //} //ViewBag.total = sum; // } return View("myOrder"); }
// // 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); } }
public int SaveOrderDetails(string type, string productId, string unitPrice, string orderId, string productCount, string useStatus = null, string MemberCardNo = null, string RstType = null) { int i = 0; try { int count = 1; int.TryParse(productCount, out count); OrderDetailsModel odm = new OrderDetailsModel(); OrderDetails info = new OrderDetails(); MyMenuModel odb = new MyMenuModel(); List <OrderDetails> orderD = odm.getOrderDetailInfoData(productId, orderId); List <MyOrderDetail> detail = null; if (MemberCardNo != null) { detail = odb.getMyOrderDetailListData(MemberCardNo, orderId, RstType); } if (orderD.Count > 0 && useStatus != "04") { type = "Update"; info.ProductCount = count; info.CreateDate = DateTime.Now; info.ProductId = new Guid(productId); info.OrderId = new Guid(orderId); info.TotalPrice = Convert.ToDecimal(unitPrice) * count; } else { if (useStatus == "04") { if (detail != null && detail.Count > 0) { foreach (MyOrderDetail item1 in detail) { if (item1.UseState == "04") { //已经有赠送的菜。(先删除已有的赠送菜,再添加现选择有赠送菜) int j = odm.DelGiftOrderDetails(useStatus, orderId); } } } } info.DetailsId = Guid.NewGuid(); info.OrderId = new Guid(orderId); info.ProductId = new Guid(productId); info.UnitPrice = Convert.ToDecimal(unitPrice); info.TotalPrice = Convert.ToDecimal(unitPrice) * count; info.CreateDate = DateTime.Now; info.ProductCount = count; if (useStatus != "04") { info.UseState = "00"; } else { info.UseState = useStatus; } } i = odm.SaveOrderDetails(type, info); } catch (Exception ex) { Logger.Log(ex); i = 0; } return(i); }