示例#1
0
        public IActionResult Index(string sortOrder, string searchString, string currentFilter, int?page)
        {
            ViewBag.lisEmail         = _userProfileDatabase.Find(s => s.IsDeleted == false).ToList();
            ViewData["NameSortParm"] = string.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }
            ViewData["CurrentFilter"] = searchString;

            BillListViewModel model = new BillListViewModel()
            {
                ListBill = _billDatabase.GetAll().ToList()
            };

            if (!string.IsNullOrEmpty(searchString))
            {
                model.ListBill = model.ListBill.Where(s => s.CreatedDate.ToShortDateString().ToLower().Contains(searchString.ToLower())).ToList();
            }
            switch (sortOrder)
            {
            case "name_desc":
                model.ListBill = model.ListBill.OrderByDescending(s => s.CreatedDate).ToList();
                break;
            }
            int pageSize = 10;

            return(View(PaginatedProductList <Bill> .Create(model.ListBill.AsQueryable(), page ?? 1, pageSize)));
        }
示例#2
0
        public IEnumerable <Bill> GetAllBills()
        {
            var billRecords = _billRepository.GetAll();

            if (billRecords.Count() == 0)
            {
                _billRepository.Populate();
                billRecords = _billRepository.GetAll();
            }

            var bills = billRecords.Select(record => new Bill(record)).ToList();

            ApplyOverduePenalties(bills);

            return(bills);
        }
示例#3
0
        public IActionResult GetAll()
        {
            passport = CommonMethod.GetPassport(Request);
            ResultModel result = new ResultModel(true, service.GetAll(passport));

            return(new ObjectResult(result));
        }
 public IActionResult Index()
 {
     ViewBag.ClientsCount    = _ClientRepository.GetAll().Count();
     ViewBag.ItemsCount      = _ItemRepository.GetAll().Count();
     ViewBag.CategoriesCount = _CategoryRepository.GetAll().Count();
     ViewBag.BillsCount      = _BillRepository.GetAll().Count();
     return(View());
 }
示例#5
0
 public IEnumerable <Bill> GetAll(string keyword)
 {
     if (!string.IsNullOrEmpty(keyword))
     {
         return(_billRepository.GetMulti(x => x.CustomerName.Contains(keyword) || x.CustomerPhone.Contains(keyword)));
     }
     else
     {
         return(_billRepository.GetAll());
     }
 }
示例#6
0
        public async Task <IEnumerable <ViewModelBillView> > GetAll()
        {
            var models = await _billRepository.GetAll();

            var interest = await _interestRuleRepository.GetAll();

            var view = new List <ViewModelBillView>();

            foreach (var item in models)
            {
                (int delayDays, decimal valueCorrected) = InterestCalculation(item, interest);

                view.Add(new ViewModelBillView(item, delayDays, valueCorrected));
            }

            return(view);
        }
        public IActionResult Index()
        {
            var top3Product = _database.BillProducts.GroupBy(bp => bp.ProductID)
                              .OrderByDescending(pd => pd.Count())
                              .Select(p => new { ProductID = p.Key, Quantity = p.Count() }).Take(3);

            List <Product> lisProduct = top3Product.Join(_database.Products,
                                                         bp => bp.ProductID,
                                                         p => p.ProductID,
                                                         (bd, p) => new Product()
            {
                ProductName = p.ProductName, Price = p.Price, Quantity = bd.Quantity, ProductImage = p.ProductImage
            })
                                        .ToList();

            ViewBag.lisTopPro = lisProduct;

            var lisBill = _billDatabase.GetAll();

            List <BillReportViewModel> lisBillReport = new List <BillReportViewModel>();

            for (int i = 3; i <= 7; i++)
            {
                BillReportViewModel tmp = new BillReportViewModel();
                tmp.Month      = i.ToString();
                tmp.OrderTotal = 0;
                lisBillReport.Add(tmp);
            }

            foreach (var item in lisBill)
            {
                foreach (var re in lisBillReport)
                {
                    if (re.Month == item.CreatedDate.Month.ToString())
                    {
                        re.OrderTotal += item.OrderTotal;
                    }
                }
            }

            ViewBag.lisReport = lisBillReport;


            return(View(lisProduct));
        }
示例#8
0
        public IHttpActionResult Get()
        {
            var sevenDaysAgo = DateTime.Now.AddDays(-7);
            var _userId      = User.Identity.GetUserId();
            var billEntitys  = _billRepo.GetAll().OrderByDescending(k => k.LastUpdatedOn).ToList();

            List <BillModel> billDtos = new List <BillModel>(billEntitys.Count());

            foreach (var e in billEntitys)
            {
                //var d = ModelFactory.Create(e);
                var d = AutoMapper.Mapper.Map <BillModel>(e);
                billDtos.Add(d);
            }
            var jsonSerializerSettings = new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
            var json = JsonConvert.SerializeObject(billDtos, Formatting.Indented, jsonSerializerSettings);

            return(Ok(billDtos));
        }
示例#9
0
 public IEnumerable <Bill> GetAll()
 {
     return(_billRepository.GetAll());
 }
 public IEnumerable <VBillWithOrganization> GetAll()
 {
     return(_repository.GetAll().Select((b) => b.ToServiceLayer()));
 }
示例#11
0
 // [Route("AllBillsDetails")]
 // GET: api/Bills
 public List <Bill> GetBills()
 {
     return(Repository.GetAll().ToList());
 }
示例#12
0
        public void Bill_Repository_GetAll()
        {
            var list = billRepository.GetAll().ToList();

            Assert.AreEqual(2, list.Count);
        }
示例#13
0
 public IEnumerable GetAll_S()
 {
     return(_repository.GetAll());
 }
示例#14
0
 public IEnumerable <Bill> GetAll(int pageIndex, int pageSize, out int totalRow)
 {
     return(billRepository.GetAll(pageIndex, pageIndex, out totalRow));
 }
示例#15
0
 /// <summary>
 /// Method whose purpose is to get all bill
 /// records from the database.
 /// </summary>
 /// <returns>Return all bill records from database
 /// as list of type IList<BillModel>.</returns>
 ///
 public IList <BillModel> GetAll()
 {
     return(_billBusinessLogic.GetAll());
 }