去除静态变量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
+1 -1
View File
@@ -5,7 +5,7 @@ namespace BLL
{
public static class PersonTotalService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 获取人员信息
+3 -4
View File
@@ -2,13 +2,12 @@
using System;
using System.Collections;
using System.Linq;
using Model;
namespace BLL
{
public static class Person_DutyService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -22,7 +21,7 @@ namespace BLL
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.Person_Duty> getDataLists = from x in db.Person_Duty
private static IQueryable<Model.Person_Duty> getDataLists = from x in Funs.DB.Person_Duty
select x;
/// <summary>
@@ -49,7 +48,7 @@ namespace BLL
x.CompilePersonId,
x.CompileTime,
x.WorkPostId,
WorkPostName=db.Base_WorkPost.First(U=>U.WorkPostId == x.WorkPostId).WorkPostName,
WorkPostName=Funs.DB.Base_WorkPost.First(U=>U.WorkPostId == x.WorkPostId).WorkPostName,
x.ApprovePersonId,
x.ApproveTime,
x.State,
@@ -4,7 +4,7 @@ namespace BLL
{
public static class Person_DutyTemplateService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 获取员工责任书模板信息
/// </summary>
@@ -3,13 +3,12 @@ using System;
using System.Collections;
using System.Linq;
using System.Runtime.InteropServices.ComTypes;
using Model;
namespace BLL
{
public static class Person_PersonContractService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -23,7 +22,7 @@ namespace BLL
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.Person_PersonContract> getDataLists = from x in db.Person_PersonContract
private static IQueryable<Model.Person_PersonContract> getDataLists = from x in Funs.DB.Person_PersonContract
select x;
/// <summary>
@@ -41,15 +40,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.PersonContractId,
x.PersonId,
x.UnitId,
db.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName,
db1.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName,
x.ProjectId,
db.Base_Project.First(u => u.ProjectId == x.ProjectId).ProjectName,
db1.Base_Project.First(u => u.ProjectId == x.ProjectId).ProjectName,
x.LeadManId,
x.Telephone,
x.ContractType,
+3 -4
View File
@@ -2,13 +2,12 @@
using System;
using System.Collections;
using System.Linq;
using Model;
namespace BLL
{
public static class Person_PersonTrainService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -22,7 +21,7 @@ namespace BLL
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.Person_PersonTrain> getDataLists = from x in db.Person_PersonTrain
private static IQueryable<Model.Person_PersonTrain> getDataLists = from x in Funs.DB.Person_PersonTrain
select x;
/// <summary>
@@ -46,7 +45,7 @@ namespace BLL
x.PersonTrainId,
x.PersonId,
x.TrainTypeId,
db.Base_TrainType.First(u => u.TrainTypeId == x.TrainTypeId).TrainTypeName,
Funs.DB.Base_TrainType.First(u => u.TrainTypeId == x.TrainTypeId).TrainTypeName,
x.TrainDate,
x.TrainPlace,
x.TrainResult,
+10 -10
View File
@@ -15,8 +15,6 @@ namespace BLL
/// </summary>
public static class Person_PersonsService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -30,7 +28,7 @@ namespace BLL
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.Person_Persons> getDataLists = from x in db.Person_Persons
private static IQueryable<Model.Person_Persons> getDataLists = from x in Funs.DB.Person_Persons
where x.PersonId != Const.sysglyId && x.PersonId != Const.hfnbdId
select x;
@@ -57,9 +55,11 @@ namespace BLL
{
getDataList = getDataList.Where(e => e.DepartId == departId);
}
var db1 = Funs.DB;
if (!string.IsNullOrEmpty(projetcId) && projetcId != Const._Null)
{
var idLists = (from x in db.SitePerson_PersonItem
var idLists = (from x in db1.SitePerson_PersonItem
where x.ProjectId == projetcId && !x.OutTime.HasValue
select x.PersonId).Distinct().ToList();
getDataList = getDataList.Where(x => idLists.Contains(x.PersonId));
@@ -115,9 +115,9 @@ namespace BLL
Sex = x.Sex ?? "1",
x.Birthday,
x.UnitId,
db.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName,
db1.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName,
x.DepartId,
db.Base_Depart.First(u => u.DepartId == x.DepartId).DepartName,
db1.Base_Depart.First(u => u.DepartId == x.DepartId).DepartName,
x.WorkPostId,
WorkPostName = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostId),
x.PostTitleId,
@@ -975,12 +975,12 @@ namespace BLL
}
public static void DeletePerson_PersonsById(string PersonId)
{
Model.Person_Persons table = db.Person_Persons.FirstOrDefault(x => x.PersonId == PersonId);
var db1 = Funs.DB;
Model.Person_Persons table = db1.Person_Persons.FirstOrDefault(x => x.PersonId == PersonId);
if (table != null)
{
db.Person_Persons.DeleteOnSubmit(table);
db.SubmitChanges();
db1.Person_Persons.DeleteOnSubmit(table);
db1.SubmitChanges();
}
}
@@ -6,7 +6,7 @@ namespace BLL
{
public static class Person_QuarterCheckApproveService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 获取人员信息
@@ -6,7 +6,7 @@ namespace BLL
{
public static class Person_QuarterCheckItemService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 获取人员信息
@@ -7,7 +7,7 @@ namespace BLL
{
public static class Person_QuarterCheckService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 获取人员信息
+10 -10
View File
@@ -1,13 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Model;
namespace BLL
{
public class Person_ShuntApproveService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 获取分流管理模板列表
/// </summary>
@@ -16,14 +15,15 @@ namespace BLL
/// <returns></returns>
public static IEnumerable getListData(string ShuntId)
{
return from x in db.Person_ShuntApprove
var db1 = Funs.DB;
return from x in db1.Person_ShuntApprove
where x.ShuntId == ShuntId && x.ApproveDate != null
orderby x.ApproveDate
select new
{
x.ShuntApproveId,
x.ShuntId,
ApproveMan = (from y in db.Person_Persons where y.PersonId == x.ApproveMan select y.PersonName).First(),
ApproveMan = (from y in db1.Person_Persons where y.PersonId == x.ApproveMan select y.PersonName).First(),
x.ApproveDate,
x.IsAgree,
x.ApproveIdea,
@@ -38,7 +38,7 @@ namespace BLL
/// <returns>一个分流管理审批实体</returns>
public static Model.Person_ShuntApprove GetShuntApproveByShuntApproveId(string ShuntApproveId)
{
return db.Person_ShuntApprove.FirstOrDefault(x => x.ShuntApproveId == ShuntApproveId);
return Funs.DB.Person_ShuntApprove.FirstOrDefault(x => x.ShuntApproveId == ShuntApproveId);
}
/// <summary>
@@ -48,7 +48,7 @@ namespace BLL
/// <returns>一个分流管理审批实体</returns>
public static Model.Person_ShuntApprove GetShuntApproveByShuntId(string ShuntId)
{
return db.Person_ShuntApprove.FirstOrDefault(x => x.ShuntId == ShuntId && x.ApproveDate == null);
return Funs.DB.Person_ShuntApprove.FirstOrDefault(x => x.ShuntId == ShuntId && x.ApproveDate == null);
}
/// <summary>
@@ -58,17 +58,17 @@ namespace BLL
/// <returns>一个分流管理审批实体</returns>
public static Model.Person_ShuntApprove GetShuntApproveByApproveId(string approveId)
{
return db.Person_ShuntApprove.FirstOrDefault(x => x.ShuntApproveId == approveId);
return Funs.DB.Person_ShuntApprove.FirstOrDefault(x => x.ShuntApproveId == approveId);
}
public static Model.Person_ShuntApprove GetComplie(string ShuntId)
{
return db.Person_ShuntApprove.FirstOrDefault(x => x.ShuntId == ShuntId && x.ApproveType == BLL.Const.Shunt_Compile);
return Funs.DB.Person_ShuntApprove.FirstOrDefault(x => x.ShuntId == ShuntId && x.ApproveType == BLL.Const.Shunt_Compile);
}
public static Model.Person_ShuntApprove GetAudit(string ShuntId)
{
return db.Person_ShuntApprove.FirstOrDefault(x => x.ShuntId == ShuntId && x.ApproveType == BLL.Const.Shunt_Audit);
return Funs.DB.Person_ShuntApprove.FirstOrDefault(x => x.ShuntId == ShuntId && x.ApproveType == BLL.Const.Shunt_Audit);
}
/// <summary>
@@ -78,7 +78,7 @@ namespace BLL
/// <returns>分流管理审批集合</returns>
public static List<Model.Person_ShuntApprove> GetShuntApprovesByShuntApproveId(string ShuntApproveId)
{
return (from x in db.Person_ShuntApprove where x.ShuntApproveId == ShuntApproveId select x).ToList();
return (from x in Funs.DB.Person_ShuntApprove where x.ShuntApproveId == ShuntApproveId select x).ToList();
}
/// <summary>
+2 -3
View File
@@ -2,13 +2,12 @@
using NPOI.SS.Formula.Functions;
using System.Collections;
using System.Linq;
using Model;
namespace BLL
{
public class Person_ShuntService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
@@ -22,7 +21,7 @@ namespace BLL
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.Person_Persons> getDataLists = from x in db.Person_Persons
private static IQueryable<Model.Person_Persons> getDataLists = from x in Funs.DB.Person_Persons
where x.PersonId != Const.sysglyId && x.PersonId != Const.hfnbdId && x.UnitId == Const.UnitId_SEDIN
&& x.DepartId == Const.Depart_constructionId
&& x.CurrentProjectId == null && (!x.IsOffice.HasValue || x.IsOffice == false)
@@ -4,7 +4,7 @@ namespace BLL
{
public static class Person_TrainingPlanService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 获取人员信息
/// </summary>