去除静态变量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
+3 -4
View File
@@ -8,8 +8,6 @@ namespace BLL
/// </summary>
public static class CQMSDataCollectService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 根据主键获取项目质量数据汇总
/// </summary>
@@ -172,8 +170,9 @@ namespace BLL
ProjectId = project.ProjectId,
};
db.DigData_CQMSDataCollectSubmission.InsertOnSubmit(newSubmission);
db.SubmitChanges();
var db1 = Funs.DB;
db1.DigData_CQMSDataCollectSubmission.InsertOnSubmit(newSubmission);
db1.SubmitChanges();
}
#endregion
}
+2 -3
View File
@@ -2,6 +2,7 @@
using System;
using System.Collections;
using System.Linq;
using Model;
namespace BLL
{
@@ -10,8 +11,6 @@ namespace BLL
/// </summary>
public static class CQMSDataDWService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -25,7 +24,7 @@ namespace BLL
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.Base_Project> getDataLists = from x in db.Base_Project
private static IQueryable<Model.Base_Project> getDataLists = from x in Funs.DB.Base_Project
where x.ProjectState == Const.ProjectState_1
select x;
+3 -4
View File
@@ -8,8 +8,6 @@ namespace BLL
/// </summary>
public static class HSEDataCollectService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 根据主键获取项目HSE数据汇总
/// </summary>
@@ -172,8 +170,9 @@ namespace BLL
ProjectId = project.ProjectId,
};
db.DigData_HSEDataCollectSubmission.InsertOnSubmit(newSubmission);
db.SubmitChanges();
var db1 = Funs.DB;
db1.DigData_HSEDataCollectSubmission.InsertOnSubmit(newSubmission);
db1.SubmitChanges();
}
#endregion
}
+5 -5
View File
@@ -2,6 +2,7 @@
using System;
using System.Collections;
using System.Linq;
using Model;
namespace BLL
{
@@ -10,8 +11,6 @@ namespace BLL
/// </summary>
public static class HSEDataDWService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -25,7 +24,7 @@ namespace BLL
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.Base_Project> getDataLists = from x in db.Base_Project
private static IQueryable<Model.Base_Project> getDataLists = from x in Funs.DB.Base_Project
where x.ProjectState == Const.ProjectState_1
select x;
@@ -51,15 +50,16 @@ namespace BLL
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
var db1 = Funs.DB;
return from x in getDataList
select new
{
x.ProjectId,
x.ProjectName,
x.ProjectCode,
Count1=db.SitePerson_Person.Where(p=>p.ProjectId == x.ProjectId && p.States == Const.ProjectPersonStates_1).Count(), //人员数量
Count1=db1.SitePerson_Person.Where(p=>p.ProjectId == x.ProjectId && p.States == Const.ProjectPersonStates_1).Count(), //人员数量
Count2 = getProjecctSafeHours(x.ProjectId), //安全人工时
Count3 =db.EduTrain_TrainRecord.Where(p => p.ProjectId == x.ProjectId && p.States == BLL.Const.State_2).Count(), //安全培训次数
Count3 =db1.EduTrain_TrainRecord.Where(p => p.ProjectId == x.ProjectId && p.States == BLL.Const.State_2).Count(), //安全培训次数
ProblemRate = getProblemRate(x.ProjectId), //安全巡检整改率
};
}
+2 -3
View File
@@ -2,6 +2,7 @@
using System;
using System.Collections;
using System.Linq;
using Model;
namespace BLL
{
@@ -10,8 +11,6 @@ namespace BLL
/// </summary>
public static class HTGLDataDWService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -25,7 +24,7 @@ namespace BLL
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.Base_Project> getDataLists = from x in db.Base_Project
private static IQueryable<Model.Base_Project> getDataLists = from x in Funs.DB.Base_Project
select x;
/// <summary>
+2 -3
View File
@@ -2,6 +2,7 @@
using System;
using System.Collections;
using System.Linq;
using Model;
namespace BLL
{
@@ -10,8 +11,6 @@ namespace BLL
/// </summary>
public static class JDGLDataDWService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -25,7 +24,7 @@ namespace BLL
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.Base_Project> getDataLists = from x in db.Base_Project
private static IQueryable<Model.Base_Project> getDataLists = from x in Funs.DB.Base_Project
select x;
/// <summary>
+6 -7
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Model;
namespace BLL
{
@@ -9,8 +10,6 @@ namespace BLL
/// </summary>
public static class ProblemAnalysisService
{
public static Model.SGGLDB db = Funs.DB;
#region AnalysisColumn
/// <summary>
/// 统计列
@@ -56,7 +55,7 @@ namespace BLL
/// <summary>
/// 安全巡检
/// </summary>
public static IQueryable<Model.HSSE_Hazard_HazardRegister> getHazardRegisterLists = from x in db.HSSE_Hazard_HazardRegister
public static IQueryable<Model.HSSE_Hazard_HazardRegister> getHazardRegisterLists = from x in Funs.DB.HSSE_Hazard_HazardRegister
where x.States != Const.State_4 && x.ProjectId != Const.Project_TestProjectId && x.ProjectId != null
select x;
/// <summary>
@@ -163,7 +162,7 @@ namespace BLL
}
else
{
var getTypes = from x in db.HSSE_Hazard_HazardRegisterTypes
var getTypes = from x in Funs.DB.HSSE_Hazard_HazardRegisterTypes
where x.HazardRegisterType == type
orderby x.TypeCode
select x;
@@ -252,7 +251,7 @@ namespace BLL
/// <summary>
/// 隐患整改单
/// </summary>
public static IQueryable<Model.Check_RectifyNotices> getRectifyNoticesLists = from x in db.Check_RectifyNotices
public static IQueryable<Model.Check_RectifyNotices> getRectifyNoticesLists = from x in Funs.DB.Check_RectifyNotices
where x.States != Const.State_0 && x.States != null && x.ProjectId != Const.Project_TestProjectId && x.ProjectId != null
select x;
/// <summary>
@@ -409,13 +408,13 @@ namespace BLL
/// <summary>
/// 教育培训
/// </summary>
public static IQueryable<Model.EduTrain_TrainRecord> getTrainRecordLists = from x in db.EduTrain_TrainRecord
public static IQueryable<Model.EduTrain_TrainRecord> getTrainRecordLists = from x in Funs.DB.EduTrain_TrainRecord
where x.ProjectId != Const.Project_TestProjectId && x.ProjectId != null
select x;
/// <summary>
/// 教育培训明细
/// </summary>
public static IQueryable<Model.EduTrain_TrainRecordDetail> getTrainRecordDetailLists = from x in db.EduTrain_TrainRecordDetail
public static IQueryable<Model.EduTrain_TrainRecordDetail> getTrainRecordDetailLists = from x in Funs.DB.EduTrain_TrainRecordDetail
select x;
/// <summary>
/// 教育培训统计
@@ -5,6 +5,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web.Util;
using Model;
namespace BLL
{
@@ -13,8 +14,6 @@ namespace BLL
/// </summary>
public static class ProjectWBSAnalysisService
{
public static Model.SGGLDB db = Funs.DB;
#region WBS分析
/// <summary>
/// 记录数
@@ -28,7 +27,7 @@ namespace BLL
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.WBS_WorkPackage> getDataLists = from x in db.WBS_WorkPackage
private static IQueryable<Model.WBS_WorkPackage> getDataLists = from x in Funs.DB.WBS_WorkPackage
where x.IsApprove == true
select x;
@@ -64,9 +63,10 @@ namespace BLL
}
else
{
var db1 = Funs.DB;
if (workPackageId != "1" && workPackageId != "2")
{
var getUnitWork = db.WBS_UnitWork.FirstOrDefault(x => x.ProjectId == projectId && x.UnitWorkId == workPackageId);
var getUnitWork = db1.WBS_UnitWork.FirstOrDefault(x => x.ProjectId == projectId && x.UnitWorkId == workPackageId);
if (getUnitWork != null)
{
getDataList = getDataList.Where(x => x.UnitWorkId == workPackageId && x.SuperWorkPack == null);
@@ -82,7 +82,7 @@ namespace BLL
}
else
{
var getUnitWork = from x in db.WBS_UnitWork
var getUnitWork = from x in db1.WBS_UnitWork
where x.ProjectId == projectId && x.SuperUnitWork == null && x.ProjectType == workPackageId
select x;
List<Model.WBS_WorkPackage> listWork = new List<Model.WBS_WorkPackage>();
+2 -3
View File
@@ -5,6 +5,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Model;
namespace BLL
{
@@ -13,8 +14,6 @@ namespace BLL
/// </summary>
public static class WBSAnalysisService
{
public static Model.SGGLDB db = Funs.DB;
#region WBS分析
/// <summary>
/// 记录数
@@ -28,7 +27,7 @@ namespace BLL
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.WBS_WorkPackageInit> getDataLists = from x in db.WBS_WorkPackageInit
private static IQueryable<Model.WBS_WorkPackageInit> getDataLists = from x in Funs.DB.WBS_WorkPackageInit
select x;
/// <summary>