/// <summary> /// 根据项目Id删除一个项目信息 /// </summary> /// <param name="projectId"></param> public static void DeleteProject(string projectId) { Model.SUBHSSEDB db = Funs.DB; Model.Base_Project project = db.Base_Project.FirstOrDefault(e => e.ProjectId == projectId); if (project != null) { ////删除编码/模板规则表 BLL.ProjectData_CodeTemplateRuleService.DeleteProjectData_CodeTemplateRule(project.ProjectId); ////删除项目安全管理资料计划总表 BLL.SafetyDataPlanService.DeleteSafetyDataPlanByProjectId(project.ProjectId); ////删除E项目安全管理资料计划总表 BLL.SafetyDataEPlanService.DeleteSafetyDataEPlanByProjectId(project.ProjectId); ////删除E项目安全管理 BLL.SafetyDataEItemService.DeleteSafetyDataEItemByProjectId(project.ProjectId); BLL.SafetySystemService.DeleteSafetySystemByProjectid(project.ProjectId); db.Base_Project.DeleteOnSubmit(project); db.SubmitChanges(); } }
/// <summary> /// 增加项目信息 /// </summary> /// <returns></returns> public static void AddProject(Model.Base_Project project) { Model.SUBHSSEDB db = Funs.DB; Model.Base_Project newProject = new Base_Project { ProjectId = project.ProjectId, ProjectCode = project.ProjectCode, ProjectName = project.ProjectName, StartDate = project.StartDate, EndDate = project.EndDate, ProjectAddress = project.ProjectAddress, ContractNo = project.ContractNo, WorkRange = project.WorkRange, Duration = project.Duration, ShortName = project.ShortName, ProjectType = project.ProjectType, PostCode = project.PostCode, Remark = project.Remark, ProjectState = project.ProjectState, IsUpTotalMonth = project.IsUpTotalMonth, UnitId = project.UnitId, ProjectMainPerson = project.ProjectMainPerson, ProjectLiaisonPerson = project.ProjectLiaisonPerson, IsForeign = project.IsForeign, FromProjectId = project.FromProjectId, MapCoordinates = project.MapCoordinates, }; db.Base_Project.InsertOnSubmit(newProject); db.SubmitChanges(); ////插入编码/模板规则表 BLL.ProjectData_CodeTemplateRuleService.InertProjectData_CodeTemplateRuleByProjectId(project.ProjectId); if (newProject.ProjectType != "5") { ////根据项目信息生成企业安全管理资料计划总表 BLL.SafetyDataPlanService.GetSafetyDataPlanByProjectInfo(newProject.ProjectId, string.Empty, null, null); } }
/// <summary> ///修改项目信息 /// </summary> /// <param name="project"></param> public static void UpdateProject(Model.Base_Project project) { SUBHSSEDB db = Funs.DB; Base_Project newProject = db.Base_Project.FirstOrDefault(e => e.ProjectId == project.ProjectId); if (newProject != null) { newProject.ProjectCode = project.ProjectCode; newProject.ProjectName = project.ProjectName; newProject.StartDate = project.StartDate; newProject.EndDate = project.EndDate; newProject.ProjectAddress = project.ProjectAddress; newProject.ShortName = project.ShortName; newProject.ContractNo = project.ContractNo; newProject.WorkRange = project.WorkRange; newProject.Duration = project.Duration; newProject.ProjectType = project.ProjectType; newProject.PostCode = project.PostCode; newProject.Remark = project.Remark; newProject.ProjectState = project.ProjectState; newProject.IsUpTotalMonth = project.IsUpTotalMonth; newProject.UnitId = project.UnitId; newProject.ProjectMainPerson = project.ProjectMainPerson; newProject.ProjectLiaisonPerson = project.ProjectLiaisonPerson; newProject.IsForeign = project.IsForeign; newProject.FromProjectId = project.FromProjectId; newProject.MapCoordinates = project.MapCoordinates; db.SubmitChanges(); if (newProject.ProjectType != "5") { ////根据项目信息生成企业安全管理资料计划总表 BLL.SafetyDataPlanService.GetSafetyDataPlanByProjectInfo(newProject.ProjectId, string.Empty, null, null); } } }
partial void DeleteBase_Project(Base_Project instance);
partial void UpdateBase_Project(Base_Project instance);
partial void InsertBase_Project(Base_Project instance);