84 lines
3.0 KiB
C#
84 lines
3.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 安全生产费用使用情况汇总表
|
|
/// </summary>
|
|
public class CostUseConditionService
|
|
{
|
|
/// <summary>
|
|
/// 根据id获取安全生产费用使用情况汇总表
|
|
/// </summary>
|
|
/// <param name="reportId"></param>
|
|
/// <returns></returns>
|
|
public static Model.Report_CostUseCondition GetReportById(string reportId)
|
|
{
|
|
return Funs.DB.Report_CostUseCondition.FirstOrDefault(e => e.ReportId == reportId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据项目id、月份获取安全生产费用使用情况汇总表
|
|
/// </summary>
|
|
/// <param name="projectId"></param>
|
|
/// <param name="months"></param>
|
|
/// <returns></returns>
|
|
public static Model.Report_CostUseCondition GetReportByMonths(string projectId, int y,int m)
|
|
{
|
|
return Funs.DB.Report_CostUseCondition.FirstOrDefault(e => e.ProjectId == projectId && e.Months.Value.Year == y && e.Months.Value.Month==m); }
|
|
|
|
/// <summary>
|
|
/// 添加安全生产费用使用情况汇总表
|
|
/// </summary>
|
|
/// <param name="report"></param>
|
|
public static void AddCostUseCondition(Model.Report_CostUseCondition report)
|
|
{
|
|
Model.Report_CostUseCondition newReport = new Model.Report_CostUseCondition
|
|
{
|
|
ReportId = report.ReportId,
|
|
ProjectId = report.ProjectId,
|
|
UnitId = report.UnitId,
|
|
Months = report.Months,
|
|
Amount = report.Amount
|
|
};
|
|
Funs.DB.Report_CostUseCondition.InsertOnSubmit(newReport);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改安全生产费用使用情况汇总表
|
|
/// </summary>
|
|
/// <param name="report"></param>
|
|
public static void UpdateCostUseCondition(Model.Report_CostUseCondition report)
|
|
{
|
|
Model.Report_CostUseCondition newReport = Funs.DB.Report_CostUseCondition.FirstOrDefault(e => e.ReportId == report.ReportId);
|
|
if (newReport != null)
|
|
{
|
|
newReport.ProjectId = report.ProjectId;
|
|
newReport.UnitId = report.UnitId;
|
|
newReport.Months = report.Months;
|
|
newReport.Amount = report.Amount;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除安全生产费用使用情况汇总表
|
|
/// </summary>
|
|
/// <param name="reportId"></param>
|
|
public static void DeleteCostUseConditionById(string reportId)
|
|
{
|
|
Model.Report_CostUseCondition report = Funs.DB.Report_CostUseCondition.FirstOrDefault(e => e.ReportId == reportId);
|
|
if (report != null)
|
|
{
|
|
Funs.DB.Report_CostUseCondition.DeleteOnSubmit(report);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|