去除静态变量Funs.DB
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user