using Model;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public partial class DailyReportCompleteService
{
///
/// 获取日报完成信息
///
/// Id
///
public static Model.Pipeline_DailyReportComplete GetDailyReportComplete(string completeId)
{
return Funs.DB.Pipeline_DailyReportComplete.FirstOrDefault(x => x.DailyReportCompleteId == completeId);
}
///
/// 增加日报完成信息
///
///
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();
}
///
/// 修改日报完成信息
///
///
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();
}
///
/// 删除日报完成信息
///
///
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();
}
///
/// 是否存在日报完成信息
///
///
///
///
///
/// 是否存在
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;
}
}
}