去除静态变量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 ProjectEnergyreportItemService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -25,7 +23,7 @@ namespace BLL
}
public static List<Model.Environmental_ProjectEnergyReportItem> GetEnvironmental_ProjectEnergyReportItemByModle(Model.Environmental_ProjectEnergyReportItem table)
{
var q = from x in db.Environmental_ProjectEnergyReportItem
var q = from x in Funs.DB.Environmental_ProjectEnergyReportItem
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_ProjectEnergyReportItem GetEnvironmental_ProjectEnergyReportItemById(string EnergyReportItemId)
{
return db.Environmental_ProjectEnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == EnergyReportItemId);
return Funs.DB.Environmental_ProjectEnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == EnergyReportItemId);
}
/// <summary>
@@ -209,22 +207,23 @@ namespace BLL
ServiceOperatingIncome_LastYear = newtable.ServiceOperatingIncome_LastYear,
ServiceOperatingIncome_ThisYear = newtable.ServiceOperatingIncome_ThisYear,
};
db.Environmental_ProjectEnergyReportItem.InsertOnSubmit(table);
db.SubmitChanges();
var db1 = Funs.DB;
db1.Environmental_ProjectEnergyReportItem.InsertOnSubmit(table);
db1.SubmitChanges();
}
public static void AddBulkEnvironmental_ProjectEnergyReportItem(List<Model.Environmental_ProjectEnergyReportItem> newtables)
{
db.Environmental_ProjectEnergyReportItem.InsertAllOnSubmit(newtables);
db.SubmitChanges();
var db1 = Funs.DB;
db1.Environmental_ProjectEnergyReportItem.InsertAllOnSubmit(newtables);
db1.SubmitChanges();
}
public static void UpdateEnvironmental_ProjectEnergyReportItem(Model.Environmental_ProjectEnergyReportItem newtable)
{
Model.Environmental_ProjectEnergyReportItem table = db.Environmental_ProjectEnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == newtable.EnergyReportItemId);
var db1 = Funs.DB;
Model.Environmental_ProjectEnergyReportItem table = db1.Environmental_ProjectEnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == newtable.EnergyReportItemId);
if (table != null)
{
table.EnergyReportItemId = newtable.EnergyReportItemId;
@@ -249,28 +248,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_ProjectEnergyReportItemById(string EnergyReportItemId)
{
Model.Environmental_ProjectEnergyReportItem table = db.Environmental_ProjectEnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == EnergyReportItemId);
var db1 = Funs.DB;
Model.Environmental_ProjectEnergyReportItem table = db1.Environmental_ProjectEnergyReportItem.FirstOrDefault(x => x.EnergyReportItemId == EnergyReportItemId);
if (table != null)
{
db.Environmental_ProjectEnergyReportItem.DeleteOnSubmit(table);
db.SubmitChanges();
db1.Environmental_ProjectEnergyReportItem.DeleteOnSubmit(table);
db1.SubmitChanges();
}
}
public static void DeleteALLEnvironmental_ProjectEnergyReportItem()
{
if (db.Environmental_ProjectEnergyReportItem != null)
var db1 = Funs.DB;
if (db1.Environmental_ProjectEnergyReportItem != null)
{
db.Environmental_ProjectEnergyReportItem.DeleteAllOnSubmit(db.Environmental_ProjectEnergyReportItem);
db.SubmitChanges();
db1.Environmental_ProjectEnergyReportItem.DeleteAllOnSubmit(db1.Environmental_ProjectEnergyReportItem);
db1.SubmitChanges();
}
}
public static void DeleteEnergyReportItemByChemicalReportId(string EnergyReportId)