public List <BusinessModel.OrderSummary> GetUserOrders(string memberCardNo)
        {
            List <BusinessModel.OrderSummary> list = null;

            OrderDal orderDal = new OrderDal();

            var entities = orderDal.GetUserOrders(memberCardNo);

            if (entities != null && entities.Count > 0)
            {
                list = entities.Select(v => new BusinessModel.OrderSummary
                {
                    OrderId        = v.OrderId,
                    RestaurantId   = v.RestaurantId,
                    RestaurantName = v.RestaurantName,
                    ContactName    = v.ContactName,
                    ContactPhone   = v.ContactPhone,
                    TotalMoney     = v.TotalMoney,
                    Status         = v.Status,
                    DiningDate     = v.DiningDate,
                    CreateTime     = v.CreateTime,
                    Backlog        = v.Backlog,
                    PersonCount    = v.PersonCount
                }).ToList();
            }

            return(list);
        }
Beispiel #2
0
        public Order Get(int id)
        {
            OrderDal dal   = new OrderDal();
            Order    order = dal.Read(id, true);

            return(order);
        }
Beispiel #3
0
        /// <summary>
        /// 批量删除
        /// </summary>
        public ResultSet DeleteList(string where)
        {
            Func<string, ResultStatus> validate = (_where) =>
            {
                if (String.IsNullOrEmpty(_where))
                    return new ResultStatus()
                    {
                        Code = StatusCollection.ParameterError.Code,
                        Description = "参数 where 不能为空",
                        Success = false
                    };
                 return new ResultStatus();
            };

            Func<string,ResultStatus> op = (_where) =>
            {
                int ret = new OrderDal().DeleteList(_where);
                if (ret > 0)
                    return new ResultStatus();
                else
                    return new ResultStatus()
                    {
                        Success = false,
                        Code = StatusCollection.UpdateFailed.Code,
                        Description = StatusCollection.UpdateFailed.Description
                    };
            };

            return HandleBusiness(where, op, validate);
        }
        public ActionResult updateOrder(OrderViewModel o)
        {
            //This function will change "supply" area if the guitar have been supported. Will be edit by the Admin.
            OrderDal     oDal  = new OrderDal();
            List <Order> obj   = oDal.Orders.ToList();
            int          check = 0;

            foreach (Order ord in obj)
            {
                if (ord.oid == o.order.oid)//Check if the order id that the admin entered is the same as the database oder id
                {
                    check      = 1;
                    ord.supply = true;//Change the supply value
                    oDal.SaveChanges();
                    break;
                }
            }

            if (check == 0) //Check will be the flag to be sure which message to show
            {
                Session["Error"] = "This order ID does not exists!";
            }
            else
            {
                Session["Error"] = "This order ID successfuly updated!";
            }

            return(RedirectToAction("ViewOrders"));
        }
 public ShowTheBasketForm(int id)
 {
     _id       = id;
     _orderDal = new OrderDal();
     _bookDal  = new BookDal();
     InitializeComponent();
 }
Beispiel #6
0
    /// <summary>
    /// 用户选择需分拣的线路后进行数据优化
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnContinue_Click(object sender, EventArgs e)
    {
        string selectedRoutes = "";

        foreach (GridViewRow row in gvRoute.Rows)
        {
            if (row.Cells[0].Controls.Count != 0 && ((CheckBox)row.Cells[0].Controls[0]).Checked)
            {
                selectedRoutes += string.Format("'{0}',", row.Cells[1].Text);
            }
        }

        if (selectedRoutes.Trim().Length != 0)
        {
            selectedRoutes = selectedRoutes.Substring(0, selectedRoutes.Length - 1);

            //清除用户选择之外的数据
            OrderDal orderDal = new OrderDal();
            orderDal.DeleteNoUseOrder(Session["OrderDate"].ToString(), Convert.ToInt32(Session["BatchNo"]), selectedRoutes);

            Session["OptimizeStatus"] = "<root><status>CONTINUE</status><message></message></root>";
            JScript.Instance.RegisterScript(Page, "post=true;");
            thread = new Thread(new ThreadStart(Optimize));
            thread.Start();
            pnlMain.Visible  = true;
            pnlRoute.Visible = false;
        }
        else
        {
            JScript.Instance.ShowMessage(Page, "请选择要进行优化的线路。");
        }
    }
