Exemplo n.º 1
0
        public ActionResult IndexCustomer(CustomerCriteria criteria, string currentFilter, int?page = 1)
        {
            int pageNumber = (page ?? 1);

            this.ViewBag.CurrentFilter = criteria;
            if (!string.IsNullOrEmpty(currentFilter))
            {
                return(this.IndexCustomer(criteria, page));
            }
            var obj  = CustomerList.GetCustomerList().OrderByDescending(x => x.CreatedDate).ToPagedList(pageNumber, this.pageSize);
            var list = new ISAT.Web.ViewModel.CustomerViewModel();

            foreach (var item in obj)
            {
                var cust = Business.Customer.NewCustomer();
                cust.FirstName   = item.FirstName;
                cust.LastName    = item.LastName;
                cust.Email       = item.Email;
                cust.CustNo      = item.CustNo;
                cust.CompanyName = item.CompanyName;
                cust.CreatedDate = item.CreatedDate;
                cust.CreatedBy   = item.CreatedBy;
                list.ListCustomer.Add(cust);
            }

            var viewModel = new CustomerViewModel()
            {
                ListCustomer = list.ListCustomer.ToList(),
                Criteria     = new CustomerCriteria()
            };
            var onePageOfProducts = list;

            ViewBag.OnePageOfProducts = obj;
            return(View(viewModel));
        }
Exemplo n.º 2
0
        public ActionResult ExportExcelCustomerData(CustomerCriteria criteria)
        {
            var headerDictionary = new Dictionary <string, string>();

            this.ViewBag.CurrentFilter = criteria;

            var obj  = CustomerList.GetCustomerList();
            var list = new ISAT.Web.ViewModel.CustomerViewModel();

            foreach (var item in obj)
            {
                var cust = Business.Customer.NewCustomer();
                cust.FirstName   = item.FirstName;
                cust.LastName    = item.LastName;
                cust.Email       = item.Email;
                cust.CustNo      = item.CustNo;
                cust.CompanyName = item.CompanyName;
                cust.CreatedDate = item.CreatedDate;
                cust.CreatedBy   = item.CreatedBy;
                list.ListCustomer.Add(cust);
            }

            var viewModel = new CustomerViewModel()
            {
                ListCustomer = list.ListCustomer.OrderByDescending(x => x.CreatedDate).ToList(),
                Criteria     = new CustomerCriteria()
            };

            try
            {
                IExporter exporter = new CustomerDataExcelExporter(this.Response, viewModel.ListCustomer);
                exporter.Export();
            }
            catch
            {
                throw;
            }
            return(this.View("IndexCustomer", viewModel));
        }
Exemplo n.º 3
0
        public ActionResult IndexCustomer(CustomerCriteria criteria, int?page = 1)
        {
            int pageNumber = (page ?? 1);

            this.ViewBag.CurrentFilter = criteria;

            var obj = CustomerList.GetCustomerList().Where(o => (criteria.FirstName == null || o.FirstName.ToLower().Contains(criteria.FirstName.ToLower())) &&
                                                           (criteria.LastName == null || o.LastName.ToLower().Contains(criteria.LastName.ToLower())) &&
                                                           (criteria.Email == null || o.Email.ToLower().Contains(criteria.Email.ToLower())) &&
                                                           (criteria.CompanyName == null || o.CompanyName.ToLower().Contains(criteria.CompanyName.ToLower()) &&
                                                            (criteria.CustNo == null || o.CustNo.ToLower().Contains(criteria.CustNo.ToLower()))))
                      .Select(o => o).ToPagedList(pageNumber, this.pageSize);
            var list = new ISAT.Web.ViewModel.CustomerViewModel();

            foreach (var item in obj)
            {
                var cust = Business.Customer.NewCustomer();
                cust.FirstName   = item.FirstName;
                cust.LastName    = item.LastName;
                cust.Email       = item.Email;
                cust.CustNo      = item.CustNo;
                cust.CompanyName = item.CompanyName;
                cust.CreatedDate = item.CreatedDate;
                cust.CreatedBy   = item.CreatedBy;
                list.ListCustomer.Add(cust);
            }
            var viewModel = new CustomerViewModel()
            {
                ListCustomer = list.ListCustomer.OrderByDescending(x => x.CreatedDate).ToList(),
                Criteria     = new CustomerCriteria()
            };
            var onePageOfProducts = list;

            ViewBag.OnePageOfProducts = obj;
            return(View(viewModel));
        }