CNCEC_SUBQHSE_WUHUAN/SGGL/BLL/HSSE/Manager/ManagerMonthC/NoInjuryAccidentCService.cs

55 lines
2.0 KiB
C#

using System.Collections.Generic;
using System.Linq;
namespace BLL
{
/// <summary>
/// 本月无伤害事故统计
/// </summary>
public class NoInjuryAccidentCService
{
/// <summary>
/// 根据月报ID获取本月无伤害事故统计
/// </summary>
/// <param name="monthReportId"></param>
/// <returns></returns>
public static List<Model.Manager_Month_NoInjuryAccidentC> GetNoInjuryAccidentByMonthReportId(string monthReportId)
{
return (from x in Funs.DB.Manager_Month_NoInjuryAccidentC where x.MonthReportId == monthReportId select x).ToList();
}
/// <summary>
/// 添加无伤害事故统计
/// </summary>
/// <param name="noInjury"></param>
public static void AddNoInjuryAccident(Model.Manager_Month_NoInjuryAccidentC noInjury)
{
Model.Manager_Month_NoInjuryAccidentC newNoInjury = new Model.Manager_Month_NoInjuryAccidentC
{
NoInjuryAccidentId = noInjury.NoInjuryAccidentId,
MonthReportId = noInjury.MonthReportId,
AccidentType = noInjury.AccidentType,
EconomicLosses = noInjury.EconomicLosses,
WHAccidentCount = noInjury.WHAccidentCount,
SubAccidentCount = noInjury.SubAccidentCount,
};
Funs.DB.Manager_Month_NoInjuryAccidentC.InsertOnSubmit(newNoInjury);
Funs.DB.SubmitChanges();
}
/// <summary>
/// 根据月报ID删除无伤害事故统计
/// </summary>
/// <param name="monthReportId"></param>
public static void DeleteNoInjuryAccidentByMonthReportId(string monthReportId)
{
var q = (from x in Funs.DB.Manager_Month_NoInjuryAccidentC where x.MonthReportId == monthReportId select x).ToList();
if (q!=null)
{
Funs.DB.Manager_Month_NoInjuryAccidentC.DeleteAllOnSubmit(q);
Funs.DB.SubmitChanges();
}
}
}
}