去除静态变量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 EnergyReportService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -25,7 +23,7 @@ namespace BLL
}
public static List<Model.Environmental_EnergyReport> GetEnvironmental_EnergyReportByModle(Model.Environmental_EnergyReport table)
{
var q = from x in db.Environmental_EnergyReport
var q = from x in Funs.DB.Environmental_EnergyReport
where
(string.IsNullOrEmpty(table.EnergyReportId) || x.EnergyReportId.Contains(table.EnergyReportId)) &&
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
@@ -71,7 +69,7 @@ namespace BLL
public static Model.Environmental_EnergyReport GetEnvironmental_EnergyReportById(string EnergyReportId)
{
return db.Environmental_EnergyReport.FirstOrDefault(x => x.EnergyReportId == EnergyReportId);
return Funs.DB.Environmental_EnergyReport.FirstOrDefault(x => x.EnergyReportId == EnergyReportId);
}
public static Model.Environmental_EnergyReport GetEnvironmental_EnergyReportByUnitIdAndYearAndQuarters(string unitId, int year, int Quarters)
@@ -92,15 +90,16 @@ namespace BLL
DutyPerson = newtable.DutyPerson,
UpState = newtable.UpState,
};
db.Environmental_EnergyReport.InsertOnSubmit(table);
db.SubmitChanges();
var db1 = Funs.DB;
db1.Environmental_EnergyReport.InsertOnSubmit(table);
db1.SubmitChanges();
}
public static void AddBulkEnvironmental_EnergyReport(List<Model.Environmental_EnergyReport> newtables)
{
db.Environmental_EnergyReport.InsertAllOnSubmit(newtables);
db.SubmitChanges();
var db1 = Funs.DB;
db1.Environmental_EnergyReport.InsertAllOnSubmit(newtables);
db1.SubmitChanges();
}
/// <summary>
@@ -124,8 +123,8 @@ namespace BLL
}
public static void UpdateEnvironmental_EnergyReport(Model.Environmental_EnergyReport newtable)
{
Model.Environmental_EnergyReport table = db.Environmental_EnergyReport.FirstOrDefault(x => x.EnergyReportId == newtable.EnergyReportId);
var db1 = Funs.DB;
Model.Environmental_EnergyReport table = db1.Environmental_EnergyReport.FirstOrDefault(x => x.EnergyReportId == newtable.EnergyReportId);
if (table != null)
{
table.EnergyReportId = newtable.EnergyReportId;
@@ -136,7 +135,7 @@ namespace BLL
table.FillingDate = newtable.FillingDate;
table.DutyPerson = newtable.DutyPerson;
table.UpState = newtable.UpState;
db.SubmitChanges();
db1.SubmitChanges();
}
}
@@ -154,10 +153,11 @@ namespace BLL
public static void DeleteALLEnvironmental_EnergyReport()
{
if (db.Environmental_EnergyReport != null)
var db1 = Funs.DB;
if (db1.Environmental_EnergyReport != null)
{
db.Environmental_EnergyReport.DeleteAllOnSubmit(db.Environmental_EnergyReport);
db.SubmitChanges();
db1.Environmental_EnergyReport.DeleteAllOnSubmit(db1.Environmental_EnergyReport);
db1.SubmitChanges();
}
}