Пример #1
0
        public ActionResult Index(int?ServiceId, int?page, string find)
        {
            if (ServiceId == null && find == null)
            {
                var allOrders = orderService.GetAll().OrderByDescending(m => m.CreateDate);
                OrderCollectionViewModel collectionOrders = new OrderCollectionViewModel(allOrders);

                ViewBag.Categoryes = new CategoryCollectionViewModel(categoryService.GetAllCategory());

                return(View(collectionOrders.ToPagedList(page ?? 1, 10)));
            }
            else if (find != null)
            {
                var findOrders = orderService.Find(m => m.ShortDescription.ToLower().Contains(find.ToLower()) ||
                                                   m.FullDescription.ToLower().Contains(find.ToLower()))
                                 .OrderByDescending(m => m.CreateDate);

                OrderCollectionViewModel collectionOrders = new OrderCollectionViewModel(findOrders);

                ViewBag.Categoryes = new CategoryCollectionViewModel(categoryService.GetAllCategory());

                return(View(collectionOrders.ToPagedList(page ?? 1, 10)));
            }
            else
            {
                var searchOrders = orderService.Find(m => m.ServiceId == ServiceId)
                                   .OrderByDescending(m => m.CreateDate);

                OrderCollectionViewModel collectionOrders = new OrderCollectionViewModel(searchOrders);

                ViewBag.Categoryes = new CategoryCollectionViewModel(categoryService.GetAllCategory());

                return(View(collectionOrders.ToPagedList(page ?? 1, 10)));
            }
        }
