2023-11-11

This commit is contained in:
2023-11-11 16:02:42 +08:00
parent b2ffd4b8d0
commit 48dd589a7f
66 changed files with 2334 additions and 1232 deletions
@@ -136,124 +136,134 @@ namespace BLL
public static void AddHazard_RealTimeDevice(Model.Hazard_RealTimeDevice newtable)
{
Model.Hazard_RealTimeDevice table = new Model.Hazard_RealTimeDevice
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
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();
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();
}
}
public static void AddBulkHazard_RealTimeDevice(List<Model.Hazard_RealTimeDevice> newtables)
{
db.Hazard_RealTimeDevice.InsertAllOnSubmit(newtables);
db.SubmitChanges();
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Hazard_RealTimeDevice.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
}
public static void UpdateHazard_RealTimeDevice(Model.Hazard_RealTimeDevice newtable)
{
Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == newtable.ID);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
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();
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();
}
}
}
public static void DeleteHazard_RealTimeDeviceById(string ID)
{
Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == ID);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Hazard_RealTimeDevice.DeleteOnSubmit(table);
db.SubmitChanges();
Model.Hazard_RealTimeDevice table = db.Hazard_RealTimeDevice.FirstOrDefault(x => x.ID == ID);
if (table != null)
{
db.Hazard_RealTimeDevice.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
}
public static void DeleteALLHazard_RealTimeDevice()
{
if (db.Hazard_RealTimeDevice != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Hazard_RealTimeDevice.DeleteAllOnSubmit(db.Hazard_RealTimeDevice);
db.SubmitChanges();
if (db.Hazard_RealTimeDevice != null)
{
db.Hazard_RealTimeDevice.DeleteAllOnSubmit(db.Hazard_RealTimeDevice);
db.SubmitChanges();
}
}
}
public static List<Model.Hazard_RealTimeDevice> GetHazard_RealTimeDeviceByDate(DateTime? reportDate)
@@ -265,14 +275,15 @@ namespace BLL
}
public static void DeleteHazard_RealTimeDeviceByDate(DateTime? reportDate)
{
var table = db.Hazard_RealTimeDevice.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Hazard_RealTimeDevice.DeleteAllOnSubmit(table);
db.SubmitChanges();
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();
}
}
}
}
}