예제 #1
0
        private void ReportMembersAttendanceSummaryLoad()
        {
            DataSet   ds = new DataSet();
            DataTable dt = new DataTable("MembersAttendanceSummary");

            dt.Columns.Add("member_id");
            dt.Columns.Add("first_name");
            dt.Columns.Add("last_name");
            dt.Columns.Add("number_of_attendances");

            ds.Tables.Add(dt);
            List <MemberAttendanceSummaryDTO> membersAttendanceSummary =
                AttendanceDAO.getMembersAttendanceSummaryInDateRange(dateFrom, dateTo);

            foreach (var memberAttendance in membersAttendanceSummary)
            {
                DataRow dr = ds.Tables[0].NewRow();
                dr["member_id"]             = memberAttendance.member_id;
                dr["first_name"]            = memberAttendance.first_name;
                dr["last_name"]             = memberAttendance.last_name;
                dr["number_of_attendances"] = memberAttendance.number_of_attendances;
                ds.Tables[0].Rows.Add(dr);
            }

            rptMembersAttendanceSummary1.SetDataSource(ds);
            rptMembersAttendanceSummary1.SetParameterValue("pDateFrom", dateFrom.ToString("dd.MM.yyyy."));
            rptMembersAttendanceSummary1.SetParameterValue("pDateTo", dateTo.ToString("dd.MM.yyyy."));
            rptMembersAttendanceSummary1.SetParameterValue("pDatum", DateTime.Now.ToString("dd.MM.yyyy."));
            crystalReportViewer.ReportSource = rptMembersAttendanceSummary1;
            crystalReportViewer.Refresh();
        }