去除静态变量Funs.DB
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Model;
|
||||
|
||||
|
||||
namespace BLL
|
||||
@@ -11,9 +12,6 @@ namespace BLL
|
||||
|
||||
public static class SyhsedataHiddendangercheckService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
@@ -25,7 +23,7 @@ namespace BLL
|
||||
}
|
||||
public static List<Model.SYHSEData_HiddenDangerCheck> GetSYHSEData_HiddenDangerCheckByModle(Model.SYHSEData_HiddenDangerCheck table)
|
||||
{
|
||||
var q = from x in db.SYHSEData_HiddenDangerCheck
|
||||
var q = from x in Funs.DB.SYHSEData_HiddenDangerCheck
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) &&
|
||||
@@ -67,7 +65,7 @@ namespace BLL
|
||||
|
||||
public static Model.SYHSEData_HiddenDangerCheck GetSYHSEData_HiddenDangerCheckById(string Id)
|
||||
{
|
||||
return db.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == Id);
|
||||
return Funs.DB.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,22 +81,23 @@ namespace BLL
|
||||
OKNum = newtable.OKNum,
|
||||
ReportDate = newtable.ReportDate,
|
||||
};
|
||||
db.SYHSEData_HiddenDangerCheck.InsertOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
var db1 = Funs.DB;
|
||||
db1.SYHSEData_HiddenDangerCheck.InsertOnSubmit(table);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
public static void AddBulkSYHSEData_HiddenDangerCheck(List<Model.SYHSEData_HiddenDangerCheck> newtables)
|
||||
{
|
||||
|
||||
db.SYHSEData_HiddenDangerCheck.InsertAllOnSubmit(newtables);
|
||||
db.SubmitChanges();
|
||||
var db1 = Funs.DB;
|
||||
db1.SYHSEData_HiddenDangerCheck.InsertAllOnSubmit(newtables);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
public static void UpdateSYHSEData_HiddenDangerCheck(Model.SYHSEData_HiddenDangerCheck newtable)
|
||||
{
|
||||
|
||||
Model.SYHSEData_HiddenDangerCheck table = db.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == newtable.Id);
|
||||
var db1 = Funs.DB;
|
||||
Model.SYHSEData_HiddenDangerCheck table = db1.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == newtable.Id);
|
||||
if (table != null)
|
||||
{
|
||||
table.Id = newtable.Id;
|
||||
@@ -107,45 +106,46 @@ namespace BLL
|
||||
table.TotalNum = newtable.TotalNum;
|
||||
table.OKNum = newtable.OKNum;
|
||||
table.ReportDate = newtable.ReportDate;
|
||||
db.SubmitChanges();
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteSYHSEData_HiddenDangerCheckById(string Id)
|
||||
{
|
||||
|
||||
Model.SYHSEData_HiddenDangerCheck table = db.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == Id);
|
||||
var db1 = Funs.DB;
|
||||
Model.SYHSEData_HiddenDangerCheck table = db1.SYHSEData_HiddenDangerCheck.FirstOrDefault(x => x.Id == Id);
|
||||
if (table != null)
|
||||
{
|
||||
db.SYHSEData_HiddenDangerCheck.DeleteOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
db1.SYHSEData_HiddenDangerCheck.DeleteOnSubmit(table);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DeleteALLSYHSEData_HiddenDangerCheck()
|
||||
{
|
||||
if (db.SYHSEData_HiddenDangerCheck != null)
|
||||
var db1 = Funs.DB;
|
||||
if (db1.SYHSEData_HiddenDangerCheck != null)
|
||||
{
|
||||
db.SYHSEData_HiddenDangerCheck.DeleteAllOnSubmit(db.SYHSEData_HiddenDangerCheck);
|
||||
db.SubmitChanges();
|
||||
db1.SYHSEData_HiddenDangerCheck.DeleteAllOnSubmit(db1.SYHSEData_HiddenDangerCheck);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
}
|
||||
public static List<Model.SYHSEData_HiddenDangerCheck> GetSYHSEData_HiddenDangerCheckByDate(DateTime? reportDate)
|
||||
{
|
||||
var q = from x in db.SYHSEData_HiddenDangerCheck
|
||||
var q = from x in Funs.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);
|
||||
var db1 = Funs.DB;
|
||||
var table = db1.SYHSEData_HiddenDangerCheck.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
|
||||
if (table != null)
|
||||
{
|
||||
db.SYHSEData_HiddenDangerCheck.DeleteAllOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
db1.SYHSEData_HiddenDangerCheck.DeleteAllOnSubmit(table);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user