84 lines
3.2 KiB
C#
84 lines
3.2 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
namespace BLL
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 仪表完成情况
|
|||
|
/// </summary>
|
|||
|
public class MeterCompletionService
|
|||
|
{
|
|||
|
public static Model.SGGLDB db = Funs.DB;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 根据主键获取仪表完成情况
|
|||
|
/// </summary>
|
|||
|
/// <param name="meterCompletionId"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static Model.JDGL_MeterCompletion GetMeterCompletionById(string meterCompletionId)
|
|||
|
{
|
|||
|
return Funs.DB.JDGL_MeterCompletion.FirstOrDefault(e => e.MeterCompletionId == meterCompletionId);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 添加仪表完成情况
|
|||
|
/// </summary>
|
|||
|
/// <param name="meterCompletion"></param>
|
|||
|
public static void AddMeterCompletion(Model.JDGL_MeterCompletion meterCompletion)
|
|||
|
{
|
|||
|
Model.SGGLDB db = Funs.DB;
|
|||
|
Model.JDGL_MeterCompletion newMeterCompletion = new Model.JDGL_MeterCompletion
|
|||
|
{
|
|||
|
MeterCompletionId = meterCompletion.MeterCompletionId,
|
|||
|
ProjectId = meterCompletion.ProjectId,
|
|||
|
UnitId = meterCompletion.UnitId,
|
|||
|
Name = meterCompletion.Name,
|
|||
|
Unit = meterCompletion.Unit,
|
|||
|
TotalNum = meterCompletion.TotalNum,
|
|||
|
ThisNum = meterCompletion.ThisNum,
|
|||
|
CompileMan = meterCompletion.CompileMan,
|
|||
|
CompileDate = meterCompletion.CompileDate,
|
|||
|
StartDate = meterCompletion.StartDate,
|
|||
|
EndDate = meterCompletion.EndDate
|
|||
|
};
|
|||
|
db.JDGL_MeterCompletion.InsertOnSubmit(newMeterCompletion);
|
|||
|
db.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 修改仪表完成情况
|
|||
|
/// </summary>
|
|||
|
/// <param name="meterCompletion"></param>
|
|||
|
public static void UpdateMeterCompletion(Model.JDGL_MeterCompletion meterCompletion)
|
|||
|
{
|
|||
|
Model.SGGLDB db = Funs.DB;
|
|||
|
Model.JDGL_MeterCompletion newMeterCompletion = db.JDGL_MeterCompletion.FirstOrDefault(e => e.MeterCompletionId == meterCompletion.MeterCompletionId);
|
|||
|
if (newMeterCompletion != null)
|
|||
|
{
|
|||
|
newMeterCompletion.TotalNum = meterCompletion.TotalNum;
|
|||
|
newMeterCompletion.ThisNum = meterCompletion.ThisNum;
|
|||
|
newMeterCompletion.CompileMan = meterCompletion.CompileMan;
|
|||
|
newMeterCompletion.CompileDate = meterCompletion.CompileDate;
|
|||
|
db.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 根据主键删除仪表完成情况
|
|||
|
/// </summary>
|
|||
|
/// <param name="meterCompletionId"></param>
|
|||
|
public static void DeleteMeterCompletionById(string meterCompletionId)
|
|||
|
{
|
|||
|
Model.SGGLDB db = Funs.DB;
|
|||
|
var meterCompletion = (from x in db.JDGL_MeterCompletion where x.MeterCompletionId == meterCompletionId select x).FirstOrDefault();
|
|||
|
if (meterCompletion != null)
|
|||
|
{
|
|||
|
db.JDGL_MeterCompletion.DeleteOnSubmit(meterCompletion);
|
|||
|
db.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|