Beispiel #1
0
        private void ReportMembersAttendanceLoad()
        {
            DataSet   ds = new DataSet();
            DataTable dt = new DataTable("MembersAttendances");

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

            ds.Tables.Add(dt);
            List <MemberAttendanceDTO> membersAttendance = AttendanceDAO.getMembersAttendanceInDateRange(dateFrom, dateTo);

            foreach (var memberAttendance in membersAttendance)
            {
                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["check_in_time"] = memberAttendance.check_in_time.ToString("dd.MM.yyyy. hh:mm:ss");
                ds.Tables[0].Rows.Add(dr);
            }
            rptMembersAttendance1.SetDataSource(ds);
            rptMembersAttendance1.SetParameterValue("pDateFrom", dateFrom.ToString("dd.MM.yyyy."));
            rptMembersAttendance1.SetParameterValue("pDateTo", dateTo.ToString("dd.MM.yyyy."));
            rptMembersAttendance1.SetParameterValue("pDatum", DateTime.Now.ToString("dd.MM.yyyy."));
            crystalReportViewer.ReportSource = rptMembersAttendance1;
            crystalReportViewer.Refresh();
        }