96 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			96 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Threading.Tasks;
 | |
| 
 | |
| namespace BLL
 | |
| {
 | |
|     /// <summary>
 | |
|     /// 巡检记录表
 | |
|     /// </summary>
 | |
|     public static class Hazard_RoutingInspectionService
 | |
|     {
 | |
|         /// <summary>
 | |
|         /// 根据巡检记录ID获取巡检记录信息
 | |
|         /// </summary>
 | |
|         /// <param name="RoutingInspectionName"></param>
 | |
|         /// <returns></returns>
 | |
|         public static Model.Hazard_RoutingInspection GetRoutingInspectionByRoutingInspectionId(string RoutingInspectionId)
 | |
|         {
 | |
|             return Funs.DB.Hazard_RoutingInspection.FirstOrDefault(e => e.RoutingInspectionId == RoutingInspectionId);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据巡检计划ID获取巡检记录信息
 | |
|         /// </summary>
 | |
|         /// <param name="RoutingInspectionName"></param>
 | |
|         /// <returns></returns>
 | |
|         public static Model.Hazard_RoutingInspection GetRoutingInspectionByPatrolPlanId(string PatrolPlanId)
 | |
|         {
 | |
|             return Funs.DB.Hazard_RoutingInspection.FirstOrDefault(e => e.PatrolPlanId == PatrolPlanId);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 添加安全巡检记录
 | |
|         /// </summary>
 | |
|         /// <param name="RoutingInspection"></param>
 | |
|         public static void AddRoutingInspection(Model.Hazard_RoutingInspection RoutingInspection)
 | |
|         {
 | |
|             Model.Hazard_RoutingInspection newRoutingInspection = new Model.Hazard_RoutingInspection
 | |
|             {
 | |
|                 RoutingInspectionId = RoutingInspection.RoutingInspectionId,
 | |
|                 HazardSelectedItemId = RoutingInspection.HazardSelectedItemId,
 | |
|                 PatrolManId = RoutingInspection.PatrolManId,
 | |
|                 PatrolTime = RoutingInspection.PatrolTime,
 | |
|                 PatrolResult = RoutingInspection.PatrolResult,
 | |
|                 OldRiskLevel = RoutingInspection.OldRiskLevel,
 | |
|                 PohotoUrl = RoutingInspection.PohotoUrl,
 | |
|                 ControlMeasures = RoutingInspection.ControlMeasures,
 | |
|                 DealReason = RoutingInspection.DealReason,
 | |
|                 RiskManId = RoutingInspection.RiskManId,
 | |
|                 PatrolPlanId = RoutingInspection.PatrolPlanId
 | |
|             };
 | |
| 
 | |
|             Funs.DB.Hazard_RoutingInspection.InsertOnSubmit(newRoutingInspection);
 | |
|             Funs.DB.SubmitChanges();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 修改安全巡检记录
 | |
|         /// </summary>
 | |
|         /// <param name="RoutingInspection"></param>
 | |
|         public static void UpdateRoutingInspection(Model.Hazard_RoutingInspection RoutingInspection)
 | |
|         {
 | |
|             Model.Hazard_RoutingInspection newRoutingInspection = Funs.DB.Hazard_RoutingInspection.FirstOrDefault(e => e.RoutingInspectionId == RoutingInspection.RoutingInspectionId);
 | |
|             if (newRoutingInspection != null)
 | |
|             {
 | |
|                 newRoutingInspection.PatrolManId = RoutingInspection.PatrolManId;
 | |
|                 newRoutingInspection.PatrolTime = RoutingInspection.PatrolTime;
 | |
|                 newRoutingInspection.PatrolResult = RoutingInspection.PatrolResult;
 | |
|                 newRoutingInspection.OldRiskLevel = RoutingInspection.OldRiskLevel;
 | |
|                 newRoutingInspection.PohotoUrl = RoutingInspection.PohotoUrl;
 | |
|                 newRoutingInspection.ControlMeasures = RoutingInspection.ControlMeasures;
 | |
|                 newRoutingInspection.DealReason = RoutingInspection.DealReason;
 | |
|                 Funs.DB.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据巡检记录ID删除对应巡检记录记录信息
 | |
|         /// </summary>
 | |
|         /// <param name="superviseCheckReportId"></param>
 | |
|         public static void DeleteRoutingInspection(string RoutingInspectionId)
 | |
|         {
 | |
|             var q = (from x in Funs.DB.Hazard_RoutingInspection where x.RoutingInspectionId == RoutingInspectionId select x).FirstOrDefault();
 | |
|             if (q != null)
 | |
|             {
 | |
|                 ///删除附件
 | |
|                 BLL.CommonService.DeleteAttachFileById(RoutingInspectionId);
 | |
|                 Funs.DB.Hazard_RoutingInspection.DeleteOnSubmit(q);
 | |
|                 Funs.DB.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 |