Beispiel #7
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public ResultSet Add(Order entity)
        {
            Func <Order, ResultStatus> validate = (_entity) =>
            {
                return(new ResultStatus());
            };

            Func <Order, ResultStatus> op = (_entity) =>
            {
                int ret = new OrderDal().Add(entity);
                if (ret > 0)
                {
                    return(new ResultStatus());
                }
                else
                {
                    return new ResultStatus()
                           {
                               Success     = false,
                               Code        = StatusCollection.AddFailed.Code,
                               Description = StatusCollection.AddFailed.Description
                           }
                };
            };

            return(HandleBusiness(entity, op, validate));
        }
Beispiel #8
0
        /// <summary>
        /// PC端订单集合分页查询
        /// 请勿删除
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="recordCount"></param>
        /// <returns></returns>
        public List <OrderDto> GetOrderDtoList(int?pageIndex, int?pageSize, string HyName, ref int recordCount)
        {
            OrderDal dal = new OrderDal();

            recordCount = dal.GetCount(HyName);
            return(dal.GetOrderDtoList(pageIndex, pageSize, HyName));
        }
        public ActionResult LockRoom(AppointRq rq)
        {
            if (MemberInfo.Role != (int)MemberRole.管理员)
            {
                return(Content("没有权限"));
            }

            var model = new Order
            {
                MemberId    = MemberInfo.Uid,
                CustomName  = "",
                CustomPhone = "",
                Room        = rq.Room,
                Status      = (int)OrderStatus.已锁定,
                CreateOn    = DateTime.Now.ToUnixStamp(),
                StartTime   = rq.Start.ToUnixStamp(),
                EndTime     = rq.Start.AddMinutes(WeispaConfig.ServiceMinutes).ToUnixStamp(),
                Remark      = rq.Remark
            };

            var isExist = OrderDal.Exists(string.Format("{0} and Room={1} and (Status={2} or Status={3})",
                                                        WeispaUtil.GetOccurredSql(model.StartTime, model.EndTime),
                                                        model.Room, (int)OrderStatus.已确认, (int)OrderStatus.已锁定));

            if (isExist)
            {
                return(ReturnJson(false, "改房间已被预订,请先取消预订才可锁定"));
            }

            var orderId = OrderDal.Add(model);

            return(ReturnJson(true, new { status = 2, opts = 2, orderId }));
        }
        public BusinessModel.OrderDetail GetOrderDetailById(Guid orderId)
        {
            BusinessModel.OrderDetail detail = null;

            OrderDal orderDal = new OrderDal();

            var orderSummary = orderDal.GetOrderSummary(orderId);

            if (orderSummary != null)
            {
                detail = new BusinessModel.OrderDetail();

                detail.OrderId     = orderSummary.OrderId;
                detail.ContactName = orderSummary.ContactName;
                detail.Telephone   = orderSummary.ContactPhone;
                detail.DiningDate  = orderSummary.DiningDate;
                detail.CreateTime  = orderSummary.CreateTime;
                detail.Backlog     = orderSummary.Backlog;
                detail.PersonCount = orderSummary.PersonCount;
                detail.Status      = orderSummary.Status;
                detail.TotalMoney  = orderSummary.TotalMoney;

                var details = orderDal.GetOrderDetails(orderId);

                if (details != null)
                {
                    if (detail.TotalMoney == 0)
                    {
                        detail.TotalMoney = details.First().TotalPrice;
                    }
                    var productIds = details.Select(v => v.ProductId).ToList();
                    var products   = orderDal.GetProducts(productIds);

                    if (products != null && products.Count > 0)
                    {
                        detail.ProductList = new List <BusinessModel.Product>();

                        foreach (var subDetail in details)
                        {
                            var productDetail = products.FirstOrDefault(v => v.ProductId == subDetail.ProductId);
                            if (productDetail != null)
                            {
                                var product = new BusinessModel.Product();

                                product.ProductId = subDetail.ProductId;
                                product.UnitPrice = subDetail.UnitPrice;
                                product.Count     = subDetail.ProductCount;

                                product.ProductName = productDetail.ProductName;
                                productDetail.Image = productDetail.Image;

                                detail.ProductList.Add(product);
                            }
                        }
                    }
                }
            }

            return(detail);
        }
