Пример #1
0
        public List <ThongKeTheoNgay> ThongKeGiaoDichTheoNgay(DateTime tuNgay, DateTime denNgay)
        {
            var list = new List <ThongKeTheoNgay>();

            try
            {
                var currentDate = tuNgay;
                while (currentDate <= denNgay)
                {
                    var count = db.GiaoDichRutTiens.Where(a => DbFunctions.TruncateTime(a.NgayTao) == currentDate.Date).Count();
                    var item  = new ThongKeTheoNgay
                    {
                        Ngay  = currentDate,
                        Count = count
                    };
                    list.Add(item);
                    currentDate = currentDate.AddDays(1);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(list);
        }
Пример #2
0
        public List <ThongKeTheoNgay> ThongKeKhachHangTheoNgay(DateTime tuNgay, DateTime denNgay)
        {
            var list = new List <ThongKeTheoNgay>();

            try
            {
                var currentDate = tuNgay;
                while (currentDate <= denNgay)
                {
                    var count = db.KhachHangs.Where(a => a.NgayTao.Date == currentDate.Date).Count();
                    var item  = new ThongKeTheoNgay
                    {
                        Ngay  = currentDate,
                        Count = count
                    };
                    list.Add(item);
                    currentDate = currentDate.AddDays(1);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(list);
        }