115 lines
4.6 KiB
C#
115 lines
4.6 KiB
C#
using FastReport;
|
|
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// HSE月报
|
|
/// </summary>
|
|
public class HSEMonthReportService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取HSE月报
|
|
/// </summary>
|
|
/// <param name="reportId"></param>
|
|
/// <returns></returns>
|
|
public static Model.Report_HSEMonthReport GetHSEMonthReportById(string reportId)
|
|
{
|
|
return Funs.DB.Report_HSEMonthReport.FirstOrDefault(e => e.ReportId == reportId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加HSE月报
|
|
/// </summary>
|
|
/// <param name="report"></param>
|
|
public static void AddHSEMonthReport(Model.Report_HSEMonthReport report)
|
|
{
|
|
CNPCDB db = Funs.DB;
|
|
Model.Report_HSEMonthReport newReport = new Report_HSEMonthReport();
|
|
newReport.ReportId = report.ReportId;
|
|
newReport.UnitId = report.UnitId;
|
|
newReport.ReportDate = report.ReportDate;
|
|
newReport.TotalEmployees = report.TotalEmployees;
|
|
newReport.TotalHours = report.TotalHours;
|
|
newReport.ContractorEmployees = report.ContractorEmployees;
|
|
newReport.ContractorHours = report.ContractorHours;
|
|
newReport.MonthHours = report.MonthHours;
|
|
newReport.MonthHoursAvg = report.MonthHoursAvg;
|
|
newReport.YearHours = report.YearHours;
|
|
newReport.Remark = report.Remark;
|
|
newReport.BranchTraining = report.BranchTraining;
|
|
newReport.ProjectTraining = report.ProjectTraining;
|
|
newReport.TeamGroupTraining = report.TeamGroupTraining;
|
|
newReport.SelfTraining = report.SelfTraining;
|
|
newReport.ContractorOrganizeTraining = report.ContractorOrganizeTraining;
|
|
newReport.ContractorTraining = report.ContractorTraining;
|
|
newReport.CompileMan = report.CompileMan;
|
|
newReport.CompileDate = report.CompileDate;
|
|
db.Report_HSEMonthReport.InsertOnSubmit(newReport);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改HSE月报
|
|
/// </summary>
|
|
/// <param name="report"></param>
|
|
public static void UpdateHSEMonthReport(Model.Report_HSEMonthReport report)
|
|
{
|
|
CNPCDB db = Funs.DB;
|
|
Model.Report_HSEMonthReport newReport = db.Report_HSEMonthReport.FirstOrDefault(e => e.ReportId == report.ReportId);
|
|
if (newReport != null)
|
|
{
|
|
newReport.UnitId = report.UnitId;
|
|
newReport.ReportDate = report.ReportDate;
|
|
newReport.TotalEmployees = report.TotalEmployees;
|
|
newReport.TotalHours = report.TotalHours;
|
|
newReport.ContractorEmployees = report.ContractorEmployees;
|
|
newReport.ContractorHours = report.ContractorHours;
|
|
newReport.MonthHours = report.MonthHours;
|
|
newReport.MonthHoursAvg = report.MonthHoursAvg;
|
|
newReport.YearHours = report.YearHours;
|
|
newReport.Remark = report.Remark;
|
|
newReport.BranchTraining = report.BranchTraining;
|
|
newReport.ProjectTraining = report.ProjectTraining;
|
|
newReport.TeamGroupTraining = report.TeamGroupTraining;
|
|
newReport.SelfTraining = report.SelfTraining;
|
|
newReport.ContractorOrganizeTraining = report.ContractorOrganizeTraining;
|
|
newReport.ContractorTraining = report.ContractorTraining;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除HSE月报
|
|
/// </summary>
|
|
/// <param name="reportId"></param>
|
|
public static void DeleteHSEMonthReportByReportId(string reportId)
|
|
{
|
|
CNPCDB db = Funs.DB;
|
|
Model.Report_HSEMonthReport report = db.Report_HSEMonthReport.FirstOrDefault(e => e.ReportId == reportId);
|
|
if (report != null)
|
|
{
|
|
db.Report_HSEMonthReport.DeleteOnSubmit(report);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据月报日期获取HSE月报信息
|
|
/// </summary>
|
|
/// <param name="unitId"></param>
|
|
/// <param name="reportDate"></param>
|
|
/// <returns></returns>
|
|
public static Model.Report_HSEMonthReport GetHSEMonthReportByReportDate(string unitId, DateTime? reportDate)
|
|
{
|
|
return Funs.DB.Report_HSEMonthReport.FirstOrDefault(e => e.UnitId == unitId && e.ReportDate == reportDate);
|
|
}
|
|
|
|
}
|
|
}
|