public IActionResult Delivery(newOrder model)
        {
            transportManager = new TransportManager();
            var route       = lb.returnRoute();
            var detailRoute = lb.returnRouteDetails();
            var category    = lb.returnCategory();
            var cost        = lb.returnCost();
            var orders      = lb.returnOrder();
            var value       = transportManager.returnRouteOrder(orders, route, detailRoute, category, cost);

            if (model.Flag.Equals("SortByName"))
            {
                ///  Console.WriteLine("sort");
                string v        = "SortByName";
                var    newValue = transportManager.SortName(v, value);
                return(View(newValue));
            }
            else if (model.Flag.Equals("SortByEmail"))
            {
                string v2 = "SortByEmail";
                //  Console.WriteLine("EmailSort");
                var newValue = transportManager.SortName(v2, value);
                return(View(newValue));
            }
            else if (model.Flag.Equals("GroupByType"))
            {
                var groups = transportManager.makeGroupping(value);
                return(View(groups));
            }
            else
            {
                return(View(value));
            }
        }
        public IActionResult Delivery()
        {
            var res = new List <newOrder>();

            transportManager = new TransportManager();
            var route       = lb.returnRoute();
            var detailRoute = lb.returnRouteDetails();
            var category    = lb.returnCategory();
            var cost        = lb.returnCost();
            var orders      = lb.returnOrder();
            var value       = transportManager.returnRouteOrder(orders, route, detailRoute, category, cost);

            foreach (var item in value)
            {
                var model = new newOrder
                {
                    Id               = item.Id,
                    Price            = item.Price,
                    FullName         = item.FullName,
                    Flag             = item.Flag,
                    Email            = item.Email,
                    Phone            = item.Phone,
                    Type             = item.Type,
                    Weight           = item.Weight,
                    FromWhereToWhere = item.FromWhereToWhere,
                    Days             = item.Days
                };
                res.Add(model);
            }


            return(View(res));
        }
Beispiel #3
0
        public HttpResponseMessage PostUsers(newOrder order)
        {
            if (Thread.CurrentPrincipal.Identity.AuthenticationType == "Admin" || Thread.CurrentPrincipal.Identity.AuthenticationType == "Employee" || Thread.CurrentPrincipal.Identity.AuthenticationType == "Regular")
            {
                string userName     = Thread.CurrentPrincipal.Identity.Name;
                string userIDNumber = db.Users.FirstOrDefault(user => user.userName == userName).idNumber;
                orders newOrder     = new orders();
                newOrder.carNumber    = order.carNumber;
                newOrder.startDate    = order.startDate;
                newOrder.endDate      = order.endDate;
                newOrder.userIDNumber = userIDNumber;


                db.orders.Add(newOrder);
                db.SaveChanges();

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }
Beispiel #4
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            newOrder or = new newOrder();

            or.Show(bl);
        }