This commit is contained in:
2025-04-07 17:43:30 +08:00
commit 8a2c192129
12175 changed files with 2742596 additions and 0 deletions
@@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public static class AccidentDetailSortBService
{
/// <summary>
/// 根据月报告主键获取所有事故台账信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static List<Model.Manager_AccidentDetailSortB> GetAccidentDetailSortsByMonthReportId(string monthReportId)
{
return (from x in Funs.DB.Manager_AccidentDetailSortB where x.MonthReportId == monthReportId orderby x.AccidentDate select x).ToList();
}
/// <summary>
/// 增加月报告事故台账信息
/// </summary>
/// <param name="accidentSort">月报告事故台账实体</param>
public static void AddAccidentDetailSort(Model.Manager_AccidentDetailSortB accidentSort)
{
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_AccidentDetailSortB));
Model.Manager_AccidentDetailSortB newAccidentSort = new Model.Manager_AccidentDetailSortB
{
AccidentDetailSortId = newKeyID,
MonthReportId = accidentSort.MonthReportId,
Abstract = accidentSort.Abstract,
AccidentType = accidentSort.AccidentType,
PeopleNum = accidentSort.PeopleNum,
WorkingHoursLoss = accidentSort.WorkingHoursLoss,
EconomicLoss = accidentSort.EconomicLoss,
AccidentDate = accidentSort.AccidentDate
};
Funs.DB.Manager_AccidentDetailSortB.InsertOnSubmit(newAccidentSort);
Funs.DB.SubmitChanges();
}
/// <summary>
/// 根据月报告主键删除对应的所有月报告事故台账信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
public static void DeleteAccidentDetailSortsByMonthReportId(string monthReportId)
{
var q = (from x in Funs.DB.Manager_AccidentDetailSortB where x.MonthReportId == monthReportId select x).ToList();
if (q.Count() > 0)
{
Funs.DB.Manager_AccidentDetailSortB.DeleteAllOnSubmit(q);
Funs.DB.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除事故台账信息
/// </summary>
/// <param name="monthReportId">主键</param>
public static void DeleteAccidentDetailSortByAccidentDetailSortId(string accidentDetailSortId)
{
var q = Funs.DB.Manager_AccidentDetailSortB.FirstOrDefault(x => x.AccidentDetailSortId == accidentDetailSortId);
if (q != null)
{
Funs.DB.Manager_AccidentDetailSortB.DeleteOnSubmit(q);
Funs.DB.SubmitChanges();
}
}
}
}
@@ -0,0 +1,454 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
/// <summary>
/// 事故调查报告
/// </summary>
public static class AccidentReport2Service
{
public static Model.SUBQHSEDB db = Funs.DB;
/// <summary>
/// 根据主键获取事故调查报告
/// </summary>
/// <param name="accidentReportId"></param>
/// <returns></returns>
public static Model.Accident_AccidentReport GetAccidentReportById(string accidentReportId)
{
return Funs.DB.Accident_AccidentReport.FirstOrDefault(e => e.AccidentReportId == accidentReportId);
}
/// <summary>
/// 根据时间段获取事故集合
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public static List<Model.Accident_AccidentReport> GetAccidentReportsByAccidentTime(DateTime startTime, DateTime endTime, string projectId)
{
return (from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x).ToList();
}
/// <summary>
/// 获取最近时间的轻重死事故时间
/// </summary>
/// <param name="projectId"></param>
/// <returns></returns>
public static Model.Accident_AccidentReport GetMaxAccidentTimeReport(DateTime time, string projectId)
{
var a = (from x in Funs.DB.Accident_AccidentReport
where (x.AccidentTypeId == "1" || x.AccidentTypeId == "2" || x.AccidentTypeId == "3")
&& x.ProjectId == projectId
&& x.AccidentDate < time
orderby x.AccidentDate descending
select x).FirstOrDefault();
return a;
}
/// <summary>
/// 获取时间段内的轻重死事故时间
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <returns></returns>
public static Model.Accident_AccidentReport GetMaxAccidentTimeReportByTime(DateTime startTime, DateTime endTime)
{
var a = (from x in Funs.DB.Accident_AccidentReport
where (x.AccidentTypeId == "1" || x.AccidentTypeId == "2" || x.AccidentTypeId == "3")
&& x.AccidentDate >= startTime && x.AccidentDate < endTime
orderby x.AccidentDate descending
select x).FirstOrDefault();
return a;
}
/// <summary>
/// 根据时间段获取可记录事故集合
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="accidentType"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public static List<Model.Accident_AccidentReport> GetRecordAccidentReportsByAccidentTime(DateTime startTime, DateTime endTime, string projectId)
{
return (from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.ProjectId == projectId && (x.AccidentTypeId == "1" || x.AccidentTypeId == "2" || x.AccidentTypeId == "3") && x.States == BLL.Const.State_2 select x).ToList();
}
/// <summary>
/// 根据时间段获取事故集合
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="accidentType"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public static List<Model.Accident_AccidentReport> GetAccidentReportsByAccidentTypeAndTime(DateTime startTime, DateTime endTime, string projectId, string accidentType)
{
return (from x in Funs.DB.Accident_AccidentReport
join y in Funs.DB.Sys_FlowOperate
on x.AccidentReportId equals y.DataId
where x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2
&& y.State == BLL.Const.State_2 && y.OperaterTime >= startTime && y.OperaterTime < endTime
select x).Distinct().ToList();
}
/// <summary>
/// 根据时间段和类型获取事故数量
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="accidentType"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public static int GetCountByAccidentTimeAndAccidentType(DateTime startTime, DateTime endTime, string accidentType, string projectId)
{
return (from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x).Count();
//if (accidentType == "1" || accidentType == "2" || accidentType == "3") //轻重死事故按审批完成时间
//{
// return (from x in Funs.DB.Accident_AccidentReport
// join y in Funs.DB.Sys_FlowOperate
// on x.AccidentReportId equals y.DataId
// where x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2
// && y.State == BLL.Const.State_2 && y.OperaterTime >= startTime && y.OperaterTime < endTime
// select x).Count();
//}
//else
//{
// return (from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x).Count();
//}
}
/// <summary>
/// 根据时间段和类型获取事故数量
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="accidentType"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public static int GetCountByAccidentType(string accidentType, string projectId)
{
return (from x in Funs.DB.Accident_AccidentReport where x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x).Count();
//if (accidentType == "1" || accidentType == "2" || accidentType == "3") //轻重死事故按审批完成时间
//{
// return (from x in Funs.DB.Accident_AccidentReport
// join y in Funs.DB.Sys_FlowOperate
// on x.AccidentReportId equals y.DataId
// where x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2
// && y.State == BLL.Const.State_2 && y.OperaterTime >= startTime && y.OperaterTime < endTime
// select x).Count();
//}
//else
//{
// return (from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x).Count();
//}
}
/// <summary>
/// 根据时间段和类型获取事故人数
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="accidentType"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public static int GetPersonNumByAccidentTimeAndAccidentType(DateTime startTime, DateTime endTime, string accidentType, string projectId)
{
int num = 0;
var q = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.PeopleNum;
foreach (var item in q)
{
if (item != null)
{
num += Funs.GetNewIntOrZero(item.ToString());
}
}
//if (accidentType == "1" || accidentType == "2" || accidentType == "3") //轻重死事故按审批完成时间
//{
// var a = from x in Funs.DB.Accident_AccidentReport
// join y in Funs.DB.Sys_FlowOperate
// on x.AccidentReportId equals y.DataId
// where x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2
// && y.State == BLL.Const.State_2 && y.OperaterTime >= startTime && y.OperaterTime < endTime
// select x.PeopleNum;
// foreach (var item in a)
// {
// if (item != null)
// {
// num += Funs.GetNewIntOrZero(item.ToString());
// }
// }
//}
//else
//{
// var q = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.PeopleNum;
// foreach (var item in q)
// {
// if (item != null)
// {
// num += Funs.GetNewIntOrZero(item.ToString());
// }
// }
//}
return num;
}
/// <summary>
/// 根据时间段和类型获取事故损失工时
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="accidentType"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public static decimal GetSumLoseWorkTimeByAccidentTimeAndAccidentType(DateTime startTime, DateTime endTime, string accidentType, string projectId)
{
decimal loseTime = 0;
var q = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.WorkingHoursLoss;
foreach (var item in q)
{
if (item != null)
{
loseTime += Funs.GetNewDecimalOrZero(item.ToString());
}
}
//if (accidentType == "1" || accidentType == "2" || accidentType == "3") //轻重死事故按审批完成时间
//{
// var a = from x in Funs.DB.Accident_AccidentReport
// join y in Funs.DB.Sys_FlowOperate
// on x.AccidentReportId equals y.DataId
// where x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2
// && y.State == BLL.Const.State_2 && y.OperaterTime >= startTime && y.OperaterTime < endTime
// select x.WorkingHoursLoss;
// foreach (var item in a)
// {
// if (item != null)
// {
// loseTime += Funs.GetNewDecimal(item.ToString());
// }
// }
//}
//else
//{
// var q = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.WorkingHoursLoss;
// foreach (var item in q)
// {
// if (item != null)
// {
// loseTime += Funs.GetNewDecimal(item.ToString());
// }
// }
//}
return loseTime;
}
/// <summary>
/// 根据时间段和类型获取事故损失金额
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="accidentType"></param>
/// <param name="projectId"></param>
/// <returns></returns>
public static decimal GetSumLosMoneyByAccidentTimeAndAccidentType(DateTime startTime, DateTime endTime, string accidentType, string projectId)
{
decimal loseMoney = 0;
var q = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.EconomicLoss;
foreach (var item in q)
{
if (item != null)
{
loseMoney += Funs.GetNewDecimalOrZero(item.ToString());
}
}
var c = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.EconomicOtherLoss;
foreach (var item in c)
{
if (item != null)
{
loseMoney += Funs.GetNewDecimalOrZero(item.ToString());
}
}
//if (accidentType == "1" || accidentType == "2" || accidentType == "3") //轻重死事故按审批完成时间
//{
// var a = from x in Funs.DB.Accident_AccidentReport
// join y in Funs.DB.Sys_FlowOperate
// on x.AccidentReportId equals y.DataId
// where x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2
// && y.State == BLL.Const.State_2 && y.OperaterTime >= startTime && y.OperaterTime < endTime
// select x.EconomicLoss;
// foreach (var item in a)
// {
// if (item != null)
// {
// loseMoney += Funs.GetNewDecimal(item.ToString());
// }
// }
// var b = from x in Funs.DB.Accident_AccidentReport
// join y in Funs.DB.Sys_FlowOperate
// on x.AccidentReportId equals y.DataId
// where x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2
// && y.State == BLL.Const.State_2 && y.OperaterTime >= startTime && y.OperaterTime < endTime
// select x.EconomicOtherLoss;
// foreach (var item in b)
// {
// if (item != null)
// {
// loseMoney += Funs.GetNewDecimal(item.ToString());
// }
// }
//}
//else
//{
// var q = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.EconomicLoss;
// foreach (var item in q)
// {
// if (item != null)
// {
// loseMoney += Funs.GetNewDecimal(item.ToString());
// }
// }
// var c = from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentType && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x.EconomicOtherLoss;
// foreach (var item in c)
// {
// if (item != null)
// {
// loseMoney += Funs.GetNewDecimal(item.ToString());
// }
// }
//}
return loseMoney;
}
/// <summary>
/// 根据时间和事故类型名称获取事故调查报告集合
/// </summary>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="accidentTypeName"></param>
/// <returns></returns>
public static List<Model.Accident_AccidentReport> GetAccidentReportsByTimeAndAccidentTypeId(DateTime startTime, DateTime endTime, string projectId, string accidentTypeId)
{
if (accidentTypeId == "1" || accidentTypeId == "2" || accidentTypeId == "3") //轻重死事故按审批完成时间
{
return (from x in Funs.DB.Accident_AccidentReport
join y in Funs.DB.Sys_FlowOperate
on x.AccidentReportId equals y.DataId
where x.AccidentTypeId == accidentTypeId && x.ProjectId == projectId && x.States == BLL.Const.State_2
&& y.State == BLL.Const.State_2 && y.OperaterTime >= startTime && y.OperaterTime < endTime
select x).Distinct().ToList();
}
else
{
return (from x in Funs.DB.Accident_AccidentReport where x.AccidentDate >= startTime && x.AccidentDate < endTime && x.AccidentTypeId == accidentTypeId && x.ProjectId == projectId && x.States == BLL.Const.State_2 select x).ToList();
}
}
/// <summary>
/// 添加事故调查报告
/// </summary>
/// <param name="accidentReport"></param>
public static void AddAccidentReport(Model.Accident_AccidentReport accidentReport)
{
Model.SUBQHSEDB db = Funs.DB;
Model.Accident_AccidentReport newAccidentReport = new Model.Accident_AccidentReport
{
AccidentReportId = accidentReport.AccidentReportId,
ProjectId = accidentReport.ProjectId,
AccidentReportCode = accidentReport.AccidentReportCode,
UnitId = accidentReport.UnitId,
AccidentReportType = accidentReport.AccidentReportType,
FileContent = accidentReport.FileContent,
CompileMan = accidentReport.CompileMan,
CompileDate = accidentReport.CompileDate,
States = accidentReport.States,
AccidentReportName = accidentReport.AccidentReportName,
AccidentTypeId = accidentReport.AccidentTypeId,
Abstract = accidentReport.Abstract,
AccidentDate = accidentReport.AccidentDate,
WorkAreaId = accidentReport.WorkAreaId,
PeopleNum = accidentReport.PeopleNum,
WorkingHoursLoss = accidentReport.WorkingHoursLoss,
EconomicLoss = accidentReport.EconomicLoss,
EconomicOtherLoss = accidentReport.EconomicOtherLoss,
ReportMan = accidentReport.ReportMan,
ReporterUnit = accidentReport.ReporterUnit,
ReportDate = accidentReport.ReportDate,
ProcessDescription = accidentReport.ProcessDescription,
EmergencyMeasures = accidentReport.EmergencyMeasures,
WorkArea = accidentReport.WorkArea,
IsNotConfirm = accidentReport.IsNotConfirm,
NotConfirmWorkingHoursLoss = accidentReport.NotConfirmWorkingHoursLoss,
NotConfirmEconomicLoss = accidentReport.NotConfirmEconomicLoss,
NotConfirmEconomicOtherLoss = accidentReport.NotConfirmEconomicOtherLoss,
NotConfirmed = accidentReport.NotConfirmed
};
db.Accident_AccidentReport.InsertOnSubmit(newAccidentReport);
db.SubmitChanges();
CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectAccidentReportMenuId, accidentReport.ProjectId, null, accidentReport.AccidentReportId, accidentReport.CompileDate);
}
/// <summary>
/// 修改事故调查报告
/// </summary>
/// <param name="accidentReport"></param>
public static void UpdateAccidentReport(Model.Accident_AccidentReport accidentReport)
{
Model.SUBQHSEDB db = Funs.DB;
Model.Accident_AccidentReport newAccidentReport = db.Accident_AccidentReport.FirstOrDefault(e => e.AccidentReportId == accidentReport.AccidentReportId);
if (newAccidentReport != null)
{
//newAccidentReport.ProjectId = accidentReport.ProjectId;
newAccidentReport.AccidentReportCode = accidentReport.AccidentReportCode;
newAccidentReport.UnitId = accidentReport.UnitId;
newAccidentReport.AccidentReportType = accidentReport.AccidentReportType;
newAccidentReport.FileContent = accidentReport.FileContent;
newAccidentReport.CompileMan = accidentReport.CompileMan;
newAccidentReport.CompileDate = accidentReport.CompileDate;
newAccidentReport.States = accidentReport.States;
newAccidentReport.AccidentReportName = accidentReport.AccidentReportName;
newAccidentReport.AccidentTypeId = accidentReport.AccidentTypeId;
newAccidentReport.Abstract = accidentReport.Abstract;
newAccidentReport.AccidentDate = accidentReport.AccidentDate;
newAccidentReport.WorkAreaId = accidentReport.WorkAreaId;
newAccidentReport.PeopleNum = accidentReport.PeopleNum;
newAccidentReport.WorkingHoursLoss = accidentReport.WorkingHoursLoss;
newAccidentReport.EconomicLoss = accidentReport.EconomicLoss;
newAccidentReport.EconomicOtherLoss = accidentReport.EconomicOtherLoss;
newAccidentReport.ReportMan = accidentReport.ReportMan;
newAccidentReport.ReporterUnit = accidentReport.ReporterUnit;
newAccidentReport.ReportDate = accidentReport.ReportDate;
newAccidentReport.ProcessDescription = accidentReport.ProcessDescription;
newAccidentReport.EmergencyMeasures = accidentReport.EmergencyMeasures;
newAccidentReport.WorkArea = accidentReport.WorkArea;
newAccidentReport.IsNotConfirm = accidentReport.IsNotConfirm;
newAccidentReport.NotConfirmWorkingHoursLoss = accidentReport.NotConfirmWorkingHoursLoss;
newAccidentReport.NotConfirmEconomicLoss = accidentReport.NotConfirmEconomicLoss;
newAccidentReport.NotConfirmEconomicOtherLoss = accidentReport.NotConfirmEconomicOtherLoss;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除事故调查报告
/// </summary>
/// <param name="accidentReportId"></param>
public static void DeleteAccidentReportById(string accidentReportId)
{
Model.SUBQHSEDB db = Funs.DB;
Model.Accident_AccidentReport accidentReport = db.Accident_AccidentReport.FirstOrDefault(e => e.AccidentReportId == accidentReportId);
if (accidentReport != null)
{
CodeRecordsService.DeleteCodeRecordsByDataId(accidentReportId);
CommonService.DeleteFlowOperateByID(accidentReportId);
db.Accident_AccidentReport.DeleteOnSubmit(accidentReport);
db.SubmitChanges();
}
}
}
}
@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public class AccidentSortBService
{
public static Model.SUBQHSEDB db = Funs.DB;
public static Model.Manager_AccidentSortB GetAccidentSortsByMonthReportIdAndAccidentType(string monthReportId, string accidentType)
{
return (from x in Funs.DB.Manager_AccidentSortB where x.MonthReportId == monthReportId && x.AccidentType == accidentType select x).FirstOrDefault();
}
/// <summary>
/// 根据月报告主键获取所有月报告事故分类信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static List<Model.Manager_AccidentSortB> GetAccidentSortsByMonthReportId(string monthReportId)
{
return (from x in Funs.DB.Manager_AccidentSortB where x.MonthReportId == monthReportId select x).ToList();
}
/// <summary>
/// 根据月报告主键集合及类型获取所有月报告事故分类信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static List<Model.Manager_AccidentSortB> GetAccidentSortsByMonthReportIdsAndAccidentType(List<string> monthReportIds, string accidentType)
{
return (from x in Funs.DB.Manager_AccidentSortB where monthReportIds.Contains(x.MonthReportId) && x.AccidentType == accidentType select x).ToList();
}
/// <summary>
/// 根据月报告主键获取总发生次数
/// </summary>
/// <param name="AccidentType">事故类型</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static int? GetSumNumberByMonthReportId(string monthReportId, string accidentType)
{
return (from x in Funs.DB.Manager_AccidentSortB where x.MonthReportId == monthReportId && x.AccidentType == accidentType select x.Number).Sum();
}
/// <summary>
/// 根据月报告主键获取总损失工时
/// </summary>
/// <param name="AccidentType">事故类型</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static int? GetSumLoseHoursByMonthReportId(string monthReportId, string accidentType)
{
return (from x in Funs.DB.Manager_AccidentSortB where x.MonthReportId == monthReportId && x.AccidentType == accidentType select x.LoseHours).Sum();
}
/// <summary>
/// 根据月报告主键获取总损失金额
/// </summary>
/// <param name="AccidentType">事故类型</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static decimal? GetSumLoseMoneyByMonthReportId(string monthReportId, string accidentType)
{
return (from x in Funs.DB.Manager_AccidentSortB where x.MonthReportId == monthReportId && x.AccidentType == accidentType select x.LoseMoney).Sum();
}
/// <summary>
/// 增加月报告事故分类信息
/// </summary>
/// <param name="accidentSort">月报告事故分类实体</param>
public static void AddAccidentSort(Model.Manager_AccidentSortB accidentSort)
{
Model.SUBQHSEDB db = Funs.DB;
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_AccidentSortB));
Model.Manager_AccidentSortB newAccidentSort = new Model.Manager_AccidentSortB
{
AccidentSortId = newKeyID,
MonthReportId = accidentSort.MonthReportId,
AccidentType = accidentSort.AccidentType,
TypeFlag = accidentSort.TypeFlag,
Number = accidentSort.Number,
TotalNum = accidentSort.TotalNum,
PersonNum = accidentSort.PersonNum,
TotalPersonNum = accidentSort.TotalPersonNum,
LoseHours = accidentSort.LoseHours,
TotalLoseHours = accidentSort.TotalLoseHours,
LoseMoney = accidentSort.LoseMoney,
TotalLoseMoney = accidentSort.TotalLoseMoney
};
db.Manager_AccidentSortB.InsertOnSubmit(newAccidentSort);
db.SubmitChanges();
}
/// <summary>
/// 根据月报告主键删除对应的所有月报告事故分类信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
public static void DeleteAccidentSortsByMonthReportId(string monthReportId)
{
var q = (from x in db.Manager_AccidentSortB where x.MonthReportId == monthReportId select x).ToList();
db.Manager_AccidentSortB.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public class CheckSortBService
{
public static Model.SUBQHSEDB db = Funs.DB;
/// <summary>
/// 根据月报告主键获取所有月报告HSE检查情况信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static List<Model.Manager_CheckSortB> GetCheckSortsByMonthReportId(string monthReportId)
{
return (from x in Funs.DB.Manager_CheckSortB where x.MonthReportId == monthReportId select x).ToList();
}
public static Model.Manager_CheckSortB GetCheckSortByMonthReportIdAndCheckType(string monthReportId, string checkType)
{
return (from x in Funs.DB.Manager_CheckSortB where x.MonthReportId == monthReportId && x.CheckType == checkType select x).FirstOrDefault();
}
/// <summary>
/// 根据月报告主键获取总检查次数
/// </summary>
/// <param name="checkType">安全检查类型</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static decimal? GetSumCheckNumberByMonthReportId(string monthReportId, string checkType)
{
return (from x in Funs.DB.Manager_CheckSortB where x.MonthReportId == monthReportId && x.CheckType == checkType select x.CheckNumber).Sum();
}
/// <summary>
/// 根据月报告主键获取总违章数量
/// </summary>
/// <param name="meetingType">安全检查类型</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static decimal? GetSumViolationNumberByMonthReportId(string monthReportId, string checkType)
{
return (from x in Funs.DB.Manager_CheckSortB where x.MonthReportId == monthReportId && x.CheckType == checkType select x.ViolationNumber).Sum();
}
/// <summary>
/// 增加月报告HSE检查情况信息
/// </summary>
/// <param name="checkSort">月报告HSE检查情况实体</param>
public static void AddCheckSort(Model.Manager_CheckSortB checkSort)
{
Model.SUBQHSEDB db = Funs.DB;
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_CheckSortB));
Model.Manager_CheckSortB newCheckSort = new Model.Manager_CheckSortB
{
CheckSortId = newKeyID,
MonthReportId = checkSort.MonthReportId,
CheckType = checkSort.CheckType,
CheckNumber = checkSort.CheckNumber,
TotalCheckNum = checkSort.TotalCheckNum,
ViolationNumber = checkSort.ViolationNumber,
TotalViolationNum = checkSort.TotalViolationNum
};
db.Manager_CheckSortB.InsertOnSubmit(newCheckSort);
db.SubmitChanges();
}
/// <summary>
/// 根据月报告主键删除对应的所有月报告HSE检查情况信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
public static void DeleteCheckSortsByMonthReportId(string monthReportId)
{
var q = (from x in db.Manager_CheckSortB where x.MonthReportId == monthReportId select x).ToList();
db.Manager_CheckSortB.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Web.UI.WebControls;
namespace BLL
{
public class CostAnalyseService
{
/// <summary>
/// 获取某一人工时和投入安全费用比率信息
/// </summary>
/// <param name="costAnalyseId"></param>
/// <returns></returns>
public static Model.Manager_CostAnalyse getCostAnalyseByCostAnalyseId(string analyseId)
{
return Funs.DB.Manager_CostAnalyse.FirstOrDefault(e => e.AnalyseId == analyseId);
}
/// <summary>
/// 获取某一人工时和投入安全费用比率信息
/// </summary>
/// <param name="months">月份</param>
/// <returns></returns>
public static Model.Manager_CostAnalyse getCostAnalyseByMonths(DateTime? months, string projectId)
{
return Funs.DB.Manager_CostAnalyse.FirstOrDefault(e => e.Months == months && e.ProjectId == projectId);
}
/// <summary>
/// 添加人工时和投入安全费用比率信息
/// </summary>
/// <param name="costAnalyseName"></param>
/// <param name="def"></param>
public static void AddCostAnalyse(Model.Manager_CostAnalyse costAnalyse)
{
Model.SUBQHSEDB db = Funs.DB;
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_CostAnalyse));
Model.Manager_CostAnalyse newCostAnalyse = new Model.Manager_CostAnalyse
{
AnalyseId = newKeyID,
ProjectId = costAnalyse.ProjectId,
Months = costAnalyse.Months,
TotalRealCostMoney = costAnalyse.TotalRealCostMoney,
Manhours = costAnalyse.Manhours,
Analyse = costAnalyse.Analyse
};
db.Manager_CostAnalyse.InsertOnSubmit(newCostAnalyse);
db.SubmitChanges();
}
/// <summary>
/// 修改人工时和投入安全费用比率信息
/// </summary>
/// <param name="costAnalyseId"></param>
/// <param name="costAnalyseName"></param>
/// <param name="def"></param>
public static void UpdateCostAnalyse(Model.Manager_CostAnalyse costAnalyse)
{
Model.SUBQHSEDB db = Funs.DB;
Model.Manager_CostAnalyse newCostAnalyse = db.Manager_CostAnalyse.First(e => e.AnalyseId == costAnalyse.AnalyseId);
newCostAnalyse.Months = costAnalyse.Months;
newCostAnalyse.Analyse = costAnalyse.Analyse;
newCostAnalyse.TotalRealCostMoney = costAnalyse.TotalRealCostMoney;
newCostAnalyse.Manhours = costAnalyse.Manhours;
db.SubmitChanges();
}
/// <summary>
/// 删除人工时和投入安全费用比率信息
/// </summary>
/// <param name="costAnalyseId"></param>
public static void DeleteCostAnalyse(string analyseId)
{
Model.SUBQHSEDB db = Funs.DB;
Model.Manager_CostAnalyse costAnalyse = db.Manager_CostAnalyse.First(e => e.AnalyseId == analyseId);
db.Manager_CostAnalyse.DeleteOnSubmit(costAnalyse);
db.SubmitChanges();
}
/// <summary>
/// 删除人工时和投入安全费用比率信息
/// </summary>
/// <param name="months"></param>
public static void DeleteCostAnalyseByMonths(DateTime? months)
{
Model.SUBQHSEDB db = Funs.DB;
Model.Manager_CostAnalyse costAnalyse = db.Manager_CostAnalyse.First(e => e.Months == months);
db.Manager_CostAnalyse.DeleteOnSubmit(costAnalyse);
db.SubmitChanges();
}
}
}
@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public class CostStatisticDetailService
{
//public static decimal? GetSumCostMoneyByCostStatisticCode(string costCode)
//{
// return (from x in Funs.DB.TC_CostStatisticDetail where x.CostStatisticCode == costCode select x.CostMoney).Sum();
//}
public static List<Model.TC_CostStatisticDetail> GetCostStatisticDetailsByUnitId(string unitId, DateTime startTime, DateTime endTime)
{
return (from x in Funs.DB.TC_CostStatisticDetail
join y in Funs.DB.TC_CostStatistic on x.CostStatisticCode equals y.CostStatisticCode
where x.UnitId == unitId && y.Months >= startTime && y.Months < endTime
select x).Distinct().ToList();
}
public static Model.TC_CostStatisticDetail GetCostStatisticDetailByUnitId(string unitId, string costStatisticCode)
{
return (from x in Funs.DB.TC_CostStatisticDetail where x.CostStatisticCode == costStatisticCode && x.UnitId == unitId select x).FirstOrDefault();
}
public static List<Model.TC_CostStatisticDetail> GetCostStatisticDetailsByCostStatisticCode(string costStatisticCode)
{
return (from x in Funs.DB.TC_CostStatisticDetail where x.CostStatisticCode == costStatisticCode orderby x.UnitId select x).ToList();
}
/// <summary>
/// 增加费用汇总明细信息
/// </summary>
/// <param name="pauseNotice">费用汇总明细实体</param>
public static void AddCostStatisticDetail(Model.TC_CostStatisticDetail detail)
{
Model.SUBQHSEDB db = Funs.DB;
string CostStatisticDetailId = SQLHelper.GetNewID(typeof(Model.TC_CostStatisticDetail));
Model.TC_CostStatisticDetail newtc_CostDetail = new Model.TC_CostStatisticDetail
{
CostStatisticDetailId = CostStatisticDetailId,
CostStatisticCode = detail.CostStatisticCode,
UnitId = detail.UnitId,
A1 = detail.A1,
YA1 = detail.YA1,
PA1 = detail.PA1,
A2 = detail.A2,
YA2 = detail.YA2,
PA2 = detail.PA2,
A3 = detail.A3,
YA3 = detail.YA3,
PA3 = detail.PA3,
A4 = detail.A4,
YA4 = detail.YA4,
PA4 = detail.PA4,
A5 = detail.A5,
YA5 = detail.YA5,
PA5 = detail.PA5,
A6 = detail.A6,
YA6 = detail.YA6,
PA6 = detail.PA6,
A = detail.A,
YA = detail.YA,
PA = detail.PA,
B1 = detail.B1,
YB1 = detail.YB1,
PB1 = detail.PB1,
B2 = detail.B2,
YB2 = detail.YB2,
PB2 = detail.PB2,
B3 = detail.B3,
YB3 = detail.YB3,
PB3 = detail.PB3,
B = detail.B,
YB = detail.YB,
PB = detail.PB,
AB = detail.AB,
YAB = detail.YAB,
PAB = detail.PAB
};
db.TC_CostStatisticDetail.InsertOnSubmit(newtc_CostDetail);
db.SubmitChanges();
}
/// <summary>
/// 根据费用汇总编号删除对应的费用汇总明细信息
/// </summary>
/// <param name="actionPlanCode">施计划编号</param>
public static void DeleteCostStatisticDetailByCostStatisticCode(string costStatisticCode)
{
Model.SUBQHSEDB db = Funs.DB;
var q = (from x in db.TC_CostStatisticDetail where x.CostStatisticCode == costStatisticCode select x).ToList();
db.TC_CostStatisticDetail.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
@@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using System.Text;
using System.Collections;
using System.Web.UI.WebControls;
namespace BLL
{
public class CostStatisticService
{
public static Model.SUBQHSEDB db = Funs.DB;
/// <summary>
/// 记录数
/// </summary>
private static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.TC_CostStatistic> cost = from x in db.TC_CostStatistic orderby x.CostStatisticCode descending select x;
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="startRowIndex"></param>
/// <param name="maximumRows"></param>
/// <returns></returns>
public static IEnumerable getListCost(string projectId, int startRowIndex, int maximumRows)
{
IQueryable<Model.TC_CostStatistic> q = cost;
if (!string.IsNullOrEmpty(projectId))
{
q = q.Where(e => e.ProjectId == projectId);
}
count = q.Count();
if (count == 0)
{
return new object[] { "" };
}
return from x in q.Skip(startRowIndex).Take(maximumRows)
select new
{
x.CostStatisticCode,
x.ProjectId,
Months = Convert.ToDateTime(x.Months).Year + "-" + (Convert.ToInt32(Convert.ToDateTime(x.Months).Month) < 10 ? ("0" + Convert.ToDateTime(x.Months).Month).ToString() : Convert.ToDateTime(x.Months).Month.ToString()),
};
}
/// <summary>
/// 获取列表数
/// </summary>
/// <returns></returns>
public static int getListCount(string projectId)
{
return count;
}
/// <summary>
/// 根据费用汇总编号查询费用汇总信息
/// </summary>
/// <param name="checkCode">费用汇总编号</param>
/// <returns>费用汇总信息</returns>
public static Model.TC_CostStatistic GetCostStatisticByCostStatisticCode(string costStatisticCode)
{
return Funs.DB.TC_CostStatistic.FirstOrDefault(x => x.CostStatisticCode == costStatisticCode);
}
/// <summary>
/// 根据月份和项目号查询费用汇总信息
/// </summary>
/// <param name="months">月份</param>
/// <param name="projectId">项目号</param>
/// <returns>费用汇总信息</returns>
public static Model.TC_CostStatistic GetCostStatisticByMonthsAndProjectId(DateTime months, string projectId)
{
return Funs.DB.TC_CostStatistic.FirstOrDefault(x => x.Months == months && x.ProjectId == projectId);
}
/// <summary>
/// 根据月份和项目号查询最近的一条费用汇总信息
/// </summary>
/// <param name="months">月份</param>
/// <param name="projectId">项目号</param>
/// <returns>费用汇总信息</returns>
public static Model.TC_CostStatistic GetLastCostStatisticByMonthsAndProjectId(DateTime months, string projectId)
{
return (from x in Funs.DB.TC_CostStatistic where x.Months < months && x.ProjectId == projectId orderby x.Months descending select x).FirstOrDefault();
}
/// <summary>
/// 增加费用汇总信息
/// </summary>
/// <param name="pauseNotice">费用汇总实体</param>
public static void AddCostStatistic(Model.TC_CostStatistic tc_CostStatistic)
{
Model.SUBQHSEDB db = Funs.DB;
Model.TC_CostStatistic newtc_CostStatistic = new Model.TC_CostStatistic
{
CostStatisticCode = tc_CostStatistic.CostStatisticCode,
ProjectId = tc_CostStatistic.ProjectId,
Months = tc_CostStatistic.Months,
CompileMan = tc_CostStatistic.CompileMan,
CompileDate = tc_CostStatistic.CompileDate
};
db.TC_CostStatistic.InsertOnSubmit(newtc_CostStatistic);
db.SubmitChanges();
}
/// <summary>
/// 根据费用汇总主键删除一个费用汇总信息
/// </summary>
/// <param name="pauseNoticeCode">费用汇总主键</param>
public static void DeleteCostStatisticByCostStatisticCode(string costStatisticCode)
{
Model.SUBQHSEDB db = Funs.DB;
Model.TC_CostStatistic tc_CostStatistic = db.TC_CostStatistic.FirstOrDefault(e => e.CostStatisticCode == costStatisticCode);
if (tc_CostStatistic != null)
{
db.TC_CostStatistic.DeleteOnSubmit(tc_CostStatistic);
db.SubmitChanges();
}
}
}
}
@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public class HseCostBService
{
/// <summary>
/// 根据月报告主键获取所有月报告HSE技术措施费用信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static List<Model.Manager_HseCostB> GetHseCostsByMonthReportId(string monthReportId)
{
return (from x in Funs.DB.Manager_HseCostB where x.MonthReportId == monthReportId orderby x.UnitId select x).ToList();
}
/// <summary>
/// 根据月报告主键和单位Id获取所有月报告HSE技术措施费用信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
/// <param name="unitId">单位Id</param>
/// <returns></returns>
public static Model.Manager_HseCostB GetHseCostsByMonthReportIdAndUnitId(string monthReportId, string unitId)
{
return (from x in Funs.DB.Manager_HseCostB where x.MonthReportId == monthReportId && x.UnitId == unitId select x).FirstOrDefault();
}
/// <summary>
/// 根据月报告主键获取年度累计实际支出
/// </summary>
/// <param name="unitId">单位主键</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
//public static decimal? GetSumYearRealCostByMonthReportId(string monthReportId, string unitId)
//{
// return (from x in Funs.DB.Manager_HseCostB where x.MonthReportId == monthReportId && x.UnitId == unitId select x.YearRealCost).FirstOrDefault();
//}
/// <summary>
/// 根据月报告主键获取总累计实际支出
/// </summary>
/// <param name="unitId">单位主键</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
//public static decimal? GetSumTotalRealCostByMonthReportId(string monthReportId, string unitId)
//{
// return (from x in Funs.DB.Manager_HseCostB where x.MonthReportId == monthReportId && x.UnitId == unitId select x.TotalRealCost).FirstOrDefault();
//}
/// <summary>
/// 增加月报告HSE技术措施费用信息
/// </summary>
/// <param name="hseCost">月报告HSE技术措施费用实体</param>
public static void AddHseCost(Model.Manager_HseCostB hseCost)
{
Model.SUBQHSEDB db = Funs.DB;
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_HseCostB));
Model.Manager_HseCostB newHseCost = new Model.Manager_HseCostB
{
HseCostId = newKeyID,
MonthReportId = hseCost.MonthReportId,
UnitId = hseCost.UnitId,
PlanCostA = hseCost.PlanCostA,
PlanCostB = hseCost.PlanCostB,
RealCostA = hseCost.RealCostA,
ProjectRealCostA = hseCost.ProjectRealCostA,
RealCostB = hseCost.RealCostB,
ProjectRealCostB = hseCost.ProjectRealCostB,
RealCostAB = hseCost.RealCostAB,
ProjectRealCostAB = hseCost.ProjectRealCostAB
};
db.Manager_HseCostB.InsertOnSubmit(newHseCost);
db.SubmitChanges();
}
/// <summary>
/// 根据月报告主键删除对应的所有月报告HSE技术措施费用信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
public static void DeleteHseCostsByMonthReportId(string monthReportId)
{
Model.SUBQHSEDB db = Funs.DB;
var q = (from x in db.Manager_HseCostB where x.MonthReportId == monthReportId select x).ToList();
db.Manager_HseCostB.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public class IncentiveSortBService
{
public static Model.SUBQHSEDB db = Funs.DB;
public static Model.Manager_IncentiveSortB GetIncentiveSortByMonthReportIdAndIncentiveType(string monthReportId, string incentiveType)
{
return (from x in Funs.DB.Manager_IncentiveSortB where x.MonthReportId == monthReportId && x.IncentiveType == incentiveType select x).FirstOrDefault();
}
/// <summary>
/// 根据月报告主键获取所有月报告HSE奖惩情况信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static List<Model.Manager_IncentiveSortB> GetIncentiveSortsByMonthReportId(string monthReportId)
{
return (from x in Funs.DB.Manager_IncentiveSortB where x.MonthReportId == monthReportId select x).ToList();
}
/// <summary>
/// 根据月报告主键获取总奖惩金额
/// </summary>
/// <param name="incentiveType">奖惩类型</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static decimal? GetSumIncentiveMoneyByMonthReportId(string monthReportId, string incentiveType)
{
return (from x in Funs.DB.Manager_IncentiveSortB where x.MonthReportId == monthReportId && x.IncentiveType == incentiveType select x.IncentiveMoney).Sum();
}
/// <summary>
/// 根据月报告主键获取总奖惩次数
/// </summary>
/// <param name="incentiveType">奖惩类型</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static int? GetSumIncentiveNumberByMonthReportId(string monthReportId, string incentiveType)
{
return (from x in Funs.DB.Manager_IncentiveSortB where x.MonthReportId == monthReportId && x.IncentiveType == incentiveType select x.TotalIncentiveNumber).FirstOrDefault();
}
/// <summary>
/// 增加月报告HSE奖惩情况信息
/// </summary>
/// <param name="incentiveSort">月报告HSE奖惩情况实体</param>
public static void AddIncentiveSort(Model.Manager_IncentiveSortB incentiveSort)
{
Model.SUBQHSEDB db = Funs.DB;
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_IncentiveSortB));
Model.Manager_IncentiveSortB newIncentiveSort = new Model.Manager_IncentiveSortB
{
IncentiveSortId = newKeyID,
MonthReportId = incentiveSort.MonthReportId,
IncentiveType = incentiveSort.IncentiveType,
BigType = incentiveSort.BigType,
TypeFlag = incentiveSort.TypeFlag,
IncentiveMoney = incentiveSort.IncentiveMoney,
TotalIncentiveMoney = incentiveSort.TotalIncentiveMoney,
IncentiveNumber = incentiveSort.IncentiveNumber,
TotalIncentiveNumber = incentiveSort.TotalIncentiveNumber
};
db.Manager_IncentiveSortB.InsertOnSubmit(newIncentiveSort);
db.SubmitChanges();
}
/// <summary>
/// 根据月报告主键删除对应的所有月报告HSE奖惩情况信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
public static void DeleteIncentiveSortsByMonthReportId(string monthReportId)
{
var q = (from x in db.Manager_IncentiveSortB where x.MonthReportId == monthReportId select x).ToList();
db.Manager_IncentiveSortB.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
@@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace BLL
{
public class ManhoursSortBService
{
public static Model.SUBQHSEDB db = Funs.DB;
/// <summary>
/// 获取分页列表
/// </summary>
/// <returns></returns>
public static IEnumerable getListData(string monthReportId)
{
return from x in db.Manager_ManhoursSortB
where x.MonthReportId == monthReportId
orderby x.UnitId
select new
{
UnitName = (from y in db.Base_Unit where y.UnitId == x.UnitId select y.UnitName).First(),
x.PersonTotal,
x.ManhoursTotal,
x.TotalManhoursTotal,
};
}
/// <summary>
/// 根据月报告主键获取所有月报告人工时分类信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static List<Model.Manager_ManhoursSortB> GetManhoursSortsByMonthReportId(string monthReportId)
{
return (from x in Funs.DB.Manager_ManhoursSortB where x.MonthReportId == monthReportId orderby x.UnitId select x).ToList();
}
/// <summary>
/// 根据月报告主键获取总完成人工时
/// </summary>
/// <param name="unitId">单位主键</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static decimal? GetSumManhoursTotalByMonthReportId(string monthReportId, string unitId)
{
return (from x in Funs.DB.Manager_ManhoursSortB where x.MonthReportId == monthReportId && x.UnitId == unitId select x.ManhoursTotal).Sum();
}
/// <summary>
/// 根据月报告主键和单位主键获取一条记录
/// </summary>
/// <param name="unitId">单位主键</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static Model.Manager_ManhoursSortB GetSumManhoursTotalByMonthReportIdAndUnitId(string monthReportId, string unitId)
{
return (from x in Funs.DB.Manager_ManhoursSortB where x.MonthReportId == monthReportId && x.UnitId == unitId select x).FirstOrDefault();
}
/// <summary>
/// 增加月报告人工时分类信息
/// </summary>
/// <param name="manhoursSort">月报告人工时分类实体</param>
public static void AddManhoursSort(Model.Manager_ManhoursSortB manhoursSort)
{
Model.SUBQHSEDB db = Funs.DB;
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_ManhoursSortB));
Model.Manager_ManhoursSortB newManhoursSort = new Model.Manager_ManhoursSortB
{
ManhoursSortId = newKeyID,
MonthReportId = manhoursSort.MonthReportId,
UnitId = manhoursSort.UnitId,
PersonTotal = manhoursSort.PersonTotal,
ManhoursTotal = manhoursSort.ManhoursTotal,
TotalManhoursTotal = manhoursSort.TotalManhoursTotal
};
db.Manager_ManhoursSortB.InsertOnSubmit(newManhoursSort);
db.SubmitChanges();
}
/// <summary>
/// 根据月报告主键删除对应的所有月报告人工时分类信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
public static void DeleteManhoursSortsByMonthReportId(string monthReportId)
{
var q = (from x in Funs.DB.Manager_ManhoursSortB where x.MonthReportId == monthReportId select x).ToList();
Funs.DB.Manager_ManhoursSortB.DeleteAllOnSubmit(q);
Funs.DB.SubmitChanges();
}
}
}
@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public class MeetingSortBService
{
public static Model.SUBQHSEDB db = Funs.DB;
/// <summary>
/// 根据月报告主键获取所有月报告HSE会议情况信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static List<Model.Manager_MeetingSortB> GetMeetingSortsByMonthReportId(string monthReportId)
{
return (from x in Funs.DB.Manager_MeetingSortB where x.MonthReportId == monthReportId select x).ToList();
}
public static Model.Manager_MeetingSortB GetMeetingSortsByMonthReportIdAndMeetingType(string monthReportId, string meetingType)
{
return (from x in Funs.DB.Manager_MeetingSortB where x.MonthReportId == monthReportId && x.MeetingType == meetingType select x).FirstOrDefault();
}
/// <summary>
/// 根据月报告主键获取总会议次数
/// </summary>
/// <param name="meetingType">会议类型</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static decimal? GetSumMeetingNumberByMonthReportId(string monthReportId, string meetingType)
{
return (from x in Funs.DB.Manager_MeetingSortB where x.MonthReportId == monthReportId && x.MeetingType == meetingType select x.MeetingNumber).Sum();
}
/// <summary>
/// 根据月报告主键获取总参加人数
/// </summary>
/// <param name="meetingType">会议类型</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static decimal? GetSumMeetingPersonNumberByMonthReportId(string monthReportId, string meetingType)
{
return (from x in Funs.DB.Manager_MeetingSortB where x.MonthReportId == monthReportId && x.MeetingType == meetingType select x.MeetingPersonNumber).Sum();
}
/// <summary>
/// 增加月报告HSE会议情况信息
/// </summary>
/// <param name="meetingSort">月报告HSE会议情况实体</param>
public static void AddMeetingSort(Model.Manager_MeetingSortB meetingSort)
{
Model.SUBQHSEDB db = Funs.DB;
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_MeetingSortB));
Model.Manager_MeetingSortB newMeetingSort = new Model.Manager_MeetingSortB
{
MeetingSortId = newKeyID,
MonthReportId = meetingSort.MonthReportId,
MeetingType = meetingSort.MeetingType,
MeetingNumber = meetingSort.MeetingNumber,
TotalMeetingNum = meetingSort.TotalMeetingNum,
MeetingPersonNumber = meetingSort.MeetingPersonNumber,
TotalMeetingPersonNum = meetingSort.TotalMeetingPersonNum
};
db.Manager_MeetingSortB.InsertOnSubmit(newMeetingSort);
db.SubmitChanges();
}
/// <summary>
/// 根据月报告主键删除对应的所有月报告HSE会议情况信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
public static void DeleteMeetingSortsByMonthReportId(string monthReportId)
{
var q = (from x in db.Manager_MeetingSortB where x.MonthReportId == monthReportId select x).ToList();
db.Manager_MeetingSortB.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public class TrainSortBService
{
public static Model.SUBQHSEDB db = Funs.DB;
/// <summary>
/// 根据月报告主键获取所有月报告HSE培训情况信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static List<Model.Manager_TrainSortB> GetTrainSortsByMonthReportId(string monthReportId)
{
return (from x in Funs.DB.Manager_TrainSortB where x.MonthReportId == monthReportId select x).ToList();
}
public static Model.Manager_TrainSortB GetTrainSortByMonthReportIdAndTrainType(string monthReportId, string trainType)
{
return (from x in Funs.DB.Manager_TrainSortB where x.MonthReportId == monthReportId && x.TrainType == trainType select x).FirstOrDefault();
}
/// <summary>
/// 根据月报告主键获取总培训次数
/// </summary>
/// <param name="trainType">培训类型</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static decimal? GetSumTrainNumberByMonthReportId(string monthReportId, string trainType)
{
return (from x in Funs.DB.Manager_TrainSortB where x.MonthReportId == monthReportId && x.TrainType == trainType select x.TrainNumber).Sum();
}
/// <summary>
/// 根据月报告主键获取总培训人数
/// </summary>
/// <param name="trainType">培训类型</param>
/// <param name="monthReportId">月报告主键</param>
/// <returns></returns>
public static decimal? GetSumTrainPersonNumberByMonthReportId(string monthReportId, string trainType)
{
return (from x in Funs.DB.Manager_TrainSortB where x.MonthReportId == monthReportId && x.TrainType == trainType select x.TrainPersonNumber).Sum();
}
/// <summary>
/// 增加月报告HSE培训情况信息
/// </summary>
/// <param name="trainSort">月报告HSE培训情况实体</param>
public static void AddTrainSort(Model.Manager_TrainSortB trainSort)
{
Model.SUBQHSEDB db = Funs.DB;
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_TrainSortB));
Model.Manager_TrainSortB newTrainSort = new Model.Manager_TrainSortB
{
TrainSortId = newKeyID,
MonthReportId = trainSort.MonthReportId,
TrainType = trainSort.TrainType,
TrainNumber = trainSort.TrainNumber,
TotalTrainNum = trainSort.TotalTrainNum,
TrainPersonNumber = trainSort.TrainPersonNumber,
TotalTrainPersonNum = trainSort.TotalTrainPersonNum
};
db.Manager_TrainSortB.InsertOnSubmit(newTrainSort);
db.SubmitChanges();
}
/// <summary>
/// 根据月报告主键删除对应的所有月报告HSE培训情况信息
/// </summary>
/// <param name="monthReportId">月报告主键</param>
public static void DeleteTrainSortsByMonthReportId(string monthReportId)
{
var q = (from x in db.Manager_TrainSortB where x.MonthReportId == monthReportId select x).ToList();
db.Manager_TrainSortB.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}