CNCEC_SUBQHSE_WUHUAN/SGGL/BLL/JDGL/Check/UndergroundPipeCompletionSe...

82 lines
3.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
/// <summary>
/// 全厂地下管网完成情况
/// </summary>
public class UndergroundPipeCompletionService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 根据主键获取全厂地下管网完成情况
/// </summary>
/// <param name="pipelineCompletionId"></param>
/// <returns></returns>
public static Model.JDGL_UndergroundPipeCompletion GetUndergroundPipeCompletionById(string pipelineCompletionId)
{
return Funs.DB.JDGL_UndergroundPipeCompletion.FirstOrDefault(e => e.UndergroundPipeCompletionId == pipelineCompletionId);
}
/// <summary>
/// 添加全厂地下管网完成情况
/// </summary>
/// <param name="pipelineCompletion"></param>
public static void AddUndergroundPipeCompletion(Model.JDGL_UndergroundPipeCompletion pipelineCompletion)
{
Model.SGGLDB db = Funs.DB;
Model.JDGL_UndergroundPipeCompletion newUndergroundPipeCompletion = new Model.JDGL_UndergroundPipeCompletion
{
UndergroundPipeCompletionId = pipelineCompletion.UndergroundPipeCompletionId,
ProjectId = pipelineCompletion.ProjectId,
UnitId = pipelineCompletion.UnitId,
TotalNum = pipelineCompletion.TotalNum,
ThisNum = pipelineCompletion.ThisNum,
CompileMan = pipelineCompletion.CompileMan,
CompileDate = pipelineCompletion.CompileDate,
StartDate = pipelineCompletion.StartDate,
EndDate = pipelineCompletion.EndDate
};
db.JDGL_UndergroundPipeCompletion.InsertOnSubmit(newUndergroundPipeCompletion);
db.SubmitChanges();
}
/// <summary>
/// 修改全厂地下管网完成情况
/// </summary>
/// <param name="pipelineCompletion"></param>
public static void UpdateUndergroundPipeCompletion(Model.JDGL_UndergroundPipeCompletion pipelineCompletion)
{
Model.SGGLDB db = Funs.DB;
Model.JDGL_UndergroundPipeCompletion newUndergroundPipeCompletion = db.JDGL_UndergroundPipeCompletion.FirstOrDefault(e => e.UndergroundPipeCompletionId == pipelineCompletion.UndergroundPipeCompletionId);
if (newUndergroundPipeCompletion != null)
{
newUndergroundPipeCompletion.TotalNum = pipelineCompletion.TotalNum;
newUndergroundPipeCompletion.ThisNum = pipelineCompletion.ThisNum;
newUndergroundPipeCompletion.CompileMan = pipelineCompletion.CompileMan;
newUndergroundPipeCompletion.CompileDate = pipelineCompletion.CompileDate;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除全厂地下管网完成情况
/// </summary>
/// <param name="pipelineCompletionId"></param>
public static void DeleteUndergroundPipeCompletionById(string pipelineCompletionId)
{
Model.SGGLDB db = Funs.DB;
var pipelineCompletion = (from x in db.JDGL_UndergroundPipeCompletion where x.UndergroundPipeCompletionId == pipelineCompletionId select x).FirstOrDefault();
if (pipelineCompletion != null)
{
db.JDGL_UndergroundPipeCompletion.DeleteOnSubmit(pipelineCompletion);
db.SubmitChanges();
}
}
}
}