Exemple #1
0
        public ActionResult SaveOrders(string SourceAccountId, string MemberCardNo, string orderid, string peoCount, string seat, string name, string phone, string sex, string remark)
        {
            OrderModel odm = new OrderModel();
            Order order = new Order();
            order.Id = new Guid(orderid);
            // DateTime date1 = Convert.ToDateTime(date);
            // DateTime time1 = Convert.ToDateTime(time);
            // date1= date1.AddHours(time1.Hour);
            // date1= date1.AddMinutes(time1.Minute);
            //date1=  date1.AddSeconds(time1.Second);

            //  order.DiningDate = Convert.ToDateTime(date1);
            order.PersonCount = string.IsNullOrEmpty(peoCount) ? 0 : Convert.ToInt32(peoCount);
            //order.TableCount = Convert.ToInt32(seat);
            order.TableCount = 1;
            order.ContactName = name;
            order.ContactPhone = phone;
            order.Sex = Convert.ToBoolean(sex);
            order.Remark = remark;
            order.Status = OrderStatus.New;
            order.CreateDate = DateTime.Now;
            int i = odm.SaveOrders("Update", order);
            string RestaurantId = Session["begindm"] != null ? Session["begindm"].ToString() : "";
            string CompanyId = Session["CompanyId"] != null ? Session["CompanyId"].ToString() : "";
            //   return RedirectToAction("MyMenu", "MyMenu", new { MemberCardNo = MemberCardNo, OrderId = orderid ,SourceAccountId=SourceAccountId});

            return RedirectToAction("MyOrderDetail", "MyMenu", new { MemberCardNo = MemberCardNo, OrderId = orderid, SourceAccountId = SourceAccountId, CompanyId = CompanyId });
            // <a href="/pay/MyOrderDetail?MemberCardNo=@(ViewBag.MemberCardNo)&OrderId=@(item.OrderId)&SourceAccountId= @(ViewBag.SourceAccountId)&type='detail'&CompanyId=@( ViewBag.CompanyId)" style="color:#ccc">
        }
Exemple #2
0
        //       public ActionResult Quick(string id, string name) {
        //           Guid OrderId = this.SaveOrders("Insert", name);
        //              CrmMemberModel cdb = new CrmMemberModel();
        //           List<CrmMember> crm = cdb.getCrmMemberListInfoData(name);
        //           if (OrderId != new Guid("00000000-0000-0000-0000-000000000000")){
        //// /book/book?MemberCardNo=@(ViewBag.MemberCardNo)&OrderId=@(ViewBag.OrderId)&SourceAccountId=@(ViewBag.SourceAccountId)
        //             return RedirectToAction("book","book", new { MemberCardNo = crm.First().Uid, OrderId = OrderId,SourceAccountId=name });
        //           }
        //               return View();
        //       }
        public Guid SaveOrders(string type, string SourceAccountId, string bookTime = null, string isQuick = null, string peopleCont = null, string Remark = null, string OrderId = null)
        {
            int i;
            try
            {

                Session["SourceAccountId"] = SourceAccountId;
                OrderModel odm = new OrderModel();
                CrmMemberModel cdb = new CrmMemberModel();
                List<CrmMember> crm = cdb.getCrmMemberListInfoData(SourceAccountId);
                Order order = null;
                Order FastFoodOrder = null;
                Order info = new Order();

                //isQuick=="Quick" 表明此订单为快捷预定  isQuick==null表明为预定订单  isQuick=Auto 表明是智能点餐
                if (string.IsNullOrEmpty(isQuick))
                {

                    order = odm.SelectUnFinishedOrder(crm.First().Uid);
                }
                else
                {

                    FastFoodOrder = odm.SelectUnFinishedFastFoodOrder(crm.First().Uid);
                }

                if (order != null)
                {
                    type = "Update";
                    //  i = odm.SaveOrders(type, info);

                    return order.Id;

                }
                else if (FastFoodOrder != null)
                {

                    type = "UpdateFastFood";
                    info.CreateDate = DateTime.Now;
                    if (string.IsNullOrEmpty(OrderId))
                    {
                        info.Id = Guid.NewGuid();
                    }
                    else
                    {
                        info.Id = new Guid(OrderId);
                    }
                    info.Remark = Remark;
                    i = odm.SaveOrders(type, info);
                    return FastFoodOrder.Id;
                }

            //if ((order!=null&&order.Count > 0)||(FastFoodOrder != null && FastFoodOrder.Count > 0))
                //{
                //    type = "Update";
                //   // i = odm.SaveOrders(type, info);

            //    return order.First().Id;

            //}
                else
                {
                    info.Id = Guid.NewGuid();
                    //info.Id = crm.First().Uid;
                    info.ContactName = string.IsNullOrEmpty(crm.First().MemberName) ? "" : crm.First().MemberName;
                    info.ContactPhone = crm.First().Tel;
                    info.MemberCardNo = crm.First().Uid;
                    info.OperatorId = Guid.NewGuid();//new Guid("6E4DE867-4AF0-2DEA-FC5C-036EB8637CAB")
                    info.OperatorName = "xxx";
                    info.CreateDate = DateTime.Now;
                    if (!string.IsNullOrEmpty(isQuick) && isQuick == "FastFood")
                    {
                        info.DiningDate = string.IsNullOrEmpty(bookTime) ? DateTime.Now : Convert.ToDateTime(bookTime);
                        //if (!string.IsNullOrEmpty(bookTime))
                        //{
                        //    info.DiningDate = Convert.ToDateTime(bookTime);
                        //}
                        //else {
                        //    info.DiningDate = Convert.ToDateTime("1997-10-1");
                        //}
                    }
                    else if (!string.IsNullOrEmpty(isQuick) && isQuick == "Auto")
                    {
                        info.PersonCount = Convert.ToInt32(peopleCont);
                        info.DiningDate = DateTime.Now;
                        //info.DiningDate = string.IsNullOrEmpty(bookTime) ? DateTime.Now : Convert.ToDateTime(bookTime);

                    }
                    else
                    {
                        info.DiningDate = string.IsNullOrEmpty(bookTime) ? DateTime.Now : Convert.ToDateTime(bookTime);

                    }

                    info.Status = OrderStatus.New;
                    info.ReserveType = "01";
                    string RestaurantId = Session["begindm"] != null ? Session["begindm"].ToString() : "";
                    if (!string.IsNullOrEmpty(RestaurantId))
                    {
                        info.RstId = new Guid(RestaurantId);
                    }
                    else
                    {
                        info.RstId = Guid.NewGuid();
                    }
                    i = odm.SaveOrders(type, info);
                    //ViewBag.MemberCardNo = info.MemberCardNo;
                    //ViewBag.OrderId = info.Id;
                }
                if (i == 1)
                {

                    return info.Id;
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return new Guid("00000000-0000-0000-0000-000000000000");
            }

            return new Guid("00000000-0000-0000-0000-000000000000");
        }