Exemplo n.º 1
0
        private void LoadDataReport()
        {
            int year, month;

            if (radioButton_FromTo.Checked)
            {
                f = (DateTime)date_From.DateTime;
                t = (DateTime)date_To.DateTime;
            }
            else if (radioButton_MonthYear.Checked)
            {
                year  = Convert.ToInt32(spinEditMonthYear.Value);
                month = Convert.ToInt32(cbo_Month.EditValue);
                int daysOfMonth = DateTime.DaysInMonth(year, month);
                f = new DateTime(year, month, 1);
                t = new DateTime(year, month, daysOfMonth);
            }
            else if (radioButton_QuarterYear.Checked)
            {
                int fromMonth = 1, toMonth = 1;
                year = Convert.ToInt32(spinEditQuarterYear.EditValue);
                switch (Convert.ToInt32(cbo_Quarter.EditValue))
                {
                case 1:
                    fromMonth = 1;
                    toMonth   = 3;
                    break;

                case 2:
                    fromMonth = 4;
                    toMonth   = 6;
                    break;

                case 3:
                    fromMonth = 7;
                    toMonth   = 9;
                    break;

                case 4:
                    fromMonth = 10;
                    toMonth   = 12;
                    break;
                }
                int daysOfMonth = DateTime.DaysInMonth(year, toMonth);
                f = new DateTime(year, fromMonth, 1);
                t = new DateTime(year, toMonth, daysOfMonth);
            }
            else if (radioButton_Year.Checked)
            {
                year = Convert.ToInt32(spinEdit_Year.EditValue);
                int daysOfMonth = DateTime.DaysInMonth(year, 12);
                f = new DateTime(year, 1, 1);
                t = new DateTime(year, 12, daysOfMonth);
            }
            reportPhong      = new Report_HeSoSuDungPhong(f, t);
            reportPhongChart = new Report_HeSoPhong_Chart(f, t);
            phongBUS         = new PhongBUS();
            gridControl_ViewMode.DataSource = phongBUS.GetHeSoPhong(f, t);
        }