Basf_TCC7/HJGL/BLL/WeldingProcess/WeldingManage/DailyReportCompleteService.cs

95 lines
3.5 KiB
C#

using Model;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public partial class DailyReportCompleteService
{
/// <summary>
/// 获取日报完成信息
/// </summary>
/// <param name="completeId">Id</param>
/// <returns></returns>
public static Model.Pipeline_DailyReportComplete GetDailyReportComplete(string completeId)
{
return Funs.DB.Pipeline_DailyReportComplete.FirstOrDefault(x => x.DailyReportCompleteId == completeId);
}
/// <summary>
/// 增加日报完成信息
/// </summary>
/// <param name="complete"></param>
public static void AddDailyReportComplete(Model.Pipeline_DailyReportComplete complete)
{
Model.HJGLDB db = Funs.DB;
Model.Pipeline_DailyReportComplete newR = new Model.Pipeline_DailyReportComplete();
newR.DailyReportCompleteId = complete.DailyReportCompleteId;
newR.ProjectId =complete.ProjectId;
newR.UnitId = complete.UnitId;
newR.ReportMan = complete.ReportMan;
newR.TeamGroupId =complete.TeamGroupId;
newR.DailyReportDate = complete.DailyReportDate;
newR.IsComplete = complete.IsComplete;
db.Pipeline_DailyReportComplete.InsertOnSubmit(newR);
db.SubmitChanges();
}
/// <summary>
/// 修改日报完成信息
/// </summary>
/// <param name="complete"></param>
public static void UpdateDailyReportComplete(Model.Pipeline_DailyReportComplete complete)
{
Model.HJGLDB db = Funs.DB;
Model.Pipeline_DailyReportComplete newR = db.Pipeline_DailyReportComplete.First(e => e.DailyReportCompleteId == complete.DailyReportCompleteId);
newR.ProjectId = complete.ProjectId;
newR.UnitId = complete.UnitId;
newR.ReportMan = complete.ReportMan;
newR.TeamGroupId = complete.TeamGroupId;
newR.DailyReportDate = complete.DailyReportDate;
newR.IsComplete = complete.IsComplete;
db.SubmitChanges();
}
/// <summary>
/// 删除日报完成信息
/// </summary>
/// <param name="completeId"></param>
public static void DeleteDailyReportComplete(string completeId)
{
Model.HJGLDB db = Funs.DB;
Model.Pipeline_DailyReportComplete delR = db.Pipeline_DailyReportComplete.First(e => e.DailyReportCompleteId == completeId);
db.Pipeline_DailyReportComplete.DeleteOnSubmit(delR);
db.SubmitChanges();
}
/// <summary>
/// 是否存在日报完成信息
/// </summary>
/// <param name="projectId"></param>
/// <param name="completeId"></param>
/// <param name="teamGroup"></param>
/// <param name="reportDate"></param>
/// <returns>是否存在</returns>
public static bool IsExistDailyReportComplete(string projectId , string completeId, string teamGroup, DateTime reportDate)
{
bool isExist = false;
var role = Funs.DB.Pipeline_DailyReportComplete.FirstOrDefault(x => x.ProjectId == projectId && x.TeamGroupId==teamGroup && x.DailyReportDate== reportDate && x.DailyReportCompleteId != completeId);
if (role != null)
{
isExist = true;
}
return isExist;
}
}
}