Beispiel #11
0
        public OrderResult PlaceOrder(Order order)
        {
            OrderResult   result       = new OrderResult();
            List <string> quotationIds = new List <string>();

            try
            {
                List <Output> quotations = order.QuotationDetail;
                foreach (Output quotation in quotations)
                {
                    quotationIds.Add(new QuotationDal().Insert(quotation).ToString());
                }

                order.QuotationId = quotationIds;
                OrderDal dal = new OrderDal();
                result.OrderId = dal.Insert(order);
                result.Status  = "Success";
            }
            catch (Exception ex)
            {
                result.Status = ex.Message;
            }

            return(result);
        }
Beispiel #12
0
        public List <Order> GetOrdersByConditions(string username, DateTime dateFrom, DateTime dateTo,
                                                  int orderIdFrom, int orderIdTo, int orderId, int offset)
        {
            SearchOrderCondition conditions = new SearchOrderCondition()
            {
                Username    = username,
                OrderIdFrom = orderIdFrom,
                OrderIdTo   = orderIdTo,
                Offset      = offset,
                OrderId     = orderId,
            };

            DateTime systemDefault = new DateTime();

            if (dateFrom != systemDefault)
            {
                conditions.DateFrom = dateFrom;
            }

            if (dateTo != systemDefault)
            {
                conditions.DateTo = dateTo;
            }

            OrderDal dal = new OrderDal();

            return(dal.ReadAllByCondition(conditions));
        }
Beispiel #13
0
        public static void Insert(Order order)
        {
            OperationsLogs.WriteLogsDebug("VentaBrl", "Insertar", string.Format("{0} Info: {1}",
                                                                                DateTime.Now.ToString(),
                                                                                "Empezando a ejecutar el método lógica de negocio para crear un Venta"));

            try
            {
                OrderDal.Insert(order);
            }
            catch (SqlException ex)
            {
                OperationsLogs.WriteLogsRelease("VentaBrl", "Insertar", string.Format("{0} Error: {1}",
                                                                                      DateTime.Now.ToString(), DateTime.Now.ToString(), ex.Message));
                throw ex;
            }
            catch (Exception ex)
            {
                OperationsLogs.WriteLogsRelease("VentaBrl", "Insertar", string.Format("{0} Error: {1}",
                                                                                      DateTime.Now.ToString(), DateTime.Now.ToString(), ex.Message));
                throw ex;
            }

            OperationsLogs.WriteLogsDebug("VentaBrl", "Insertar", string.Format("{0} Info: {1}",
                                                                                DateTime.Now.ToString(), DateTime.Now.ToString(),
                                                                                "Termino de ejecutar  el método lógica de negocio para insertar Venta"));
        }
Beispiel #14
0
        public ActionResult Order(Order o)
        {                 //Function for user to order a guitar from the list.
            o.oid = 1000; //BASE order id
            int check = 0;

            o.email = Session["Email"].ToString();
            o.date  = DateTime.Now.Date.ToLongDateString();//based
            ProductsDal    pDal = new ProductsDal();
            List <Product> obj  = pDal.Products.ToList();

            foreach (Product p in obj)
            {
                if (p.pid == o.pid)
                {
                    check = 1;
                }
            }
            if (check == 0)//Check if product exists
            {
                Session["Error"] = "Product ID not exists!";
                return(RedirectToAction("NewOrder"));
            }
            OrderDal oDal = new OrderDal();//SAVING PART in order list

            try {
                oDal.Orders.Add(o);
                oDal.SaveChanges();
            }
            catch
            {
            }
            //oDal.Orders.Add(o);
            //oDal.SaveChanges();
            return(RedirectToAction("Purchase", o));
        }
