コード例 #1
0
        public long CountProductsPurchasedByInterval(DateTime fromDate, DateTime toDate)
        {
            long sum = 0;

            try
            {
                sum = _purchaseBillRepository.GetAll().Where(s =>
                                                             (s.CreatedDate.Year > fromDate.Year ||
                                                              (s.CreatedDate.Year == fromDate.Year && s.CreatedDate.Month > fromDate.Month ||
                                                               (s.CreatedDate.Year == fromDate.Year && s.CreatedDate.Month == fromDate.Month && s.CreatedDate.Day >= fromDate.Day))
                                                             ) &&
                                                             (s.CreatedDate.Year < toDate.Year ||
                                                              (s.CreatedDate.Year == toDate.Year && s.CreatedDate.Month < toDate.Month ||
                                                               (s.CreatedDate.Year == toDate.Year && s.CreatedDate.Month == toDate.Month && s.CreatedDate.Day <= toDate.Day))
                                                             )).Sum(p => p.PurchaseBillDetails.Sum(pd => (long)pd.Quantity));
            }
            catch (Exception)
            {
                //throw;
            }
            return(sum);
        }
コード例 #2
0
 public List <PurchaseBill> GetAll()
 {
     return(_purchaseBillRepository.GetAll().OrderByDescending(p => p.CreatedDate).ToList());
 }