去除静态变量Funs.DB

This commit is contained in:
2025-01-07 19:00:48 +08:00
parent 188974fadc
commit 2c1a328bc1
290 changed files with 1205 additions and 1242 deletions
@@ -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 EnergyreportItemService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -25,7 +23,7 @@ namespace BLL
}
public static List<Model.Environmental_EnergyReportItem> GetEnvironmental_EnergyReportItemByModle(Model.Environmental_EnergyReportItem table)
{
var q = from x in db.Environmental_EnergyReportItem
var q = from x in Funs.DB.Environmental_EnergyReportItem
where
(string.IsNullOrEmpty(table.EnergyReportItemId) || x.EnergyReportItemId.Contains(table.EnergyReportItemId)) &&
(string.IsNullOrEmpty(table.EnergyReportId) || x.EnergyReportId.Contains(table.EnergyReportId)) &&
@@ -87,7 +85,7 @@ namespace BLL
public static Model.Environmental_EnergyReportItem GetEnvironmental_EnergyReportItemById(string EnergyReportItemId)
{
return db.Environmental_EnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == EnergyReportItemId);
return Funs.DB.Environmental_EnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == EnergyReportItemId);
}
/// <summary>
@@ -203,22 +201,23 @@ namespace BLL
ServiceOperatingIncome_LastYear = newtable.ServiceOperatingIncome_LastYear,
ServiceOperatingIncome_ThisYear = newtable.ServiceOperatingIncome_ThisYear,
};
db.Environmental_EnergyReportItem.InsertOnSubmit(table);
db.SubmitChanges();
var db1 = Funs.DB;
db1.Environmental_EnergyReportItem.InsertOnSubmit(table);
db1.SubmitChanges();
}
public static void AddBulkEnvironmental_EnergyReportItem(List<Model.Environmental_EnergyReportItem> newtables)
{
db.Environmental_EnergyReportItem.InsertAllOnSubmit(newtables);
db.SubmitChanges();
var db1 = Funs.DB;
db1.Environmental_EnergyReportItem.InsertAllOnSubmit(newtables);
db1.SubmitChanges();
}
public static void UpdateEnvironmental_EnergyReportItem(Model.Environmental_EnergyReportItem newtable)
{
Model.Environmental_EnergyReportItem table = db.Environmental_EnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == newtable.EnergyReportItemId);
var db1 = Funs.DB;
Model.Environmental_EnergyReportItem table = db1.Environmental_EnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == newtable.EnergyReportItemId);
if (table != null)
{
table.EnergyReportItemId = newtable.EnergyReportItemId;
@@ -243,28 +242,29 @@ namespace BLL
table.ServiceOperatingIncome_BasePeriod = newtable.ServiceOperatingIncome_BasePeriod;
table.ServiceOperatingIncome_LastYear = newtable.ServiceOperatingIncome_LastYear;
table.ServiceOperatingIncome_ThisYear = newtable.ServiceOperatingIncome_ThisYear;
db.SubmitChanges();
db1.SubmitChanges();
}
}
public static void DeleteEnvironmental_EnergyReportItemById(string EnergyReportItemId)
{
Model.Environmental_EnergyReportItem table = db.Environmental_EnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == EnergyReportItemId);
var db1 = Funs.DB;
Model.Environmental_EnergyReportItem table = db1.Environmental_EnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == EnergyReportItemId);
if (table != null)
{
db.Environmental_EnergyReportItem.DeleteOnSubmit(table);
db.SubmitChanges();
db1.Environmental_EnergyReportItem.DeleteOnSubmit(table);
db1.SubmitChanges();
}
}
public static void DeleteALLEnvironmental_EnergyReportItem()
{
if (db.Environmental_EnergyReportItem != null)
var db1 = Funs.DB;
if (db1.Environmental_EnergyReportItem != null)
{
db.Environmental_EnergyReportItem.DeleteAllOnSubmit(db.Environmental_EnergyReportItem);
db.SubmitChanges();
db1.Environmental_EnergyReportItem.DeleteAllOnSubmit(db1.Environmental_EnergyReportItem);
db1.SubmitChanges();
}
}
public static void DeleteEnergyReportItemByChemicalReportId(string EnergyReportId)