/************************************************************************* * 将DataRowCollection转化为List * **********************************************************************/ private List <MonthAttendance> getAttendanceStatistics(DataRowCollection rows) { if (rows != null && rows.Count > 0) { int iRowLength = rows.Count; List <MonthAttendance> list = new List <MonthAttendance>(); for (int i = 0; i < iRowLength; i++) { MonthAttendance monthAttendance = new MonthAttendance() { ASID = int.Parse(rows[i]["F_ASID"].ToString()), EmpID = rows[i]["F_EmpID"].ToString(), EmpName = rows[i]["F_EmpName"].ToString(), DepID = rows[i]["F_DepID"].ToString(), DepName = rows[i]["F_DepName"].ToString(), ASMonth = int.Parse(rows[i]["F_ASMonth"].ToString()), ASStandardDuration = int.Parse(rows[i]["F_ASStandardDuration"].ToString()), ASRealityDuration = int.Parse(rows[i]["F_ASRealityDuration"].ToString()), ASLateNumber = int.Parse(rows[i]["F_ASLateNumber"].ToString()), ASLeaveEavlyNumber = int.Parse(rows[i]["F_ASLeaveEavlyNumber"].ToString()), ASAbsenteeismNumber = int.Parse(rows[i]["F_ASAbsenteeismNumber"].ToString()), ASNormalNumber = int.Parse(rows[i]["F_ASNormalNumber"].ToString()), ASCreateDate = DateTime.Parse(rows[i]["F_ASCreateDate"].ToString()) }; list.Add(monthAttendance); } return(list); } return(null); }
private void Detail2_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { if (RowCount == 0) { e.Cancel = true; return; } MonthAttendance at = (MonthAttendance)GetCurrentRow(); if (at != null) { Detail2.MultiColumn.ColumnCount = at.Days.Count + 5; Detail3.MultiColumn.ColumnCount = at.Days.Count + 5; } }
private void FillReport(bool isInitial = false, bool throwException = true) { string rep_params = vals.Text; ReportGenericRequest req = new ReportGenericRequest(); req.paramString = rep_params; ListResponse <Model.Reports.RT301> resp = _reportsService.ChildGetAll <Model.Reports.RT301>(req); //if (!resp.Success) //{ // throw new Exception(resp.Error + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + resp.LogId + "</br>"); //} if (!resp.Success) { Common.ReportErrorMessage(resp, GetGlobalResourceObject("Errors", "Error_1").ToString(), GetGlobalResourceObject("Errors", "ErrorLogId").ToString()); } var monthlyGrouped = resp.Items.GroupBy(x => x.month); MonthlyEmployeeAttendanceCollection monthlyAtts = new MonthlyEmployeeAttendanceCollection(); foreach (var item in monthlyGrouped) { MonthAttendance at = new MonthAttendance(item.Key, item.ToList()); monthlyAtts.Add(at); } //var grouped = resp.Items.GroupBy(x => x.name.fullName); //EmployeeAttendanceCollection ats = new EmployeeAttendanceCollection(); //foreach (var item in grouped) //{ // EmployeeAttendances at = new EmployeeAttendances(); // at.name = item.Key; // var details = item.ToList(); // if (details.Count != 0) // { // at.departmentName = details[0].departmentName; // at.branchName = details[0].branchName; // at.positionName = details[0].positionName; // } // foreach (var subItem in item.ToList()) // { // at.Add(new Attendance() { workingTime=subItem.workingTime, day = subItem.day, year=subItem.year, month = subItem.month, timeIn = subItem.checkIn, timeOut = subItem.checkOut }); // } // ats.Add(at); //} TimeAttendanceSummary h = new TimeAttendanceSummary(); h.RightToLeft = _systemService.SessionHelper.CheckIfArabicSession() ? DevExpress.XtraReports.UI.RightToLeft.Yes : DevExpress.XtraReports.UI.RightToLeft.No; h.RightToLeftLayout = _systemService.SessionHelper.CheckIfArabicSession() ? DevExpress.XtraReports.UI.RightToLeftLayout.Yes : DevExpress.XtraReports.UI.RightToLeftLayout.No; h.DataSource = monthlyAtts; string user = _systemService.SessionHelper.GetCurrentUser(); DateTime date = DateTime.Parse(req.Parameters["_fromDate"]); h.Parameters["User"].Value = user; h.Parameters["Fitlers"].Value = texts.Text; h.CreateDocument(); ASPxWebDocumentViewer1.DataBind(); ASPxWebDocumentViewer1.OpenReport(h); }