Пример #2
0
        public ActionResult CheckStock()
        {
            Stream req = Request.InputStream;

            req.Seek(0, System.IO.SeekOrigin.Begin);
            string json = new StreamReader(req).ReadToEnd();

            OrderCollectionViewModel orders = null;

            try
            {
                orders = JsonConvert.DeserializeObject <OrderCollectionViewModel>(json);
            }

            catch
            {
                // Try and handle malformed POST body
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Session["CURRENT_ORDERS"] = orders;
            OperationResult <string> result = new OperationResult <string>(true);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
 public OrdersFilterPaneCollapsed(OrderCollectionViewModel collectionViewModel)
     : base(() => CreateViewModel(() => new OrdersFilterTreeViewModel(collectionViewModel)))
 {
     InitializeComponent();
     presenterCore = CreatePresenter();
     BindCommands();
 }
 public OrdersFilterPaneCollapsed(OrderCollectionViewModel collectionViewModel)
     : base(typeof(OrdersFilterTreeViewModel), new object[] { collectionViewModel })
 {
     InitializeComponent();
     presenterCore = CreatePresenter();
     BindCommands();
 }
Пример #5
0
 public OrdersFilterPane(OrderCollectionViewModel collectionViewModel)
     : base(() => CreateViewModel(() => new OrdersFilterTreeViewModel(collectionViewModel))) {
     InitializeComponent();
     FiltersTreeListAppearances.Apply(treeList);
     this.presenterCore = CreatePresenter();
     BindCommands();
 }
Пример #6
0
        public ActionResult UserOrdersStatused(OrderStatus orderStatus)
        {
            IEnumerable <Order> orders;

            switch (orderStatus)
            {
            case OrderStatus.Active:
            {
                orders = orderService.Find(m => m.OrderStatus == OrderStatus.Active &&
                                           m.ClientProfileId == User.Identity.GetUserId())
                         .OrderByDescending(m => m.CreateDate);

                OrderCollectionViewModel ordersModel = new OrderCollectionViewModel(orders);

                return(View(ordersModel));
            }


            case OrderStatus.Accepted:
            {
                orders = orderService.Find(m => m.OrderStatus == OrderStatus.Accepted &&
                                           (m.ClientProfileId == User.Identity.GetUserId() ||
                                            m.ProviderProfileId == User.Identity.GetUserId()))
                         .OrderByDescending(m => m.CreateDate);

                OrderCollectionViewModel ordersModel = new OrderCollectionViewModel(orders);

                return(View(ordersModel));
            }

            case OrderStatus.Complited:
            {
                orders = orderService.Find(m => m.OrderStatus == OrderStatus.Complited &&
                                           (m.ClientProfileId == User.Identity.GetUserId() ||
                                            m.ProviderProfileId == User.Identity.GetUserId()))
                         .OrderByDescending(m => m.CreateDate);

                OrderCollectionViewModel ordersModel = new OrderCollectionViewModel(orders);

                return(View(ordersModel));
            }


            case OrderStatus.NotComplited:
            {
                orders = orderService.Find(m => m.OrderStatus == OrderStatus.NotComplited &&
                                           (m.ClientProfileId == User.Identity.GetUserId() ||
                                            m.ProviderProfileId == User.Identity.GetUserId()))
                         .OrderByDescending(m => m.CreateDate);

                OrderCollectionViewModel ordersModel = new OrderCollectionViewModel(orders);

                return(View(ordersModel));
            }

            default:
                return(HttpNotFound());
            }
        }
Пример #7
0
 public OrdersFilterPane(OrderCollectionViewModel collectionViewModel)
     : base(() => CreateViewModel(() => new OrdersFilterTreeViewModel(collectionViewModel)))
 {
     InitializeComponent();
     FiltersTreeListAppearances.Apply(treeList);
     this.presenterCore = CreatePresenter();
     BindCommands();
 }
 public OrdersFilterPane(OrderCollectionViewModel collectionViewModel)
     : base(typeof(OrdersFilterTreeViewModel), new object[] { collectionViewModel })
 {
     InitializeComponent();
     FiltersTreeListAppearances.Apply(treeList);
     this.presenterCore = CreatePresenter();
     BindCommands();
 }
Пример #9
0
        public ActionResult Feedbacks()
        {
            var userOrders = orderService.GetUserOrders(User.Identity.GetUserId()).OrderByDescending(m => m.CreateDate);

            OrderCollectionViewModel ordersModel = new OrderCollectionViewModel(userOrders);

            return(View(ordersModel));
        }
Пример #10
0
        public ActionResult <ViewModelCollection <Order> > GetOrders()
        {
            var orders = _orders.GetAll();

            if (!orders.Any())
            {
                return(NoContent());
            }

            var vm = OrderCollectionViewModel.From(Request, orders);

            return(Ok(vm));
        }
Пример #11
0
        public ActionResult <ViewModelCollection <Order> > GetbyCustomerId([FromQuery] int customerId)
        {
            var customerOrders = _orders.ByCustomer(customerId);

            if (!customerOrders.Any())
            {
                return(NoContent());
            }

            var vm = OrderCollectionViewModel.From(Request, customerOrders);

            return(Ok(vm));
        }
        public IActionResult All()
        {
            var orders = this.Context.Orders
                         .Select(o => new OrderViewModel
            {
                Id           = o.Id,
                CustomerName = o.Client.FullName,
                ProductName  = o.Product.Name,
                OrderedOn    = o.OrderedOn.ToString("hh:mm dd/MM/yyyy")
            })
                         .ToList();

            var orderCollection = new OrderCollectionViewModel
            {
                Orders = orders
            };

            return(this.View(orderCollection));
        }
Пример #13
0
 public OrdersFilterPaneCollapsed(OrderCollectionViewModel collectionViewModel)
     : base(() => CreateViewModel(() => new OrdersFilterTreeViewModel(collectionViewModel))) {
     InitializeComponent();
     presenterCore = CreatePresenter();
     BindCommands();
 }
Пример #14
0
 public OrderCollectionPresenter(GridControl gridControl, OrderCollectionViewModel viewModel, System.Action <int> updateUIAction)
     : base(gridControl, viewModel, updateUIAction)
 {
     GridControl.FocusedViewChanged += gridControl_FocusedViewChanged;
 }
Пример #15
0
 public OrderCollectionPresenter(GridControl gridControl, OrderCollectionViewModel viewModel, System.Action <int> updateUIAction)
     : base(gridControl, viewModel, updateUIAction)
 {
 }
Пример #16
0
 public OrderView(OrderCollectionViewModel orderCollectionViewModel)
 {
     InitializeComponent();
     DataContext = orderCollectionViewModel;
 }
Пример #17
0
 public MainOrderManager()
 {
     InitializeComponent();
     OrderVM = new OrderCollectionViewModel();
     bsiRecordsCount.Caption = "RECORDS : " + OrderVM.TotalOrders;
 }