去除静态变量Funs.DB
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Model;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
@@ -8,8 +9,6 @@ namespace BLL
|
||||
/// </summary>
|
||||
public static class TrainingPlanItemService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据培训计划明细表Id获取所有相关明细信息
|
||||
/// </summary>
|
||||
@@ -17,7 +16,7 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static List<Model.Training_PlanItem> GetPlanItemByPlanId(string planId)
|
||||
{
|
||||
return (from x in db.Training_PlanItem where x.PlanId == planId select x).ToList();
|
||||
return (from x in Funs.DB.Training_PlanItem where x.PlanId == planId select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -32,8 +31,9 @@ namespace BLL
|
||||
PlanId = planItem.PlanId,
|
||||
TrainingEduId = planItem.TrainingEduId
|
||||
};
|
||||
db.Training_PlanItem.InsertOnSubmit(newPlanItem);
|
||||
db.SubmitChanges();
|
||||
var db1 = Funs.DB;
|
||||
db1.Training_PlanItem.InsertOnSubmit(newPlanItem);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -42,11 +42,12 @@ namespace BLL
|
||||
/// <param name="planItemId"></param>
|
||||
public static void DeletePlanItemById(string planItemId)
|
||||
{
|
||||
var planItem = db.Training_PlanItem.FirstOrDefault(e => e.PlanItemId == planItemId);
|
||||
var db1 = Funs.DB;
|
||||
var planItem = db1.Training_PlanItem.FirstOrDefault(e => e.PlanItemId == planItemId);
|
||||
if (planItem != null)
|
||||
{
|
||||
db.Training_PlanItem.DeleteOnSubmit(planItem);
|
||||
db.SubmitChanges();
|
||||
db1.Training_PlanItem.DeleteOnSubmit(planItem);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user