Beispiel #15
0
        public string GetShippingMethodListFromService()
        {
            var    orderDal = new OrderDal();
            string theXml   = orderDal.GetShippingMethodFromDBXml();

            return(theXml);
        }
Beispiel #16
0
    /// <summary>
    /// 绑定分拣线路数据
    /// </summary>
    private void BindData()
    {
        OrderDal  orderDal = new OrderDal();
        DataTable table    = orderDal.GetOrderRoute(Session["OrderDate"].ToString(), Convert.ToInt32(Session["BatchNo"]));

        BindTable2GridView(gvRoute, table);
    }
Beispiel #17
0
        /// <summary>
        /// this function we open a connection and gets its info from the form
        /// she then checks the validity of the data and inserts it to the database
        /// </summary>
        public ActionResult AddOrder()
        {
            if (Session["Manager"] == null)
            {
                TempData["Result"] = true;
                return(RedirectToAction("", ""));
            }
            OrderVM  cvm      = new OrderVM();
            Order    objOrder = new Order();
            OrderDal dal      = new OrderDal();

            objOrder.orderAmount = Request.Form["Order.orderAmount"];
            objOrder.OrderName   = Request.Form["Order.OrderName"];

            if (ModelState.IsValid)
            {
                dal.Orders.Add(objOrder);
                dal.SaveChanges();
                cvm.Order = new Order();
            }
            else
            {
                ViewBag.TheResult = true;
                return(View("NewOrder"));
            }

            cvm.Orders = dal.Orders.ToList <Order>();

            return(View("NewOrder", cvm));
        }
        public ActionResult WatchListPage()
        {//take us to the page view that will show us the user novies he paid to watch
            //Check the user Watch List and update the list if neccery
            CheckWatchList(Session["UserName"].ToString());

            //connect to db Order
            OrderDal     dal         = new OrderDal();
            List <Movie> movies_list = new List <Movie>();
            string       UsreName    = Session["UserName"].ToString();

            //get the movies that was paid by the user
            List <Order> ord_list = (from o in dal.Orders
                                     where o.UserName == UsreName &&
                                     o.Paid == "true"
                                     select o).ToList <Order>();

            //creat the movie list with only the movies the user paid for
            foreach (Order o in ord_list)
            {
                movies_list.Add(GetMovie(o.MovieName));
            }

            MovieList list = new MovieList();

            list.movies = movies_list;

            return(View(list));
        }
 public BookReturnForm()
 {
     _bookDal  = new BookDal();
     _orderDal = new OrderDal();
     InitializeComponent();
     FillDataOrder();
 }
Beispiel #20
0
        public ActionResult getordersJson()
        {
            OrderDal     dal    = new OrderDal();
            List <Order> orders = dal.order.ToList <Order>();

            return(Json(orders, JsonRequestBehavior.AllowGet));
        }
Beispiel #21
0
        public List <Order> SearchOrderByMemberDetail(string searchText, int offset)
        {
            List <Order> result = new List <Order>();
            OrderDal     dal    = new OrderDal();

            result = dal.ReadAllByUserSearch(searchText, offset);
            return(result);
        }
Beispiel #22
0
        public ActionResult SearchOrder(string key)
        {
            OrderDal dal   = new OrderDal();
            var      model = dal.SearchOrder(key);

            TempData["list"] = model;
            return(RedirectToAction("Display"));
        }
Beispiel #23
0
        public static bool addOrder(OrderDto order)
        {
            Order o = OrderDto.ToDal(order);
            bool  b = OrderDal.addOrder(o);
            bool  c = OrderToProductBl.addOrdersProducts(order.orderItems, o.orderId);

            return(b && c);
        }
