private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { DateTime startDay = this.dateTimePicker1.Value.Date; string startTime = startDay.ToString("yyyy-MM-dd") + " 00:00:00"; if (!this.startDate.Equals(startTime)) { quanLyCommentBus.LoadBinhLuanInPeriod(this.conn, startTime, this.endDate); List <CommentDTO> listComments = quanLyCommentBus.listBinhLuan; this.commentStatistic = new CommentStatisticDTO(listComments); this.startDate = startTime; handleData(); } }
/// <summary> /// Default constructor /// </summary> public CommentStatistic() { this.conn = new Connection(); DateTime serverTime = DateTime.Now; string startTime = serverTime.ToString("yyyy-MM-dd") + " 00:00:00"; string endTime = serverTime.AddDays(1).ToString("yyyy-MM-dd") + " 00:00:00"; this.startDate = startTime; this.endDate = endTime; quanLyCommentBus.LoadBinhLuanInPeriod(conn, startTime, endTime); this.InitializeComponent(); List <CommentDTO> listComments = quanLyCommentBus.listBinhLuan; this.commentStatistic = new CommentStatisticDTO(listComments); handleData(); }