初始化仓库
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class AccidentAnalysisItemService
|
||||
{
|
||||
/// <summary>
|
||||
/// 事故统计明细表
|
||||
/// </summary>
|
||||
/// <param name="AccidentAnalysisItemId">事故统计明细表Id</param>
|
||||
/// <returns>事故统计明细表</returns>
|
||||
public static Model.ProjectAccident_AccidentAnalysisItem GetAccidentAnalysisItemByAccidentAnalysisItemId(string AccidentAnalysisItemId)
|
||||
{
|
||||
return Funs.DB.ProjectAccident_AccidentAnalysisItem.FirstOrDefault(e => e.AccidentAnalysisItemId == AccidentAnalysisItemId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 事故统计明细表
|
||||
/// </summary>
|
||||
/// <param name="AccidentAnalysisItemId">事故统计明细表Id</param>
|
||||
/// <returns>事故统计明细表</returns>
|
||||
public static Model.ProjectAccident_AccidentAnalysisItem GetAccidentAnalysisItemByAccidentAnalysisIdAndTypeId(string AccidentAnalysisId, string AccidentType)
|
||||
{
|
||||
return Funs.DB.ProjectAccident_AccidentAnalysisItem.FirstOrDefault(e => e.AccidentAnalysisId == AccidentAnalysisId && e.AccidentType == AccidentType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主表Id判断是否存在明细记录
|
||||
/// </summary>
|
||||
/// <param name="AccidentAnalysisItemId">事故统计表Id</param>
|
||||
/// <returns>是否存在明细记录</returns>
|
||||
public static bool IsExitItems(string AccidentAnalysisId)
|
||||
{
|
||||
return (from x in Funs.DB.ProjectAccident_AccidentAnalysisItem where x.AccidentAnalysisId == AccidentAnalysisId select x).Count() > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主表Id获取明细记录集合
|
||||
/// </summary>
|
||||
/// <param name="AccidentAnalysisItemId">事故统计明细表Id</param>
|
||||
/// <returns>明细记录集合</returns>
|
||||
public static List<Model.ProjectAccident_AccidentAnalysisItem> GetItems(string AccidentAnalysisId)
|
||||
{
|
||||
return (from x in Funs.DB.ProjectAccident_AccidentAnalysisItem
|
||||
join y in Funs.DB.Sys_Const on x.AccidentType equals y.ConstText
|
||||
where x.AccidentAnalysisId == AccidentAnalysisId && y.GroupId == ConstValue.Group_0012
|
||||
orderby y.SortIndex
|
||||
select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主表Id获取明细记录集合(不包含总计行)
|
||||
/// </summary>
|
||||
/// <param name="AccidentAnalysisItemId">事故统计明细表Id</param>
|
||||
/// <returns>明细记录集合</returns>
|
||||
public static List<Model.ProjectAccident_AccidentAnalysisItem> GetItemsNoSum(string AccidentAnalysisId)
|
||||
{
|
||||
return (from x in Funs.DB.ProjectAccident_AccidentAnalysisItem
|
||||
join y in Funs.DB.Sys_Const on x.AccidentType equals y.ConstText
|
||||
where x.AccidentAnalysisId == AccidentAnalysisId && y.GroupId == ConstValue.Group_0012
|
||||
orderby y.SortIndex
|
||||
select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加事故统计明细表
|
||||
/// </summary>
|
||||
/// <param name="AccidentAnalysisItem">事故统计明细表实体</param>
|
||||
public static void AddAccidentAnalysisItem(Model.ProjectAccident_AccidentAnalysisItem AccidentAnalysisItem)
|
||||
{
|
||||
Model.ProjectAccident_AccidentAnalysisItem newAccidentAnalysisItem = new Model.ProjectAccident_AccidentAnalysisItem
|
||||
{
|
||||
AccidentAnalysisItemId = AccidentAnalysisItem.AccidentAnalysisItemId,
|
||||
AccidentAnalysisId = AccidentAnalysisItem.AccidentAnalysisId,
|
||||
AccidentType = AccidentAnalysisItem.AccidentType,
|
||||
|
||||
Death = AccidentAnalysisItem.Death,
|
||||
Injuries = AccidentAnalysisItem.Injuries,
|
||||
MinorInjuries = AccidentAnalysisItem.MinorInjuries
|
||||
};
|
||||
Funs.DB.ProjectAccident_AccidentAnalysisItem.InsertOnSubmit(newAccidentAnalysisItem);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改事故统计明细表
|
||||
/// </summary>
|
||||
/// <param name="AccidentAnalysisItem">事故统计明细表实体</param>
|
||||
public static void UpdateAccidentAnalysisItem(Model.ProjectAccident_AccidentAnalysisItem AccidentAnalysisItem)
|
||||
{
|
||||
Model.ProjectAccident_AccidentAnalysisItem newAccidentAnalysisItem = Funs.DB.ProjectAccident_AccidentAnalysisItem.FirstOrDefault(e => e.AccidentAnalysisItemId == AccidentAnalysisItem.AccidentAnalysisItemId);
|
||||
newAccidentAnalysisItem.AccidentAnalysisId = AccidentAnalysisItem.AccidentAnalysisId;
|
||||
newAccidentAnalysisItem.AccidentType = AccidentAnalysisItem.AccidentType;
|
||||
|
||||
newAccidentAnalysisItem.Death = AccidentAnalysisItem.Death;
|
||||
newAccidentAnalysisItem.Injuries = AccidentAnalysisItem.Injuries;
|
||||
newAccidentAnalysisItem.MinorInjuries = AccidentAnalysisItem.MinorInjuries;
|
||||
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id删除所有数据
|
||||
/// </summary>
|
||||
/// <param name="AccidentAnalysisItemId"></param>
|
||||
public static void DeleteAccidentAnalysisItemByAccidentAnalysisId(string AccidentAnalysisId)
|
||||
{
|
||||
var q = from x in Funs.DB.ProjectAccident_AccidentAnalysisItem where x.AccidentAnalysisId == AccidentAnalysisId select x;
|
||||
if (q != null)
|
||||
{
|
||||
Funs.DB.ProjectAccident_AccidentAnalysisItem.DeleteAllOnSubmit(q);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 事故统计表
|
||||
/// </summary>
|
||||
public static class AccidentAnalysisService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取事故统计
|
||||
/// </summary>
|
||||
/// <param name="accidentAnalysisId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.ProjectAccident_AccidentAnalysis GetAccidentAnalysisById(string accidentAnalysisId)
|
||||
{
|
||||
return Funs.DB.ProjectAccident_AccidentAnalysis.FirstOrDefault(e => e.AccidentAnalysisId == accidentAnalysisId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加事故统计
|
||||
/// </summary>
|
||||
/// <param name="accidentAnalysis"></param>
|
||||
public static void AddAccidentAnalysis(Model.ProjectAccident_AccidentAnalysis accidentAnalysis)
|
||||
{
|
||||
Model.ProjectAccident_AccidentAnalysis newAccidentAnalysis = new Model.ProjectAccident_AccidentAnalysis
|
||||
{
|
||||
AccidentAnalysisId = accidentAnalysis.AccidentAnalysisId,
|
||||
ProjectId = accidentAnalysis.ProjectId,
|
||||
CompileMan = accidentAnalysis.CompileMan,
|
||||
Remarks = accidentAnalysis.Remarks,
|
||||
CompileDate = accidentAnalysis.CompileDate
|
||||
};
|
||||
Funs.DB.ProjectAccident_AccidentAnalysis.InsertOnSubmit(newAccidentAnalysis);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改事故统计
|
||||
/// </summary>
|
||||
/// <param name="accidentAnalysis"></param>
|
||||
public static void UpdateAccidentAnalysis(Model.ProjectAccident_AccidentAnalysis accidentAnalysis)
|
||||
{
|
||||
Model.ProjectAccident_AccidentAnalysis newAccidentAnalysis = Funs.DB.ProjectAccident_AccidentAnalysis.FirstOrDefault(e => e.AccidentAnalysisId == accidentAnalysis.AccidentAnalysisId);
|
||||
if (newAccidentAnalysis != null)
|
||||
{
|
||||
newAccidentAnalysis.ProjectId = accidentAnalysis.ProjectId;
|
||||
newAccidentAnalysis.CompileMan = accidentAnalysis.CompileMan;
|
||||
newAccidentAnalysis.Remarks = accidentAnalysis.Remarks;
|
||||
newAccidentAnalysis.CompileDate = accidentAnalysis.CompileDate;
|
||||
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除事故统计
|
||||
/// </summary>
|
||||
/// <param name="accidentAnalysisId"></param>
|
||||
public static void DeleteAccidentAnalysisById(string accidentAnalysisId)
|
||||
{
|
||||
Model.ProjectAccident_AccidentAnalysis accidentAnalysis = Funs.DB.ProjectAccident_AccidentAnalysis.FirstOrDefault(e => e.AccidentAnalysisId == accidentAnalysisId);
|
||||
if (accidentAnalysis != null)
|
||||
{
|
||||
///删除编码表记录
|
||||
BLL.CodeRecordsService.DeleteCodeRecordsByDataId(accidentAnalysisId);
|
||||
////删除附件表
|
||||
BLL.CommonService.DeleteAttachFileById(accidentAnalysisId);
|
||||
////删除流程表
|
||||
BLL.CommonService.DeleteFlowOperateByID(accidentAnalysisId);
|
||||
Funs.DB.ProjectAccident_AccidentAnalysis.DeleteOnSubmit(accidentAnalysis);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 事故处理表
|
||||
/// </summary>
|
||||
public static class AccidentStatisticsService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取事故处理
|
||||
/// </summary>
|
||||
/// <param name="accidentStatisticsId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.ProjectAccident_AccidentStatistics GetAccidentStatisticsById(string accidentStatisticsId)
|
||||
{
|
||||
return Funs.DB.ProjectAccident_AccidentStatistics.FirstOrDefault(e => e.AccidentStatisticsId == accidentStatisticsId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加事故处理
|
||||
/// </summary>
|
||||
/// <param name="accidentStatistics"></param>
|
||||
public static void AddAccidentStatistics(Model.ProjectAccident_AccidentStatistics accidentStatistics)
|
||||
{
|
||||
Model.ProjectAccident_AccidentStatistics newAccidentStatistics = new Model.ProjectAccident_AccidentStatistics
|
||||
{
|
||||
AccidentStatisticsId = accidentStatistics.AccidentStatisticsId,
|
||||
ProjectId = accidentStatistics.ProjectId,
|
||||
UnitId = accidentStatistics.UnitId,
|
||||
Person = accidentStatistics.Person,
|
||||
Treatment = accidentStatistics.Treatment,
|
||||
CompileDate = accidentStatistics.CompileDate,
|
||||
AttachUrl = accidentStatistics.AttachUrl,
|
||||
States = accidentStatistics.States
|
||||
};
|
||||
Funs.DB.ProjectAccident_AccidentStatistics.InsertOnSubmit(newAccidentStatistics);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改事故处理
|
||||
/// </summary>
|
||||
/// <param name="accidentStatistics"></param>
|
||||
public static void UpdateAccidentStatistics(Model.ProjectAccident_AccidentStatistics accidentStatistics)
|
||||
{
|
||||
Model.ProjectAccident_AccidentStatistics newAccidentStatistics = Funs.DB.ProjectAccident_AccidentStatistics.FirstOrDefault(e => e.AccidentStatisticsId == accidentStatistics.AccidentStatisticsId);
|
||||
if (newAccidentStatistics != null)
|
||||
{
|
||||
newAccidentStatistics.ProjectId = accidentStatistics.ProjectId;
|
||||
newAccidentStatistics.UnitId = accidentStatistics.UnitId;
|
||||
newAccidentStatistics.Person = accidentStatistics.Person;
|
||||
newAccidentStatistics.Treatment = accidentStatistics.Treatment;
|
||||
newAccidentStatistics.CompileDate = accidentStatistics.CompileDate;
|
||||
newAccidentStatistics.AttachUrl = accidentStatistics.AttachUrl;
|
||||
newAccidentStatistics.States = accidentStatistics.States;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除事故处理
|
||||
/// </summary>
|
||||
/// <param name="accidentStatisticsId"></param>
|
||||
public static void DeleteAccidentStatisticsById(string accidentStatisticsId)
|
||||
{
|
||||
Model.ProjectAccident_AccidentStatistics accidentStatistics = Funs.DB.ProjectAccident_AccidentStatistics.FirstOrDefault(e => e.AccidentStatisticsId == accidentStatisticsId);
|
||||
if (accidentStatistics != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(accidentStatistics.AttachUrl))
|
||||
{
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, accidentStatistics.AttachUrl);//删除附件
|
||||
}
|
||||
////删除附件表
|
||||
BLL.CommonService.DeleteAttachFileById(accidentStatistics.AccidentStatisticsId);
|
||||
///删除编码表记录
|
||||
BLL.CodeRecordsService.DeleteCodeRecordsByDataId(accidentStatistics.AccidentStatisticsId);
|
||||
////删除流程表
|
||||
BLL.CommonService.DeleteFlowOperateByID(accidentStatistics.AccidentStatisticsId);
|
||||
Funs.DB.ProjectAccident_AccidentStatistics.DeleteOnSubmit(accidentStatistics);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 事故快报表
|
||||
/// </summary>
|
||||
public static class ProjectAccidentReportService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取事故快报
|
||||
/// </summary>
|
||||
/// <param name="accidentReportId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.ProjectAccident_AccidentReport GetAccidentReportById(string accidentReportId)
|
||||
{
|
||||
return Funs.DB.ProjectAccident_AccidentReport.FirstOrDefault(e => e.AccidentReportId == accidentReportId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加事故快报
|
||||
/// </summary>
|
||||
/// <param name="accidentReport"></param>
|
||||
public static void AddAccidentReport(Model.ProjectAccident_AccidentReport accidentReport)
|
||||
{
|
||||
Model.ProjectAccident_AccidentReport newAccidentReport = new Model.ProjectAccident_AccidentReport
|
||||
{
|
||||
AccidentReportId = accidentReport.AccidentReportId,
|
||||
ProjectId = accidentReport.ProjectId,
|
||||
UnitId = accidentReport.UnitId,
|
||||
WorkArea = accidentReport.WorkArea,
|
||||
CompileDate = accidentReport.CompileDate,
|
||||
AccidentDescription = accidentReport.AccidentDescription,
|
||||
Casualties = accidentReport.Casualties,
|
||||
AttachUrl = accidentReport.AttachUrl,
|
||||
States = accidentReport.States
|
||||
};
|
||||
Funs.DB.ProjectAccident_AccidentReport.InsertOnSubmit(newAccidentReport);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改事故快报
|
||||
/// </summary>
|
||||
/// <param name="accidentReport"></param>
|
||||
public static void UpdateAccidentReport(Model.ProjectAccident_AccidentReport accidentReport)
|
||||
{
|
||||
Model.ProjectAccident_AccidentReport newAccidentReport = Funs.DB.ProjectAccident_AccidentReport.FirstOrDefault(e => e.AccidentReportId == accidentReport.AccidentReportId);
|
||||
if (newAccidentReport != null)
|
||||
{
|
||||
newAccidentReport.ProjectId = accidentReport.ProjectId;
|
||||
newAccidentReport.UnitId = accidentReport.UnitId;
|
||||
newAccidentReport.WorkArea = accidentReport.WorkArea;
|
||||
newAccidentReport.CompileDate = accidentReport.CompileDate;
|
||||
newAccidentReport.AccidentDescription = accidentReport.AccidentDescription;
|
||||
newAccidentReport.Casualties = accidentReport.Casualties;
|
||||
newAccidentReport.AttachUrl = accidentReport.AttachUrl;
|
||||
newAccidentReport.States = accidentReport.States;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除事故快报
|
||||
/// </summary>
|
||||
/// <param name="accidentReportId"></param>
|
||||
public static void DeleteAccidentReportById(string accidentReportId)
|
||||
{
|
||||
Model.ProjectAccident_AccidentReport accidentReport = Funs.DB.ProjectAccident_AccidentReport.FirstOrDefault(e => e.AccidentReportId == accidentReportId);
|
||||
if (accidentReport != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(accidentReport.AttachUrl))
|
||||
{
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, accidentReport.AttachUrl);//删除附件
|
||||
}
|
||||
|
||||
////删除附件表
|
||||
BLL.CommonService.DeleteAttachFileById(accidentReport.AccidentReportId);
|
||||
///删除编码表记录
|
||||
BLL.CodeRecordsService.DeleteCodeRecordsByDataId(accidentReport.AccidentReportId);
|
||||
////删除流程表
|
||||
BLL.CommonService.DeleteFlowOperateByID(accidentReport.AccidentReportId);
|
||||
|
||||
Funs.DB.ProjectAccident_AccidentReport.DeleteOnSubmit(accidentReport);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user