/// <summary> /// 获取加油单报表 /// </summary> /// <param name="billsFilter">筛选参数</param> /// <param name="errMsg">错误信息</param> /// <returns></returns> public static IList <Model.Report> GetReports( ReportsFilter reportsFilter, out string errMsg) { errMsg = ""; try { string sql = ""; SqlParameter[] para = null; List <SqlParameter> listPara = new List <SqlParameter>(); string where = ""; IList <string> listWhere = new List <string>(); if (reportsFilter != null && reportsFilter.Project > 0) { listPara.Add(new SqlParameter("@Project", reportsFilter.Project)); listWhere.Add("Project = @Project"); } if (reportsFilter != null && reportsFilter.Department > 0) { listPara.Add(new SqlParameter("@Department", reportsFilter.Department)); listWhere.Add("Department = @Department"); } if (reportsFilter != null) { listPara.Add(new SqlParameter("@StartDate", reportsFilter.StartDate)); listPara.Add(new SqlParameter("@EndDate", reportsFilter.EndDate)); listWhere.Add("Time between @StartDate and @EndDate"); } para = listPara.ToArray(); if (listWhere.Count > 0) { where += "where "; where += String.Join(" and ", listWhere.ToArray()); } sql = string.Format("select convert(int,ROW_NUMBER() over(order by Project)) as Id,sum(Volume) as Volume,Project,Department,Oil,getdate() as CreatedDate from [Bill] {0} group by Project,Department,Oil", where); DataTable dt = DBHelper.ExecuteGetDataTable(CommandType.Text, sql, para); IList <Model.Report> listReports = new List <Model.Report>(); foreach (DataRow dr in dt.Rows) { Model.Report report = new Model.Report(); report.Id = (int)dr["Id"]; report.Project = (int)dr["Project"]; report.Department = (int)dr["Department"]; report.Oil = (int)dr["Oil"]; report.Volume = double.Parse(dr["Volume"].ToString()); report.CreatedDate = (DateTime)dr["CreatedDate"]; listReports.Add(report); } return(listReports); } catch (Exception ex) { errMsg = ex.Message; return(null); } }
public Report GetByDate(DateTime _date) { DAL.Report r = new DAL.Report(); r = context.Reports.SingleOrDefault(cl => cl.dateOfReport == _date); if (r != null) { Model.Report report = new Model.Report { DateOfReport = r.dateOfReport, Report1 = r.report1 }; return(report); } else { return(null); } }
/// <summary> /// Saves all reports. /// </summary> private void SaveAllReports() { ReportService reportService = new ReportService(AppDelegate.DatabaseContext); InspectionTransactionService InsTransservice = new InspectionTransactionService(AppDelegate.DatabaseContext); int inspectionTransactionID = InsTransservice.GetInspectionTransactionID(InspectionResult.projectID, InspectionResult.inspectionID); if (!string.IsNullOrEmpty(reportPath) && File.Exists(reportPath)) { byte[] buffer; using (Stream stream = new FileStream(reportPath, FileMode.Open)) { buffer = new byte[stream.Length - 1]; stream.Read(buffer, 0, buffer.Length); } Model.Report report = new Model.Report() { InspectionTransID = inspectionTransactionID, ReportType = InspectionResult.pass, ReportDesc = buffer }; reportService.SaveReport(report); } if (!string.IsNullOrEmpty(PhotoLogReportPath) && File.Exists(PhotoLogReportPath)) { byte[] photoLogbuffer; using (Stream stream = new FileStream(PhotoLogReportPath, FileMode.Open)) { photoLogbuffer = new byte[stream.Length - 1]; stream.Read(photoLogbuffer, 0, photoLogbuffer.Length); } Model.Report photoLogReport = new Model.Report() { InspectionTransID = inspectionTransactionID, ReportType = Constants.REPORTTYPE_PHOTOLOG, ReportDesc = photoLogbuffer }; reportService.SaveReport(photoLogReport); } }
/// <summary> /// Decorates the specified <see cref="Report" />. /// </summary> /// <param name="report">The <see cref="Report" />.</param> /// <param name="unit">The <see cref="Unit" /> the <see cref="Report" /> belongs to.</param> /// <returns>The decorated <see cref="Report" />.</returns> public ReportDecorator Decorate(Report report, Unit unit) { return new ReportDecorator(report, unit, this._equipmentProvider, this._awardProvider, this._heroProvider); }
public bool updateReport(Report rp) { BusinessLogic.AnalyticsController BL = new BusinessLogic.AnalyticsController(); return BL.updateReport(rp); }