Beispiel #24
0
        public static void UseNHibernate()
        {
            Order order = new Order();

            order.OrderId   = new Guid("088FB71D-34A3-47D4-BC1F-3B61FEBCEDD1");
            order.OrderDate = DateTime.Now;
            OrderDal.DeleteOrder(order);
        }
        public ActionResult getOrdersByJson()
        {
            //Json- return json with order list
            OrderDal     oDal = new OrderDal();
            List <Order> obj  = oDal.Orders.ToList();

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
 public OrdersForm(Manager manager)
 {
     _manager     = manager;
     _orderDal    = new OrderDal();
     _customerDal = new CustomerDal();
     _bookDal     = new BookDal();
     InitializeComponent();
 }
        public void DisplayMenu()
        {
            Console.WriteLine("Welcome to World Electronics Where Technology Meets Creativity");
            Console.WriteLine("How May I Help Today. Enter 'B' for Shoping; 'C' to get Customer's Information");
            Console.WriteLine("Or 'S' for Store Locationss and 'V' to view Orders History:");

            string str = Console.ReadLine();

            //check if the user input the right variable
            while (str.Length > 1)
            {
                Console.WriteLine("Welcome to World Electronics Where Technology Meets Creativity");
                Console.WriteLine("How May I Help Today. Enter 'B' for Shoping; 'C' to get Customer's Information");
                Console.WriteLine("Or 'S' for Store Locationss and 'V' to view Orders History:");

                str = Console.ReadLine();
            }
            char choice;
            //this allows the usee to enter input in lower case
            string ch = str.ToUpper();

            choice = ch[0];
            using project0Context context = new project0Context();
            Cart cart = new Cart();

            switch (choice)
            {
            case 'B':
                cart.Buying(context);
                BackToMenu();
                break;

            case 'C':
                CustomerDal customer = new CustomerDal();
                customer.CustomersHome(context);
                BackToMenu();
                break;

            case 'V':
                OrderDal order = new OrderDal();
                order.DisplayCustomerHist(context, 1);
                BackToMenu();
                break;

            case 'S':
                StoreDal store = new StoreDal();
                Console.WriteLine("showing store 1:");
                store.ShowStoreAddress(context, 1);
                BackToMenu();
                break;

            default:
                BackToMenu();
                break;
            }
        }
Beispiel #28
0
        public OrderViewModel OVM()
        {
            OrderDal          orderdal  = new OrderDal();
            OrderViewModel    ovm       = new OrderViewModel();     //pvm product view model
            List <OrderModel> orderList = orderdal.OrderData.ToList <OrderModel>();

            ovm.orderModel     = new OrderModel();
            ovm.orderModelList = orderList;
            return(ovm);
        }
        public EntityModel.OrderSummary GetOrderSummary(Guid orderId)
        {
            EntityModel.OrderSummary summary = null;

            OrderDal orderDal = new OrderDal();

            summary = orderDal.GetOrderSummary(orderId);

            return(summary);
        }
Beispiel #30
0
        public ActionResult GetOrdersByJson()
        {
            //display to user all orders by json
            OrderDal dal = new OrderDal();

            Thread.Sleep(3000);
            List <Order> objOrders = dal.orders.ToList <Order>();

            return(Json(objOrders, JsonRequestBehavior.AllowGet));
        }
        public ActionResult ViewOrders()
        {
            //Open orders db and fill ovm with the orders
            OrderDal       oDal = new OrderDal();
            List <Order>   obj  = oDal.Orders.ToList();
            OrderViewModel ovm  = new OrderViewModel();

            ovm.Orders = obj;
            return(View(ovm));
        }
Beispiel #32
0
        /// <summary>
        /// 添加一条记录
        /// </summary>
        public ResultSet Add(Order entity)
        {
            Func<Order, ResultStatus> validate = (_entity) =>
            {
                return new ResultStatus();
            };

            Func<Order, ResultStatus> op = (_entity) =>
            {
                int ret = new OrderDal().Add(entity);
                if (ret > 0)
                    return new ResultStatus();
                else
                    return new ResultStatus()
                    {
                        Success = false,
                        Code = StatusCollection.AddFailed.Code,
                        Description = StatusCollection.AddFailed.Description
                    };
            };

            return HandleBusiness(entity, op, validate);
        }
Beispiel #33
0
        /// <summary>
        /// 更新
        /// </summary>
        public ResultSet Update(string fields, object param, string where)
        {
            Func<string, object, string, ResultStatus> validate = (_fields, _param, _where) =>
            {
                if (String.IsNullOrEmpty(_fields))
                    return new ResultStatus()
                    {
                        Code = StatusCollection.ParameterError.Code,
                        Description = "参数 fields 不能为空",
                        Success = false
                    };

                if (_param == null)
                    return new ResultStatus()
                    {
                        Code = StatusCollection.ParameterError.Code,
                        Description = "参数 param 不能为空",
                        Success = false
                    };

                return new ResultStatus();
            };

            Func<string, object, string, ResultStatus> op = (_fields, _param, _where) =>
            {
                int ret = new OrderDal().Update(_fields, _param, _where);
                if (ret > 0)
                    return new ResultStatus();
                else
                    return new ResultStatus()
                    {
                        Success = false,
                        Code = StatusCollection.UpdateFailed.Code,
                        Description = StatusCollection.UpdateFailed.Description
                    };
            };

            return HandleBusiness(fields, param, where, op, validate);
        }
 public Guid OrderTicket(Contracts.Order newOrder)
 {
     OrderDal dal = new OrderDal();
     return dal.CreateEntity(newOrder);
 }
 public void UpdateOrder(Contracts.Order newOrder)
 {
     OrderDal dal = new OrderDal();
     dal.UpdateEntity(newOrder);
 }
 public void DeleteOrder(Guid orderID)
 {
     OrderDal dal = new OrderDal();
     dal.DeleteEntity(orderID);
 }
 public Contracts.Order[] FindOrdersByCriteria(Contracts.OrderCriteria criteria)
 {
     OrderDal dal = new OrderDal();
     return dal.GetOrdersByCriteria(criteria);
 }
 public Contracts.Order FindOrder(Guid OrderID)
 {
     OrderDal dal = new OrderDal();
     return dal.GetEntity(OrderID);
 }
 public Guid[] GetBestCustomersID(int numOfCustomers)
 {
     OrderDal dal = new OrderDal();
     return dal.GetBestCustomersID(numOfCustomers);
 }
Beispiel #40
0
        /// <summary>
        /// 获取所有
        /// </summary>
        public ResultSet<Page<Order>> GetAll(string fields, int pageIndex, int pageSize, string where, object param, string orderBy)
        {
            Func<string, int, int, string, object, string, ResultStatus> validate = (_fields, _pageIndex, _pageSize, _where, _param, _orderBy) =>
            {
                if (_pageIndex <= 0)
                    return new ResultStatus()
                    {
                        Code = StatusCollection.ParameterError.Code,
                        Description = "参数 pageIndex 必须大于0",
                        Success = false
                    };

                if (_pageSize <= 0 || _pageSize > 100)
                    return new ResultStatus()
                    {
                        Code = StatusCollection.ParameterError.Code,
                        Description = "参数 pageSize 必须大于0,且小于等于100",
                        Success = false
                    };

                return new ResultStatus();
            };

            Func<string, int, int, string, object, string, Page<Order>> op = (_fields, _pageIndex, _pageSize, _where, _param, _orderBy) =>
            {
                int recordCount = 0;

                IList<Order> list = new OrderDal().GetAll(_fields, _pageIndex, _pageSize, _where, _param, _orderBy, out recordCount);
                return new Page<Order>(_pageIndex, _pageSize, recordCount, list);
            };

            return HandleBusiness(fields, pageIndex, pageSize, where, param, orderBy, op, validate);
        }