2023-03-08 实业增加

This commit is contained in:
2023-03-08 11:45:40 +08:00
parent f3ad764dc8
commit 278225fac4
40 changed files with 5249 additions and 31 deletions
@@ -0,0 +1,278 @@
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)
{
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();
}
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)
{
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)
{
db.Hazard_RealTimeDevice.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLHazard_RealTimeDevice()
{
if (db.Hazard_RealTimeDevice != null)
{
db.Hazard_RealTimeDevice.DeleteAllOnSubmit(db.Hazard_RealTimeDevice);
db.SubmitChanges();
}
}
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)
{
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();
}
}
}
}
@@ -0,0 +1,245 @@
using FineUIPro;
using Model;
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class SYHSEData_DataService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.SYHSEData_Data> GetSYHSEData_DataByModle(Model.SYHSEData_Data table)
{
var q = from x in db.SYHSEData_Data
where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId))
select x
;
return q.ToList();
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.SYHSEData_Data table, Grid Grid1)
{
var q = GetSYHSEData_DataByModle(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.FactoryId,
x.SafetyMnaHours,
x.GeneralRiskNum,
x.LowRiskNum,
x.MoreRiskNum,
x.GreatRiskNum,
x.ReportDate,
};
}
#endregion
public static bool IsReportByDate(DateTime dateTime)
{
var result = false;
var q = (from x in Funs.DB.SYHSEData_Data
where x.ReportDate >= dateTime.Date && x.ReportDate < (dateTime.Date.AddDays(1).Date)
select x).ToList();
if (q != null && q.Count > 0)
{
result = true;
}
return result;
}
public static Model.ReturnData PushCNCEC(string Id)
{
string baseurl = "/api/SYHSEData/SaveNewSYHSEData";
var item = GetItemById(Id);
string str = JsonConvert.SerializeObject(item);
var responeData = BLL.ServerService.PushCNCEC(str, baseurl);
return responeData;
}
public static Model.NewSYHSEData GetItemById(string Id)
{
var data=GetSYHSEData_DataById(Id);
var data_realtime = HazardRealtimedeviceService.GetHazard_RealTimeDeviceByDate(data.ReportDate);
var data_hidden= SyhsedataHiddendangercheckService.GetSYHSEData_HiddenDangerCheckByDate(data.ReportDate);
var data_risk= SyhsedataRiskcontrolService.GetSYHSEData_RiskControlByDate(data.ReportDate);
NewSYHSEData APIData = new NewSYHSEData();
var APIDataList_Item= new List<NewSYHSEDataItem>();
var APIDataList_Relatime= new List<NewSYHSEDataRealTimeDeviceItem>();
var APIDataList_Hidden= new List<NewSYHSEDataHiddenDangerCheckItem>();
var APIDataList_Risk= new List<NewSYHSEDataRiskControlItem>();
foreach (var tb in data_realtime)
{
var q = new NewSYHSEDataRealTimeDeviceItem()
{
Id=tb.ID,
HazardName=tb.HazardName,
HazardLevel=tb.HazardLevel,
DeviceName=tb.DeviceName,
Medium=tb.Medium,
MeasurementUnit=tb.MeasurementUnit,
DateTime=tb.DateTime.ToString(),
Value=tb.Value,
};
APIDataList_Relatime.Add(q);
}
foreach (var tb in data_hidden)
{
var q = new NewSYHSEDataHiddenDangerCheckItem()
{
Id=tb.Id,
HiddenDangerName=tb.HiddenDangerName,
TotalNum=tb.TotalNum.HasValue ? tb.TotalNum.Value:0,
OKNum=tb.OKNum.HasValue ? tb.OKNum.Value : 0,
};
APIDataList_Hidden.Add(q);
}
foreach (var tb in data_risk)
{
var q = new NewSYHSEDataRiskControlItem()
{
Id=tb.Id,
RiskControlName=tb.RiskControlName,
};
APIDataList_Risk.Add(q);
}
NewSYHSEDataItem Item = new NewSYHSEDataItem();
Item.Id = data.Id;
Item.ReportDate=data.ReportDate.ToString();
Item.UnitId = Const.UnitId_SEDIN;
Item.CollCropCode = UnitService.GetUnitByUnitId(Const.UnitId_SEDIN).CollCropCode;
Item.UnitName= UnitService.GetUnitByUnitId(Const.UnitId_SEDIN).UnitName;
Item.FactoryId = data.FactoryId;
Item.FactoryCode = BLL.Base_FactoryService.GetBase_FactoryById(data.FactoryId).FactoryCode;
Item.FactoryName = BLL.Base_FactoryService.GetBase_FactoryById(data.FactoryId).FactoryName;
Item.Address = BLL.Base_FactoryService.GetBase_FactoryById(data.FactoryId).Address;
Item.SafetyMnaHours = data.SafetyMnaHours.HasValue ? data.SafetyMnaHours.Value : 0;
Item.GeneralRiskNum = data.GeneralRiskNum.HasValue ? data.GeneralRiskNum.Value : 0;
Item.LowRiskNum = data.LowRiskNum.HasValue ? data.LowRiskNum.Value : 0;
Item.MoreRiskNum = data.MoreRiskNum.HasValue ? data.MoreRiskNum.Value : 0;
Item.GreatRiskNum = data.GreatRiskNum.HasValue ? data.GreatRiskNum.Value : 0;
Item.NewSYHSEDataRiskControlItems = APIDataList_Risk;
Item.NewSYHSEDataRealTimeDeviceItems = APIDataList_Relatime;
Item.NewSYHSEDataHiddenDangerCheckItems = APIDataList_Hidden;
APIDataList_Item.Add(Item);
APIData.NewSYHSEDataItems = APIDataList_Item;
return APIData;
}
public static Model.SYHSEData_Data GetSYHSEData_DataById(string Id)
{
return db.SYHSEData_Data.FirstOrDefault(x => x.Id == Id);
}
public static void AddSYHSEData_Data(Model.SYHSEData_Data newtable)
{
Model.SYHSEData_Data table = new Model.SYHSEData_Data
{
Id = newtable.Id,
FactoryId = newtable.FactoryId,
SafetyMnaHours = newtable.SafetyMnaHours,
GeneralRiskNum = newtable.GeneralRiskNum,
LowRiskNum = newtable.LowRiskNum,
MoreRiskNum = newtable.MoreRiskNum,
GreatRiskNum = newtable.GreatRiskNum,
ReportDate = newtable.ReportDate,
};
db.SYHSEData_Data.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkSYHSEData_Data(List<Model.SYHSEData_Data> newtables)
{
db.SYHSEData_Data.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateSYHSEData_Data(Model.SYHSEData_Data newtable)
{
Model.SYHSEData_Data table = db.SYHSEData_Data.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.FactoryId = newtable.FactoryId;
table.SafetyMnaHours = newtable.SafetyMnaHours;
table.GeneralRiskNum = newtable.GeneralRiskNum;
table.LowRiskNum = newtable.LowRiskNum;
table.MoreRiskNum = newtable.MoreRiskNum;
table.GreatRiskNum = newtable.GreatRiskNum;
table.ReportDate = newtable.ReportDate;
db.SubmitChanges();
}
}
public static void DeleteSYHSEData_DataById(string Id)
{
Model.SYHSEData_Data table = db.SYHSEData_Data.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.SYHSEData_Data.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLSYHSEData_Data()
{
if (db.SYHSEData_Data != null)
{
db.SYHSEData_Data.DeleteAllOnSubmit(db.SYHSEData_Data);
db.SubmitChanges();
}
}
}
}
@@ -0,0 +1,153 @@
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class SyhsedataHiddendangercheckService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.SYHSEData_HiddenDangerCheck> GetSYHSEData_HiddenDangerCheckByModle(Model.SYHSEData_HiddenDangerCheck table)
{
var q = from x in db.SYHSEData_HiddenDangerCheck
where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) &&
(string.IsNullOrEmpty(table.HiddenDangerName) || x.HiddenDangerName.Contains(table.HiddenDangerName))
select x
;
return q.ToList();
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.SYHSEData_HiddenDangerCheck table, Grid Grid1)
{
var q = GetSYHSEData_HiddenDangerCheckByModle(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.FactoryId,
x.HiddenDangerName,
x.TotalNum,
x.OKNum,
x.ReportDate,
};
}
#endregion
public static Model.SYHSEData_HiddenDangerCheck GetSYHSEData_HiddenDangerCheckById(string Id)
{
return db.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == Id);
}
public static void AddSYHSEData_HiddenDangerCheck(Model.SYHSEData_HiddenDangerCheck newtable)
{
Model.SYHSEData_HiddenDangerCheck table = new Model.SYHSEData_HiddenDangerCheck
{
Id = newtable.Id,
FactoryId = newtable.FactoryId,
HiddenDangerName = newtable.HiddenDangerName,
TotalNum = newtable.TotalNum,
OKNum = newtable.OKNum,
ReportDate = newtable.ReportDate,
};
db.SYHSEData_HiddenDangerCheck.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkSYHSEData_HiddenDangerCheck(List<Model.SYHSEData_HiddenDangerCheck> newtables)
{
db.SYHSEData_HiddenDangerCheck.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateSYHSEData_HiddenDangerCheck(Model.SYHSEData_HiddenDangerCheck newtable)
{
Model.SYHSEData_HiddenDangerCheck table = db.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.FactoryId = newtable.FactoryId;
table.HiddenDangerName = newtable.HiddenDangerName;
table.TotalNum = newtable.TotalNum;
table.OKNum = newtable.OKNum;
table.ReportDate = newtable.ReportDate;
db.SubmitChanges();
}
}
public static void DeleteSYHSEData_HiddenDangerCheckById(string Id)
{
Model.SYHSEData_HiddenDangerCheck table = db.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.SYHSEData_HiddenDangerCheck.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLSYHSEData_HiddenDangerCheck()
{
if (db.SYHSEData_HiddenDangerCheck != null)
{
db.SYHSEData_HiddenDangerCheck.DeleteAllOnSubmit(db.SYHSEData_HiddenDangerCheck);
db.SubmitChanges();
}
}
public static List<Model.SYHSEData_HiddenDangerCheck> GetSYHSEData_HiddenDangerCheckByDate(DateTime? reportDate)
{
var q = from x in db.SYHSEData_HiddenDangerCheck
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0
select x;
return q.ToList();
}
public static void DeleteSYHSEData_HiddenDangerCheckByDate(DateTime? reportDate)
{
var table = db.SYHSEData_HiddenDangerCheck.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
{
db.SYHSEData_HiddenDangerCheck.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
}
@@ -0,0 +1,147 @@
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class SyhsedataRiskcontrolService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
public static List<Model.SYHSEData_RiskControl> GetSYHSEData_RiskControlByModle(Model.SYHSEData_RiskControl table)
{
var q = from x in db.SYHSEData_RiskControl
where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) &&
(string.IsNullOrEmpty(table.RiskControlName) || x.RiskControlName.Contains(table.RiskControlName))
select x
;
return q.ToList();
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(Model.SYHSEData_RiskControl table, Grid Grid1)
{
var q = GetSYHSEData_RiskControlByModle(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.FactoryId,
x.RiskControlName,
x.ReportDate,
};
}
#endregion
public static Model.SYHSEData_RiskControl GetSYHSEData_RiskControlById(string Id)
{
return db.SYHSEData_RiskControl.FirstOrDefault(x => x.Id == Id);
}
public static void AddSYHSEData_RiskControl(Model.SYHSEData_RiskControl newtable)
{
Model.SYHSEData_RiskControl table = new Model.SYHSEData_RiskControl
{
Id = newtable.Id,
FactoryId = newtable.FactoryId,
RiskControlName = newtable.RiskControlName,
ReportDate = newtable.ReportDate,
};
db.SYHSEData_RiskControl.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkSYHSEData_RiskControl(List<Model.SYHSEData_RiskControl> newtables)
{
db.SYHSEData_RiskControl.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateSYHSEData_RiskControl(Model.SYHSEData_RiskControl newtable)
{
Model.SYHSEData_RiskControl table = db.SYHSEData_RiskControl.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.FactoryId = newtable.FactoryId;
table.RiskControlName = newtable.RiskControlName;
table.ReportDate = newtable.ReportDate;
db.SubmitChanges();
}
}
public static void DeleteSYHSEData_RiskControlById(string Id)
{
Model.SYHSEData_RiskControl table = db.SYHSEData_RiskControl.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
db.SYHSEData_RiskControl.DeleteOnSubmit(table);
db.SubmitChanges();
}
}
public static void DeleteALLSYHSEData_RiskControl()
{
if (db.SYHSEData_RiskControl != null)
{
db.SYHSEData_RiskControl.DeleteAllOnSubmit(db.SYHSEData_RiskControl);
db.SubmitChanges();
}
}
public static List<Model.SYHSEData_RiskControl> GetSYHSEData_RiskControlByDate(DateTime? reportDate)
{
var q = from x in db.SYHSEData_RiskControl
where x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0
select x;
return q.ToList();
}
public static void DeleteSYHSEData_RiskControlByDate(DateTime? reportDate)
{
var table = db.SYHSEData_RiskControl.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
if (table != null)
{
db.SYHSEData_RiskControl.DeleteAllOnSubmit(table);
db.SubmitChanges();
}
}
}
}