//
        // GET: /ProductType/
        public ActionResult Index(string SourceAccountId, string RestaurantId, string Status = null, string Date = null, string Time = null, string Type = null, string IsOrder = null, string MemberCardNo = null, string Orderid = null)
        {
            Session["SourceAccountId"] = SourceAccountId;
            ProductTypeModel ptm = new ProductTypeModel();
            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;
                }
            }
            if (!string.IsNullOrEmpty(IsOrder) && IsOrder == "1" && !string.IsNullOrEmpty(Orderid))
            {
                OrderDetailsModel odm = new OrderDetailsModel();
                OrderModel om = new OrderModel();
                int i;
                i = odm.EmptyOrderDetails(MemberCardNo, Orderid);
                i = om.EmptyOrderStatus(Orderid);
                i = om.EmptyOrder(Orderid);

            }
            List<ProductType> pt = null;
            if (!string.IsNullOrEmpty(RestaurantId))
            {

                if (RestaurantId.ToUpper() == "0E71D411-EFE0-4964-8E3D-2901E0823815")
                {
                    List<ProductType> onept = ptm.getOneProductType(RestaurantId);
                    ViewBag.FirstMenus = onept;
                    if (onept != null && onept.Count() > 0)
                        pt = ptm.getProductTypebyId(RestaurantId, onept.First().TypeId.ToString());

                }
                else
                {
                    pt = ptm.getProductType(RestaurantId);
                }
            }
            Session["begindm"] = RestaurantId;
            string RestaurantId1 = Session["begindm"] != null ? Session["begindm"].ToString() : "";
            ViewBag.SourceAccountId = SourceAccountId;
            ViewBag.Status = Status;
            ViewBag.FastFood = Type;
            ViewBag.RestaurantId = RestaurantId;
            ViewBag.MemberCardNo = MemberCardNo;
            ViewBag.OrderId = Orderid;
            return View(pt ?? new List<ProductType>());
        }
        //
        // GET: /AutoMenuIndex/
        public ActionResult AutoMenuIndex(string id, string name, string Type, string CompanyId, string RstType, string IsOrder = null, string IsNewOrder = null, string orderId = null, string MemberCardNo=null)
        {
            // Session["CompanyId"] = id;
            ViewBag.RestaurantId = id;
            ViewBag.SourceAccountId = name;
            ViewBag.Type = Type;
            ViewBag.CompanyId = CompanyId;
            ViewBag.RstType = RstType;
            ViewBag.IsOrder = IsOrder;
            if (!string.IsNullOrEmpty(IsNewOrder) && IsNewOrder == "NewOrder")
            {
                OrderDetailsModel odm = new OrderDetailsModel();
                OrderModel om = new OrderModel();
                int i;
                i = odm.EmptyOrderDetails(MemberCardNo, orderId);
                i = om.EmptyOrder(orderId);

            }
            return View();
        }
Example #3
0
        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;
        }
Example #4
0
 public int DelOrderDetails(string productId, string orderId)
 {
     try
     {
         OrderDetailsModel odm = new OrderDetailsModel();
         return odm.DelOrderDetails(productId, orderId);
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
         return 0;
     }
 }