去除静态变量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();
}
}
@@ -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)
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using Model;
namespace BLL
@@ -12,9 +13,6 @@ namespace BLL
public static class ProjectEnergyReportService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -26,7 +24,7 @@ namespace BLL
}
public static List<Model.Environmental_ProjectEnergyReport> GetEnvironmental_ProjectEnergyReportByModle(Model.Environmental_ProjectEnergyReport table)
{
var q = from x in db.Environmental_ProjectEnergyReport
var q = from x in Funs.DB.Environmental_ProjectEnergyReport
where
(string.IsNullOrEmpty(table.EnergyReportId) || x.EnergyReportId.Contains(table.EnergyReportId)) &&
(string.IsNullOrEmpty(table.UnitId) || x.UnitId.Contains(table.UnitId)) &&
@@ -73,7 +71,7 @@ namespace BLL
public static Model.Environmental_ProjectEnergyReport GetEnvironmental_ProjectEnergyReportById(string EnergyReportId)
{
return db.Environmental_ProjectEnergyReport.FirstOrDefault(x => x.EnergyReportId == EnergyReportId);
return Funs.DB.Environmental_ProjectEnergyReport.FirstOrDefault(x => x.EnergyReportId == EnergyReportId);
}
public static Model.Environmental_ProjectEnergyReport GetEnvironmental_ProjectEnergyReportByProjectIdAndYearAndQuarters(string ProjectId, int year, int Quarters)
@@ -95,15 +93,16 @@ namespace BLL
UpState = newtable.UpState,
ProjectId=newtable.ProjectId,
};
db.Environmental_ProjectEnergyReport.InsertOnSubmit(table);
db.SubmitChanges();
var db1 = Funs.DB;
db1.Environmental_ProjectEnergyReport.InsertOnSubmit(table);
db1.SubmitChanges();
}
public static void AddBulkEnvironmental_ProjectEnergyReport(List<Model.Environmental_ProjectEnergyReport> newtables)
{
db.Environmental_ProjectEnergyReport.InsertAllOnSubmit(newtables);
db.SubmitChanges();
var db1 = Funs.DB;
db1.Environmental_ProjectEnergyReport.InsertAllOnSubmit(newtables);
db1.SubmitChanges();
}
/// <summary>
@@ -131,8 +130,8 @@ namespace BLL
}
public static void UpdateEnvironmental_ProjectEnergyReport(Model.Environmental_ProjectEnergyReport newtable)
{
Model.Environmental_ProjectEnergyReport table = db.Environmental_ProjectEnergyReport.FirstOrDefault(x => x.EnergyReportId == newtable.EnergyReportId);
var db1 = Funs.DB;
Model.Environmental_ProjectEnergyReport table = db1.Environmental_ProjectEnergyReport.FirstOrDefault(x => x.EnergyReportId == newtable.EnergyReportId);
if (table != null)
{
table.EnergyReportId = newtable.EnergyReportId;
@@ -144,28 +143,29 @@ namespace BLL
table.DutyPerson = newtable.DutyPerson;
table.UpState = newtable.UpState;
table.ProjectId=newtable.ProjectId;
db.SubmitChanges();
db1.SubmitChanges();
}
}
public static void DeleteEnvironmental_ProjectEnergyReportById(string EnergyReportId)
{
Model.Environmental_ProjectEnergyReport table = db.Environmental_ProjectEnergyReport.FirstOrDefault(x => x.EnergyReportId == EnergyReportId);
var db1 = Funs.DB;
Model.Environmental_ProjectEnergyReport table = db1.Environmental_ProjectEnergyReport.FirstOrDefault(x => x.EnergyReportId == EnergyReportId);
if (table != null)
{
db.Environmental_ProjectEnergyReport.DeleteOnSubmit(table);
db.SubmitChanges();
db1.Environmental_ProjectEnergyReport.DeleteOnSubmit(table);
db1.SubmitChanges();
}
}
public static void DeleteALLEnvironmental_ProjectEnergyReport()
{
if (db.Environmental_ProjectEnergyReport != null)
var db1 = Funs.DB;
if (db1.Environmental_ProjectEnergyReport != null)
{
db.Environmental_ProjectEnergyReport.DeleteAllOnSubmit(db.Environmental_ProjectEnergyReport);
db.SubmitChanges();
db1.Environmental_ProjectEnergyReport.DeleteAllOnSubmit(db1.Environmental_ProjectEnergyReport);
db1.SubmitChanges();
}
}
@@ -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)