| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  | using FineUIPro; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Text; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace BLL | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     public static class HazardRealtimedeviceService | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         public static Model.SGGLDB db = Funs.DB; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 获取列表 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 记录数 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public static int count | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get; | 
					
						
							|  |  |  |  |             set; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         public static List<Model.Hazard_RealTimeDevice> GetHazard_RealTimeDeviceByModle(Model.Hazard_RealTimeDevice table) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var q = from x in db.Hazard_RealTimeDevice | 
					
						
							|  |  |  |  |                     where | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.ID) || x.ID.Contains(table.ID)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.UnitName) || x.UnitName.Contains(table.UnitName)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.HazardName) || x.HazardName.Contains(table.HazardName)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.HazardLevel) || x.HazardLevel.Contains(table.HazardLevel)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.DeviceCode) || x.DeviceCode.Contains(table.DeviceCode)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.DeviceName) || x.DeviceName.Contains(table.DeviceName)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.DeviceType) || x.DeviceType.Contains(table.DeviceType)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.SphereType) || x.SphereType.Contains(table.SphereType)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.TemperatureType) || x.TemperatureType.Contains(table.TemperatureType)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.DesignTemperantureMax) || x.DesignTemperantureMax.Contains(table.DesignTemperantureMax)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.DesignTemperantureMin) || x.DesignTemperantureMin.Contains(table.DesignTemperantureMin)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.PressureType) || x.PressureType.Contains(table.PressureType)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.DesignPressure) || x.DesignPressure.Contains(table.DesignPressure)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.DesignPressureMax) || x.DesignPressureMax.Contains(table.DesignPressureMax)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.Medium) || x.Medium.Contains(table.Medium)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.MediumForm) || x.MediumForm.Contains(table.MediumForm)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.MediumLevelMax) || x.MediumLevelMax.Contains(table.MediumLevelMax)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.Reserves) || x.Reserves.Contains(table.Reserves)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.StandardCode) || x.StandardCode.Contains(table.StandardCode)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.StandardName) || x.StandardName.Contains(table.StandardName)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.StandardType) || x.StandardType.Contains(table.StandardType)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.StandardDes) || x.StandardDes.Contains(table.StandardDes)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.MeasurementUnit) || x.MeasurementUnit.Contains(table.MeasurementUnit)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.MeterMax) || x.MeterMax.Contains(table.MeterMax)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.MeterMin) || x.MeterMin.Contains(table.MeterMin)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.ThresholdLow1) || x.ThresholdLow1.Contains(table.ThresholdLow1)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.ThresholdLow2) || x.ThresholdLow2.Contains(table.ThresholdLow2)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.ThresholdMax1) || x.ThresholdMax1.Contains(table.ThresholdMax1)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.ThresholdMax2) || x.ThresholdMax2.Contains(table.ThresholdMax2)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.BitNum) || x.BitNum.Contains(table.BitNum)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.Value) || x.Value.Contains(table.Value)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) && | 
					
						
							|  |  |  |  |                               (string.IsNullOrEmpty(table.ReceiveDate) || x.ReceiveDate.Contains(table.ReceiveDate))  | 
					
						
							|  |  |  |  |                     select x | 
					
						
							|  |  |  |  |                   ; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return q.ToList(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// 获取分页列表 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="PageIndex">页码</param> | 
					
						
							|  |  |  |  |         /// <param name="PageSize">每页数量</param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static IEnumerable getListData(Model.Hazard_RealTimeDevice table, Grid Grid1) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var q = GetHazard_RealTimeDeviceByModle(table); | 
					
						
							|  |  |  |  |             count = q.Count(); | 
					
						
							|  |  |  |  |             if (count == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return null; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             //  q=  q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList(); | 
					
						
							|  |  |  |  |             // q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize); | 
					
						
							|  |  |  |  |             return from x in q | 
					
						
							|  |  |  |  |                    select new | 
					
						
							|  |  |  |  |                    { | 
					
						
							|  |  |  |  |                        x.ID, | 
					
						
							|  |  |  |  |                        x.UnitId, | 
					
						
							|  |  |  |  |                        x.UnitName, | 
					
						
							|  |  |  |  |                        x.HazardName, | 
					
						
							|  |  |  |  |                        x.HazardLevel, | 
					
						
							|  |  |  |  |                        x.DeviceCode, | 
					
						
							|  |  |  |  |                        x.DeviceName, | 
					
						
							|  |  |  |  |                        x.DeviceType, | 
					
						
							|  |  |  |  |                        x.SphereType, | 
					
						
							|  |  |  |  |                        x.TemperatureType, | 
					
						
							|  |  |  |  |                        x.DesignTemperantureMax, | 
					
						
							|  |  |  |  |                        x.DesignTemperantureMin, | 
					
						
							|  |  |  |  |                        x.PressureType, | 
					
						
							|  |  |  |  |                        x.DesignPressure, | 
					
						
							|  |  |  |  |                        x.DesignPressureMax, | 
					
						
							|  |  |  |  |                        x.Medium, | 
					
						
							|  |  |  |  |                        x.MediumForm, | 
					
						
							|  |  |  |  |                        x.MediumLevelMax, | 
					
						
							|  |  |  |  |                        x.Reserves, | 
					
						
							|  |  |  |  |                        x.StandardCode, | 
					
						
							|  |  |  |  |                        x.StandardName, | 
					
						
							|  |  |  |  |                        x.StandardType, | 
					
						
							|  |  |  |  |                        x.StandardDes, | 
					
						
							|  |  |  |  |                        x.MeasurementUnit, | 
					
						
							|  |  |  |  |                        x.MeterMax, | 
					
						
							|  |  |  |  |                        x.MeterMin, | 
					
						
							|  |  |  |  |                        x.ThresholdLow1, | 
					
						
							|  |  |  |  |                        x.ThresholdLow2, | 
					
						
							|  |  |  |  |                        x.ThresholdMax1, | 
					
						
							|  |  |  |  |                        x.ThresholdMax2, | 
					
						
							|  |  |  |  |                        x.BitNum, | 
					
						
							|  |  |  |  |                        x.DateTime, | 
					
						
							|  |  |  |  |                        x.ProjectId, | 
					
						
							|  |  |  |  |                        x.Value, | 
					
						
							|  |  |  |  |                        x.FactoryId, | 
					
						
							|  |  |  |  |                        x.ReportDate, | 
					
						
							|  |  |  |  |                        x.ReceiveDate, | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                    }; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static Model.Hazard_RealTimeDevice GetHazard_RealTimeDeviceById(string ID) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == ID); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void AddHazard_RealTimeDevice(Model.Hazard_RealTimeDevice newtable) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) | 
					
						
							| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |                 Model.Hazard_RealTimeDevice table = new Model.Hazard_RealTimeDevice | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     ID = newtable.ID, | 
					
						
							|  |  |  |  |                     UnitId = newtable.UnitId, | 
					
						
							|  |  |  |  |                     UnitName = newtable.UnitName, | 
					
						
							|  |  |  |  |                     HazardName = newtable.HazardName, | 
					
						
							|  |  |  |  |                     HazardLevel = newtable.HazardLevel, | 
					
						
							|  |  |  |  |                     DeviceCode = newtable.DeviceCode, | 
					
						
							|  |  |  |  |                     DeviceName = newtable.DeviceName, | 
					
						
							|  |  |  |  |                     DeviceType = newtable.DeviceType, | 
					
						
							|  |  |  |  |                     SphereType = newtable.SphereType, | 
					
						
							|  |  |  |  |                     TemperatureType = newtable.TemperatureType, | 
					
						
							|  |  |  |  |                     DesignTemperantureMax = newtable.DesignTemperantureMax, | 
					
						
							|  |  |  |  |                     DesignTemperantureMin = newtable.DesignTemperantureMin, | 
					
						
							|  |  |  |  |                     PressureType = newtable.PressureType, | 
					
						
							|  |  |  |  |                     DesignPressure = newtable.DesignPressure, | 
					
						
							|  |  |  |  |                     DesignPressureMax = newtable.DesignPressureMax, | 
					
						
							|  |  |  |  |                     Medium = newtable.Medium, | 
					
						
							|  |  |  |  |                     MediumForm = newtable.MediumForm, | 
					
						
							|  |  |  |  |                     MediumLevelMax = newtable.MediumLevelMax, | 
					
						
							|  |  |  |  |                     Reserves = newtable.Reserves, | 
					
						
							|  |  |  |  |                     StandardCode = newtable.StandardCode, | 
					
						
							|  |  |  |  |                     StandardName = newtable.StandardName, | 
					
						
							|  |  |  |  |                     StandardType = newtable.StandardType, | 
					
						
							|  |  |  |  |                     StandardDes = newtable.StandardDes, | 
					
						
							|  |  |  |  |                     MeasurementUnit = newtable.MeasurementUnit, | 
					
						
							|  |  |  |  |                     MeterMax = newtable.MeterMax, | 
					
						
							|  |  |  |  |                     MeterMin = newtable.MeterMin, | 
					
						
							|  |  |  |  |                     ThresholdLow1 = newtable.ThresholdLow1, | 
					
						
							|  |  |  |  |                     ThresholdLow2 = newtable.ThresholdLow2, | 
					
						
							|  |  |  |  |                     ThresholdMax1 = newtable.ThresholdMax1, | 
					
						
							|  |  |  |  |                     ThresholdMax2 = newtable.ThresholdMax2, | 
					
						
							|  |  |  |  |                     BitNum = newtable.BitNum, | 
					
						
							|  |  |  |  |                     DateTime = newtable.DateTime, | 
					
						
							|  |  |  |  |                     ProjectId = newtable.ProjectId, | 
					
						
							|  |  |  |  |                     Value = newtable.Value, | 
					
						
							|  |  |  |  |                     FactoryId = newtable.FactoryId, | 
					
						
							|  |  |  |  |                     ReportDate = newtable.ReportDate, | 
					
						
							|  |  |  |  |                     ReceiveDate = newtable.ReceiveDate, | 
					
						
							|  |  |  |  |                 }; | 
					
						
							|  |  |  |  |                 db.Hazard_RealTimeDevice.InsertOnSubmit(table); | 
					
						
							|  |  |  |  |                 db.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void AddBulkHazard_RealTimeDevice(List<Model.Hazard_RealTimeDevice> newtables) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 db.Hazard_RealTimeDevice.InsertAllOnSubmit(newtables); | 
					
						
							|  |  |  |  |                 db.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void UpdateHazard_RealTimeDevice(Model.Hazard_RealTimeDevice newtable) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) | 
					
						
							| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |                 Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == newtable.ID); | 
					
						
							|  |  |  |  |                 if (table != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     table.ID = newtable.ID; | 
					
						
							|  |  |  |  |                     table.UnitId = newtable.UnitId; | 
					
						
							|  |  |  |  |                     table.UnitName = newtable.UnitName; | 
					
						
							|  |  |  |  |                     table.HazardName = newtable.HazardName; | 
					
						
							|  |  |  |  |                     table.HazardLevel = newtable.HazardLevel; | 
					
						
							|  |  |  |  |                     table.DeviceCode = newtable.DeviceCode; | 
					
						
							|  |  |  |  |                     table.DeviceName = newtable.DeviceName; | 
					
						
							|  |  |  |  |                     table.DeviceType = newtable.DeviceType; | 
					
						
							|  |  |  |  |                     table.SphereType = newtable.SphereType; | 
					
						
							|  |  |  |  |                     table.TemperatureType = newtable.TemperatureType; | 
					
						
							|  |  |  |  |                     table.DesignTemperantureMax = newtable.DesignTemperantureMax; | 
					
						
							|  |  |  |  |                     table.DesignTemperantureMin = newtable.DesignTemperantureMin; | 
					
						
							|  |  |  |  |                     table.PressureType = newtable.PressureType; | 
					
						
							|  |  |  |  |                     table.DesignPressure = newtable.DesignPressure; | 
					
						
							|  |  |  |  |                     table.DesignPressureMax = newtable.DesignPressureMax; | 
					
						
							|  |  |  |  |                     table.Medium = newtable.Medium; | 
					
						
							|  |  |  |  |                     table.MediumForm = newtable.MediumForm; | 
					
						
							|  |  |  |  |                     table.MediumLevelMax = newtable.MediumLevelMax; | 
					
						
							|  |  |  |  |                     table.Reserves = newtable.Reserves; | 
					
						
							|  |  |  |  |                     table.StandardCode = newtable.StandardCode; | 
					
						
							|  |  |  |  |                     table.StandardName = newtable.StandardName; | 
					
						
							|  |  |  |  |                     table.StandardType = newtable.StandardType; | 
					
						
							|  |  |  |  |                     table.StandardDes = newtable.StandardDes; | 
					
						
							|  |  |  |  |                     table.MeasurementUnit = newtable.MeasurementUnit; | 
					
						
							|  |  |  |  |                     table.MeterMax = newtable.MeterMax; | 
					
						
							|  |  |  |  |                     table.MeterMin = newtable.MeterMin; | 
					
						
							|  |  |  |  |                     table.ThresholdLow1 = newtable.ThresholdLow1; | 
					
						
							|  |  |  |  |                     table.ThresholdLow2 = newtable.ThresholdLow2; | 
					
						
							|  |  |  |  |                     table.ThresholdMax1 = newtable.ThresholdMax1; | 
					
						
							|  |  |  |  |                     table.ThresholdMax2 = newtable.ThresholdMax2; | 
					
						
							|  |  |  |  |                     table.BitNum = newtable.BitNum; | 
					
						
							|  |  |  |  |                     table.DateTime = newtable.DateTime; | 
					
						
							|  |  |  |  |                     table.ProjectId = newtable.ProjectId; | 
					
						
							|  |  |  |  |                     table.Value = newtable.Value; | 
					
						
							|  |  |  |  |                     table.FactoryId = newtable.FactoryId; | 
					
						
							|  |  |  |  |                     table.ReportDate = newtable.ReportDate; | 
					
						
							|  |  |  |  |                     table.ReceiveDate = newtable.ReceiveDate; | 
					
						
							|  |  |  |  |                     db.SubmitChanges(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         public static void DeleteHazard_RealTimeDeviceById(string ID) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) | 
					
						
							| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |                 Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == ID); | 
					
						
							|  |  |  |  |                 if (table != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     db.Hazard_RealTimeDevice.DeleteOnSubmit(table); | 
					
						
							|  |  |  |  |                     db.SubmitChanges(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void DeleteALLHazard_RealTimeDevice() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) | 
					
						
							| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |                 if (db.Hazard_RealTimeDevice != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     db.Hazard_RealTimeDevice.DeleteAllOnSubmit(db.Hazard_RealTimeDevice); | 
					
						
							|  |  |  |  |                     db.SubmitChanges(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         public static List<Model.Hazard_RealTimeDevice> GetHazard_RealTimeDeviceByDate(DateTime? reportDate) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var q = from x in db.Hazard_RealTimeDevice | 
					
						
							|  |  |  |  |                     where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0 | 
					
						
							|  |  |  |  |                     select x; | 
					
						
							|  |  |  |  |             return q.ToList(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         public static void DeleteHazard_RealTimeDeviceByDate(DateTime? reportDate) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) | 
					
						
							| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |                 var table = db.Hazard_RealTimeDevice.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0); | 
					
						
							|  |  |  |  |                 if (table != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     db.Hazard_RealTimeDevice.DeleteAllOnSubmit(table); | 
					
						
							|  |  |  |  |                     db.SubmitChanges(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2023-03-09 14:50:40 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |