去除静态变量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 SyhsedataRiskcontrolService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
@@ -25,7 +23,7 @@ namespace BLL
|
||||
}
|
||||
public static List<Model.SYHSEData_RiskControl> GetSYHSEData_RiskControlByModle(Model.SYHSEData_RiskControl table)
|
||||
{
|
||||
var q = from x in db.SYHSEData_RiskControl
|
||||
var q = from x in Funs.DB.SYHSEData_RiskControl
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.FactoryId) || x.FactoryId.Contains(table.FactoryId)) &&
|
||||
@@ -65,7 +63,7 @@ namespace BLL
|
||||
|
||||
public static Model.SYHSEData_RiskControl GetSYHSEData_RiskControlById(string Id)
|
||||
{
|
||||
return db.SYHSEData_RiskControl.FirstOrDefault(x => x.Id == Id);
|
||||
return Funs.DB.SYHSEData_RiskControl.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,67 +77,69 @@ namespace BLL
|
||||
RiskControlName = newtable.RiskControlName,
|
||||
ReportDate = newtable.ReportDate,
|
||||
};
|
||||
db.SYHSEData_RiskControl.InsertOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
var db1 = Funs.DB;
|
||||
db1.SYHSEData_RiskControl.InsertOnSubmit(table);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
public static void AddBulkSYHSEData_RiskControl(List<Model.SYHSEData_RiskControl> newtables)
|
||||
{
|
||||
|
||||
db.SYHSEData_RiskControl.InsertAllOnSubmit(newtables);
|
||||
db.SubmitChanges();
|
||||
var db1 = Funs.DB;
|
||||
db1.SYHSEData_RiskControl.InsertAllOnSubmit(newtables);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
public static void UpdateSYHSEData_RiskControl(Model.SYHSEData_RiskControl newtable)
|
||||
{
|
||||
|
||||
Model.SYHSEData_RiskControl table = db.SYHSEData_RiskControl.FirstOrDefault(x => x.Id == newtable.Id);
|
||||
var db1 = Funs.DB;
|
||||
Model.SYHSEData_RiskControl table = db1.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();
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteSYHSEData_RiskControlById(string Id)
|
||||
{
|
||||
|
||||
Model.SYHSEData_RiskControl table = db.SYHSEData_RiskControl.FirstOrDefault(x => x.Id == Id);
|
||||
var db1 = Funs.DB;
|
||||
Model.SYHSEData_RiskControl table = db1.SYHSEData_RiskControl.FirstOrDefault(x => x.Id == Id);
|
||||
if (table != null)
|
||||
{
|
||||
db.SYHSEData_RiskControl.DeleteOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
db1.SYHSEData_RiskControl.DeleteOnSubmit(table);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DeleteALLSYHSEData_RiskControl()
|
||||
{
|
||||
if (db.SYHSEData_RiskControl != null)
|
||||
var db1 = Funs.DB;
|
||||
if (db1.SYHSEData_RiskControl != null)
|
||||
{
|
||||
db.SYHSEData_RiskControl.DeleteAllOnSubmit(db.SYHSEData_RiskControl);
|
||||
db.SubmitChanges();
|
||||
db1.SYHSEData_RiskControl.DeleteAllOnSubmit(db1.SYHSEData_RiskControl);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
}
|
||||
public static List<Model.SYHSEData_RiskControl> GetSYHSEData_RiskControlByDate(DateTime? reportDate)
|
||||
{
|
||||
var q = from x in db.SYHSEData_RiskControl
|
||||
var q = from x in Funs.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);
|
||||
var db1 = Funs.DB;
|
||||
var table = db1.SYHSEData_RiskControl.Where(x => x.ReportDate.Value.Date.CompareTo(reportDate.Value.Date) == 0);
|
||||
if (table != null)
|
||||
{
|
||||
db.SYHSEData_RiskControl.DeleteAllOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
db1.SYHSEData_RiskControl.DeleteAllOnSubmit(table);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user