public ActionResult OrderView()
        {
            var customers  = _customerSearchService.GetCustomers();
            var categories = _orderCategorySearchService.GetCategories();

            ViewData["customers"] = customers.Select(s => new SelectListItem {
                Text = s.Name, Value = s.Id.ToString()
            });
            ViewData["categories"] = categories.Select(s => new SelectListItem {
                Text = s.Name, Value = s.Id.ToString()
            });
            return(View());
        }
        public ActionResult Export(CustomerPageQueryModel query)
        {
            var customers  = _customerSearchService.GetCustomers(query);
            var properties = _customerPropertyService.SearchService.GetColumns();
            var model      = new ExportDataHaveColumnModel <CustomerModel, CustomerPropertyModel>
            {
                Datas   = customers,
                Columns = properties
            };
            var datas    = _dataExporter.Export <CustomerModel, CustomerPropertyModel>(model);
            var fileName = _dataExporter.CreateFileName("客户");

            return(File(datas, "application/ms-excel", fileName));
        }
Exemple #3
0
        public void Wrapper(List <DeliveryNoteModel> notes)
        {
            if (!notes.Any())
            {
                return;
            }
            var customerIds = notes.Select(s => s.CustomerId);
            var customers   = _customerSearchService.GetCustomers(customerIds);

            notes.ForEach(note =>
            {
                var customer = customers.FirstOrDefault(s => s.Id == note.CustomerId);
                if (customer != null)
                {
                    note.CustomerName = customer.Name;
                }
            });
        }
        public void Wrapper(List <CustomerFinanceModel> finances)
        {
            if (!finances.Any())
            {
                return;
            }
            var customerIds = finances.Select(s => s.CustomerId);
            var customers   = _customerSearchService.GetCustomers(customerIds);

            finances.ForEach(order =>
            {
                var customer = customers.FirstOrDefault(s => s.Id == order.CustomerId);
                if (customer != null)
                {
                    order.CustomerName = customer.Name;
                }
            });
        }