79 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			79 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace BLL
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    /// <summary>
							 | 
						|||
| 
								 | 
							
								    /// 安全措施费使用计划
							 | 
						|||
| 
								 | 
							
								    /// </summary>
							 | 
						|||
| 
								 | 
							
								    public static class MeasuresPlanService
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 根据主键获取安全措施费使用计划
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="measuresPlanId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static Model.CostGoods_MeasuresPlan GetMeasuresPlanById(string measuresPlanId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return Funs.DB.CostGoods_MeasuresPlan.FirstOrDefault(e => e.MeasuresPlanId == measuresPlanId);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 添加安全措施费使用计划
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="measuresPlan"></param>
							 | 
						|||
| 
								 | 
							
								        public static void AddMeasuresPlan(Model.CostGoods_MeasuresPlan measuresPlan)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Model.CostGoods_MeasuresPlan newMeasuresPlan = new Model.CostGoods_MeasuresPlan
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                MeasuresPlanId = measuresPlan.MeasuresPlanId,
							 | 
						|||
| 
								 | 
							
								                ProjectId = measuresPlan.ProjectId,
							 | 
						|||
| 
								 | 
							
								                MeasuresPlanCode = measuresPlan.MeasuresPlanCode,
							 | 
						|||
| 
								 | 
							
								                UnitId = measuresPlan.UnitId,
							 | 
						|||
| 
								 | 
							
								                FileContents = measuresPlan.FileContents,
							 | 
						|||
| 
								 | 
							
								                CompileMan = measuresPlan.CompileMan,
							 | 
						|||
| 
								 | 
							
								                CompileDate = measuresPlan.CompileDate
							 | 
						|||
| 
								 | 
							
								            };
							 | 
						|||
| 
								 | 
							
								            Funs.DB.CostGoods_MeasuresPlan.InsertOnSubmit(newMeasuresPlan);
							 | 
						|||
| 
								 | 
							
								            Funs.DB.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								            CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectMeasuresPlanMenuId, measuresPlan.ProjectId, measuresPlan.UnitId, measuresPlan.MeasuresPlanId, measuresPlan.CompileDate);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 修改安全措施费使用计划
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="measuresPlan"></param>
							 | 
						|||
| 
								 | 
							
								        public static void UpdateMeasuresPlan(Model.CostGoods_MeasuresPlan measuresPlan)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Model.CostGoods_MeasuresPlan newMeasuresPlan = Funs.DB.CostGoods_MeasuresPlan.FirstOrDefault(e => e.MeasuresPlanId == measuresPlan.MeasuresPlanId);
							 | 
						|||
| 
								 | 
							
								            if (newMeasuresPlan != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newMeasuresPlan.ProjectId = measuresPlan.ProjectId;
							 | 
						|||
| 
								 | 
							
								                newMeasuresPlan.MeasuresPlanCode = measuresPlan.MeasuresPlanCode;
							 | 
						|||
| 
								 | 
							
								                newMeasuresPlan.UnitId = measuresPlan.UnitId;
							 | 
						|||
| 
								 | 
							
								                newMeasuresPlan.FileContents = measuresPlan.FileContents;
							 | 
						|||
| 
								 | 
							
								                newMeasuresPlan.CompileMan = measuresPlan.CompileMan;
							 | 
						|||
| 
								 | 
							
								                newMeasuresPlan.CompileDate = measuresPlan.CompileDate;
							 | 
						|||
| 
								 | 
							
								                Funs.DB.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 根据主键删除安全措施费使用计划
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="measuresPlanId"></param>
							 | 
						|||
| 
								 | 
							
								        public static void DeleteMeasuresPlanById(string measuresPlanId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Model.CostGoods_MeasuresPlan measuresPlan = Funs.DB.CostGoods_MeasuresPlan.FirstOrDefault(e => e.MeasuresPlanId == measuresPlanId);
							 | 
						|||
| 
								 | 
							
								            if (measuresPlan != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                CodeRecordsService.DeleteCodeRecordsByDataId(measuresPlanId);
							 | 
						|||
| 
								 | 
							
								                CommonService.DeleteAttachFileById(measuresPlanId);
							 | 
						|||
| 
								 | 
							
								                ////删除审核流程表
							 | 
						|||
| 
								 | 
							
								                BLL.CommonService.DeleteFlowOperateByID(measuresPlanId);
							 | 
						|||
| 
								 | 
							
								                Funs.DB.CostGoods_MeasuresPlan.DeleteOnSubmit(measuresPlan);
							 | 
						|||
| 
								 | 
							
								                Funs.DB.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |