using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.UI.WebControls; namespace BLL { /// /// 项目级施工日志 /// public static class ConstructionLogService { public static Model.SGGLDB db = Funs.DB; /// /// 根据主键获取项目级施工日志 /// /// /// public static Model.ZHGL_ConstructionLog GetConstructionLogById(string ConstructionLogId) { return Funs.DB.ZHGL_ConstructionLog.FirstOrDefault(e => e.ConstructionLogId == ConstructionLogId); } /// /// 根据项目、用户及日期获取项目级施工日志 /// /// /// 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); } /// /// 添加项目级施工日志 /// /// 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, TemperatureMax = ConstructionLog.TemperatureMax, TemperatureMin = ConstructionLog.TemperatureMin, MainWork = ConstructionLog.MainWork, MainProblems = ConstructionLog.MainProblems, Remark = ConstructionLog.Remark, CompileMan = ConstructionLog.CompileMan, CompileDate = ConstructionLog.CompileDate, }; db.ZHGL_ConstructionLog.InsertOnSubmit(newConstructionLog); db.SubmitChanges(); } /// /// 修改项目级施工日志 /// /// 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.Weather = ConstructionLog.Weather; newConstructionLog.TemperatureMax = ConstructionLog.TemperatureMax; newConstructionLog.TemperatureMin = ConstructionLog.TemperatureMin; newConstructionLog.MainWork = ConstructionLog.MainWork; newConstructionLog.MainProblems = ConstructionLog.MainProblems; newConstructionLog.Remark = ConstructionLog.Remark; db.SubmitChanges(); } } /// /// 根据主键删除项目级施工日志 /// /// 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(); } } /// /// 获取天气状况 /// /// 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; } } }