SGGL_SHJ/SGGL/BLL/PZHGL/InformationProject/ConstructionLogMachineServi...

67 lines
2.8 KiB
C#

using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public class ConstructionLogMachineService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 获取施工日志机械明细列表
/// </summary>
/// <param name="satartRowIndex"></param>
/// <param name="maximumRows"></param>
/// <returns></returns>
public static List<Model.ZHGL_ConstructionLogMachine> getListData(string ConstructionLogId)
{
return (from x in db.ZHGL_ConstructionLogMachine
where x.ConstructionLogId == ConstructionLogId
select x).ToList();
}
/// <summary>
/// 增加施工日志机械明细
/// </summary>
/// <param name="managerRuleApprove">施工日志机械明细实体</param>
public static void AddConstructionLogMachine(Model.ZHGL_ConstructionLogMachine constructionLogMachine)
{
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ConstructionLogMachine newConstructionLogMachine = new Model.ZHGL_ConstructionLogMachine();
newConstructionLogMachine.ConstructionLogMachineId = constructionLogMachine.ConstructionLogMachineId;
newConstructionLogMachine.ConstructionLogId = constructionLogMachine.ConstructionLogId;
newConstructionLogMachine.UnitWorkId = constructionLogMachine.UnitWorkId;
newConstructionLogMachine.MachineId = constructionLogMachine.MachineId;
newConstructionLogMachine.Num = constructionLogMachine.Num;
db.ZHGL_ConstructionLogMachine.InsertOnSubmit(newConstructionLogMachine);
db.SubmitChanges();
}
/// <summary>
/// 根据月报id删除对应的所有施工日志机械明细
/// </summary>
/// <param name="ConstructionLogId">施工日志机械明细编号</param>
public static void DeleteConstructionLogMachinesByConstructionLogId(string ConstructionLogId)
{
Model.SGGLDB db = Funs.DB;
var q = (from x in db.ZHGL_ConstructionLogMachine where x.ConstructionLogId == ConstructionLogId select x).ToList();
if (q.Count() > 0)
{
db.ZHGL_ConstructionLogMachine.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
/// <summary>
/// 根据月报id获取对应的所有施工日志机械明细
/// </summary>
/// <param name="ConstructionLogId">施工日志机械明细编号</param>
public static List<Model.ZHGL_ConstructionLogMachine> GetConstructionLogMachinesByConstructionLogId(string ConstructionLogId)
{
Model.SGGLDB db = Funs.DB;
return (from x in db.ZHGL_ConstructionLogMachine where x.ConstructionLogId == ConstructionLogId select x).ToList();
}
}
}