Exemple #1
0
        public ActionResult AllOrders(Guid driverId) //список всех заказов
        {
            List <Order> orders = Parser.GetListOrders(Client.GetListOfOrders(driverId, 1));

            if (orders != null)
            {
                List <OrderDriver> ordersDriver = new List <OrderDriver>();
                for (int i = 0; i < orders.Count; i++)
                {
                    ordersDriver.Add(new OrderDriver(orders[i], Parser.GetDriver(Client.FindDriver(driverId))));
                }
                return(View(ordersDriver));
            }
            else
            {
                return(View(orders));
            }
        }
Exemple #2
0
        /*public ActionResult GetOrder(Guid driverId, Guid orderId) //взять заказ
         * {
         *  OrderDriver orderDriver = new OrderDriver(Parser.GetOrder(Client.FindOrder(orderId)), Parser.GetDriver(Client.FindDriver(driverId)));
         *  Client.GetOrder(orderDriver.Driver.ID, orderDriver.Order.ID);
         *  //Order orderToDo = Parser.GetOrder(Client.FindOrder(orderId));
         *  return RedirectToAction("ShowOrder", new { order = orderDriver.Order });
         * }*/

        /*public ActionResult ShowOrder(Guid idOrder, Guid idDriver)
         * {
         *  Order order = Parser.GetOrder(Client.FindOrder(idOrder));
         *  Driver driver = Parser.GetDriver(Client.FindDriver(idDriver));
         *  OrderDriver orderDriver = new OrderDriver(order, driver);
         *  return View(orderDriver);
         * }*/

        // [HttpPost]
        public ActionResult ShowOrder(Guid orderId, Guid driverId, string act) //подробности о заказе
        {
            Client = new ServiceReference1.WebServiceTaxiSoapClient();
            if (act == "ShowOrder")
            {
                Client.GetOrder(driverId, orderId);
                Order       order       = Parser.GetOrder(Client.FindOrder(orderId));
                Driver      driver      = Parser.GetDriver(Client.FindDriver(driverId));
                OrderDriver orderDriver = new OrderDriver(order, driver);
                //Client.GetOrder(orderDriver.Driver.ID, orderDriver.Order.ID);
                //Order order = Client.ShowOrder(orderDriver.Order.ID_Driver);
                //return View(orderDriver);
                return(View(orderDriver));
            }
            if (act == "StartTrip")
            {
                Client.StartTrip(driverId, orderId);
                Order       order       = Parser.GetOrder(Client.FindOrder(orderId));
                Driver      driver      = Parser.GetDriver(Client.FindDriver(driverId));
                OrderDriver orderDriver = new OrderDriver(order, driver);
                return(View(orderDriver));
            }
            if (act == "FinishTrip")
            {
                Client.FinishTrip(driverId, orderId);
                Order       order       = Parser.GetOrder(Client.FindOrder(orderId));
                Driver      driver      = Parser.GetDriver(Client.FindDriver(driverId));
                OrderDriver orderDriver = new OrderDriver(order, driver);
                return(View(orderDriver));
            }
            if (act == "Update")
            {
                Order       order       = Parser.GetOrder(Client.FindOrder(orderId));
                Driver      driver      = Parser.GetDriver(Client.FindDriver(driverId));
                OrderDriver orderDriver = new OrderDriver(order, driver);
                if (orderDriver.Order.Status == "3")
                {
                    //order1 = null;
                    return(View(orderDriver));
                }
            }
            return(View());
        }
Exemple #3
0
        public ActionResult Edit(Guid driverId, Guid authId)
        {
            Driver        driver     = Parser.GetDriver(Client.FindDriver(driverId));
            Authorization auth       = Parser.GetAuth(Client.FindAuth(authId));
            DriverAuth    driverAuth = new DriverAuth(auth, driver);

            if (Client.EditDriverProfile(Parser.ParseAuth(auth), Parser.ParseDriver(driver)) == false)
            {
                ModelState.AddModelError("", "Данный логин уже занят");
            }
            else
            {
                Client.EditDriverProfile(Parser.ParseAuth(driverAuth.Auth), Parser.ParseDriver(driverAuth.Driver));
            }

            return(View(driverAuth));
        }