SGGL_SHJ/SGGL/BLL/PZHGL/InformationProject/ConstructionLogService.cs

135 lines
6.3 KiB
C#

using System;
using System.Linq;
using System.Web.UI.WebControls;
namespace BLL
{
/// <summary>
/// 项目级施工日志
/// </summary>
public static class ConstructionLogService
{
/// <summary>
/// 根据主键获取项目级施工日志
/// </summary>
/// <param name="ConstructionLogId"></param>
/// <returns></returns>
public static Model.ZHGL_ConstructionLog GetConstructionLogById(string ConstructionLogId)
{
return Funs.DB.ZHGL_ConstructionLog.FirstOrDefault(e => e.ConstructionLogId == ConstructionLogId);
}
/// <summary>
/// 根据项目、用户及日期获取项目级施工日志
/// </summary>
/// <param name="ConstructionLogId"></param>
/// <returns></returns>
public static Model.ZHGL_ConstructionLog GetConstructionLogByProjectIdAndUserIDAndDate(string constructionLogId, string projectId, string userId, DateTime date)
{
return Funs.DB.ZHGL_ConstructionLog.FirstOrDefault(e => e.ConstructionLogId != constructionLogId && e.ProjectId == projectId && e.CompileMan == userId);
//return Funs.DB.ZHGL_ConstructionLog.FirstOrDefault(e => e.ConstructionLogId != constructionLogId && e.ProjectId == projectId && e.CompileMan == userId && e.CompileDate == date);
}
/// <summary>
/// 添加项目级施工日志
/// </summary>
/// <param name="ConstructionLog"></param>
public static void AddConstructionLog(Model.ZHGL_ConstructionLog ConstructionLog)
{
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ConstructionLog newConstructionLog = new Model.ZHGL_ConstructionLog
{
ConstructionLogId = ConstructionLog.ConstructionLogId,
ProjectId = ConstructionLog.ProjectId,
Weather = ConstructionLog.Weather,
Temperature = ConstructionLog.Temperature,
ContractNo = ConstructionLog.ContractNo,
UnitWorks = ConstructionLog.UnitWorks,
Professional = ConstructionLog.Professional,
CompileMan = ConstructionLog.CompileMan,
CompileDate = ConstructionLog.CompileDate,
State = ConstructionLog.State,
Remark = ConstructionLog.Remark,
HSETodaySummary = ConstructionLog.HSETodaySummary,
HSETodaySummaryRemark = ConstructionLog.HSETodaySummaryRemark,
HSETomorrowPlan = ConstructionLog.HSETomorrowPlan,
HSETomorrowPlanRemark = ConstructionLog.HSETomorrowPlanRemark,
CQMSTodaySummary = ConstructionLog.CQMSTodaySummary,
CQMSTodaySummaryRemark = ConstructionLog.CQMSTodaySummaryRemark,
CQMSTomorrowPlan = ConstructionLog.CQMSTomorrowPlan,
CQMSTomorrowPlanRemark = ConstructionLog.CQMSTomorrowPlanRemark,
FileCode = ConstructionLog.FileCode,
WorkPostId = ConstructionLog.WorkPostId,
MachineId = ConstructionLog.MachineId,
};
db.ZHGL_ConstructionLog.InsertOnSubmit(newConstructionLog);
db.SubmitChanges();
}
/// <summary>
/// 修改项目级施工日志
/// </summary>
/// <param name="ConstructionLog"></param>
public static void UpdateConstructionLog(Model.ZHGL_ConstructionLog ConstructionLog)
{
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ConstructionLog newConstructionLog = db.ZHGL_ConstructionLog.FirstOrDefault(e => e.ConstructionLogId == ConstructionLog.ConstructionLogId);
if (newConstructionLog != null)
{
newConstructionLog.FileCode = ConstructionLog.FileCode;
newConstructionLog.Weather = ConstructionLog.Weather;
newConstructionLog.Temperature = ConstructionLog.Temperature;
newConstructionLog.ContractNo = ConstructionLog.ContractNo;
newConstructionLog.UnitWorks = ConstructionLog.UnitWorks;
newConstructionLog.Professional = ConstructionLog.Professional;
newConstructionLog.State = ConstructionLog.State;
newConstructionLog.Remark = ConstructionLog.Remark;
newConstructionLog.HSETodaySummary = ConstructionLog.HSETodaySummary;
newConstructionLog.HSETodaySummaryRemark = ConstructionLog.HSETodaySummaryRemark;
newConstructionLog.HSETomorrowPlan = ConstructionLog.HSETomorrowPlan;
newConstructionLog.HSETomorrowPlanRemark = ConstructionLog.HSETomorrowPlanRemark;
newConstructionLog.CQMSTodaySummary = ConstructionLog.CQMSTodaySummary;
newConstructionLog.CQMSTodaySummaryRemark = ConstructionLog.CQMSTodaySummaryRemark;
newConstructionLog.CQMSTomorrowPlan = ConstructionLog.CQMSTomorrowPlan;
newConstructionLog.CQMSTomorrowPlanRemark = ConstructionLog.CQMSTomorrowPlanRemark;
newConstructionLog.WorkPostId = ConstructionLog.WorkPostId;
newConstructionLog.MachineId = ConstructionLog.MachineId;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除项目级施工日志
/// </summary>
/// <param name="ConstructionLogId"></param>
public static void DeleteConstructionLogById(string ConstructionLogId)
{
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ConstructionLog ConstructionLog = db.ZHGL_ConstructionLog.FirstOrDefault(e => e.ConstructionLogId == ConstructionLogId);
if (ConstructionLog != null)
{
////删除附件表
BLL.CommonService.DeleteAttachFileById(ConstructionLog.ConstructionLogId);
db.ZHGL_ConstructionLog.DeleteOnSubmit(ConstructionLog);
db.SubmitChanges();
}
}
/// <summary>
/// 获取天气状况
/// </summary>
/// <returns></returns>
public static ListItem[] GetWeatherList()
{
ListItem[] lis = new ListItem[4];
lis[0] = new ListItem("阴", "阴");
lis[1] = new ListItem("晴", "晴");
lis[2] = new ListItem("雨", "雨");
lis[3] = new ListItem("雪", "雪");
return lis;
}
}
}