149 lines
6.1 KiB
C#
149 lines
6.1 KiB
C#
using FineUIPro;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 体检管理
|
|
/// </summary>
|
|
public static class PhysicalExaminationService
|
|
{
|
|
public static Model.SGGLDB db = Funs.DB;
|
|
|
|
#region 获取安全巡检列表信息
|
|
/// <summary>
|
|
/// 记录数
|
|
/// </summary>
|
|
public static int count
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 定义变量
|
|
/// </summary>
|
|
private static IQueryable<Model.SitePerson_Person> getDataLists = from x in db.SitePerson_Person
|
|
select x;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="projectId"></param>
|
|
/// <param name="personName"></param>
|
|
/// <param name="Grid1"></param>
|
|
/// <returns></returns>
|
|
public static IEnumerable getListData(string projectId, string personName, Grid Grid1)
|
|
{
|
|
IQueryable<Model.SitePerson_Person> getDataList = getDataLists;
|
|
if (!string.IsNullOrEmpty(projectId))
|
|
{
|
|
getDataList = getDataList.Where(e => e.ProjectId == projectId);
|
|
}
|
|
if (!string.IsNullOrEmpty(personName))
|
|
{
|
|
getDataList = getDataList.Where(e => e.PersonName.Contains(personName));
|
|
}
|
|
|
|
count = getDataList.Count();
|
|
if (count == 0)
|
|
{
|
|
return null;
|
|
}
|
|
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
|
return from x in getDataList
|
|
select new
|
|
{
|
|
x.ProjectId,
|
|
ProjectName = db.Base_Project.First(p => p.ProjectId == x.ProjectId).ProjectName,
|
|
x.UnitId,
|
|
UnitName = db.Base_Unit.First(p => p.UnitId == x.UnitId).UnitName,
|
|
x.SitePersonId,
|
|
x.PersonId,
|
|
x.CardNo,
|
|
x.PersonName,
|
|
};
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 根据主键获取体检管理
|
|
/// </summary>
|
|
/// <param name="PhysicalExaminationId"></param>
|
|
/// <returns></returns>
|
|
public static Model.OccupationHealth_PhysicalExamination GetPhysicalExaminationById(string fileId)
|
|
{
|
|
return Funs.DB.OccupationHealth_PhysicalExamination.FirstOrDefault(e => e.FileId == fileId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加体检管理
|
|
/// </summary>
|
|
/// <param name="PhysicalExamination"></param>
|
|
public static void AddPhysicalExamination(Model.OccupationHealth_PhysicalExamination PhysicalExamination)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.OccupationHealth_PhysicalExamination newPhysicalExamination = new Model.OccupationHealth_PhysicalExamination
|
|
{
|
|
FileId = PhysicalExamination.FileId,
|
|
FileCode = PhysicalExamination.FileCode,
|
|
ProjectId = PhysicalExamination.ProjectId,
|
|
FileName = PhysicalExamination.FileName,
|
|
FileContent = PhysicalExamination.FileContent,
|
|
CompileMan = PhysicalExamination.CompileMan,
|
|
CompileDate = PhysicalExamination.CompileDate,
|
|
AttachUrl = PhysicalExamination.AttachUrl,
|
|
States = PhysicalExamination.States
|
|
};
|
|
db.OccupationHealth_PhysicalExamination.InsertOnSubmit(newPhysicalExamination);
|
|
db.SubmitChanges();
|
|
////增加一条编码记录
|
|
BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.PhysicalExaminationMenuId, PhysicalExamination.ProjectId, null, PhysicalExamination.FileId, PhysicalExamination.CompileDate);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改体检管理
|
|
/// </summary>
|
|
/// <param name="PhysicalExamination"></param>
|
|
public static void UpdatePhysicalExamination(Model.OccupationHealth_PhysicalExamination PhysicalExamination)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.OccupationHealth_PhysicalExamination newPhysicalExamination = db.OccupationHealth_PhysicalExamination.FirstOrDefault(e => e.FileId == PhysicalExamination.FileId);
|
|
if (newPhysicalExamination != null)
|
|
{
|
|
newPhysicalExamination.FileCode = PhysicalExamination.FileCode;
|
|
newPhysicalExamination.FileName = PhysicalExamination.FileName;
|
|
newPhysicalExamination.FileContent = PhysicalExamination.FileContent;
|
|
newPhysicalExamination.CompileMan = PhysicalExamination.CompileMan;
|
|
newPhysicalExamination.CompileDate = PhysicalExamination.CompileDate;
|
|
newPhysicalExamination.AttachUrl = PhysicalExamination.AttachUrl;
|
|
newPhysicalExamination.States = PhysicalExamination.States;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除体检管理
|
|
/// </summary>
|
|
/// <param name="FileId"></param>
|
|
public static void DeletePhysicalExaminationById(string FileId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.OccupationHealth_PhysicalExamination PhysicalExamination = db.OccupationHealth_PhysicalExamination.FirstOrDefault(e => e.FileId == FileId);
|
|
if (PhysicalExamination != null)
|
|
{
|
|
///删除编码表记录
|
|
BLL.CodeRecordsService.DeleteCodeRecordsByDataId(FileId);
|
|
////删除附件表
|
|
BLL.CommonService.DeleteAttachFileById(PhysicalExamination.FileId);
|
|
BLL.CommonService.DeleteFlowOperateByID(FileId);
|
|
db.OccupationHealth_PhysicalExamination.DeleteOnSubmit(PhysicalExamination);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|