去除静态变量Funs.DB
This commit is contained in:
@@ -8,8 +8,6 @@ namespace BLL
|
||||
{
|
||||
public static class AttachFileService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 添加附件存储信息
|
||||
/// </summary>
|
||||
@@ -24,8 +22,9 @@ namespace BLL
|
||||
newAttachFile.AttachUrl = attachFile.AttachUrl;
|
||||
newAttachFile.MenuId = attachFile.MenuId;
|
||||
|
||||
db.AttachFile.InsertOnSubmit(newAttachFile);
|
||||
db.SubmitChanges();
|
||||
var db1 = Funs.DB;
|
||||
db1.AttachFile.InsertOnSubmit(newAttachFile);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -34,12 +33,13 @@ namespace BLL
|
||||
/// <param name="workArea"></param>
|
||||
public static void updateAttachFile(Model.AttachFile attachFile)
|
||||
{
|
||||
Model.AttachFile newAttachFile = db.AttachFile.FirstOrDefault(x => x.AttachFileId == attachFile.AttachFileId);
|
||||
var db1 = Funs.DB;
|
||||
Model.AttachFile newAttachFile = db1.AttachFile.FirstOrDefault(x => x.AttachFileId == attachFile.AttachFileId);
|
||||
newAttachFile.ToKeyId = attachFile.ToKeyId;
|
||||
newAttachFile.AttachSource = attachFile.AttachSource;
|
||||
newAttachFile.AttachUrl = attachFile.AttachUrl;
|
||||
newAttachFile.MenuId = attachFile.MenuId;
|
||||
db.SubmitChanges();
|
||||
db1.SubmitChanges();
|
||||
|
||||
}
|
||||
|
||||
@@ -49,12 +49,13 @@ namespace BLL
|
||||
/// <param name="workAreaId"></param>
|
||||
public static void DeleteAttachFile(string rootPath, string toKeyId, string menuId)
|
||||
{
|
||||
Model.AttachFile att = db.AttachFile.FirstOrDefault(e => e.ToKeyId == toKeyId && e.MenuId == menuId);
|
||||
var db1 = Funs.DB;
|
||||
Model.AttachFile att = db1.AttachFile.FirstOrDefault(e => e.ToKeyId == toKeyId && e.MenuId == menuId);
|
||||
if (att != null)
|
||||
{
|
||||
BLL.UploadFileService.DeleteFile(rootPath, att.AttachUrl);
|
||||
db.AttachFile.DeleteOnSubmit(att);
|
||||
db.SubmitChanges();
|
||||
db1.AttachFile.DeleteOnSubmit(att);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace BLL
|
||||
using Model;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
@@ -9,7 +11,6 @@
|
||||
/// </summary>
|
||||
public static class ProjectDataFlowSetService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
@@ -27,7 +28,7 @@
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getListData(string dataId, int startRowIndex, int maximumRows)
|
||||
{
|
||||
IQueryable<Model.View_ProjectData_FlowOperate> q = from x in db.View_ProjectData_FlowOperate
|
||||
IQueryable<Model.View_ProjectData_FlowOperate> q = from x in Funs.DB.View_ProjectData_FlowOperate
|
||||
where x.DataId == dataId && x.IsClosed == true
|
||||
orderby x.SortIndex descending
|
||||
select x;
|
||||
@@ -289,7 +290,7 @@
|
||||
/// <param name="dataId">主表主键Id</param>
|
||||
public static bool IsExitOperate(string menuId, string dataId)
|
||||
{
|
||||
return (from x in db.ProjectData_FlowOperate
|
||||
return (from x in Funs.DB.ProjectData_FlowOperate
|
||||
where x.MenuId == menuId && x.DataId == dataId
|
||||
select x).Count() > 0;
|
||||
}
|
||||
@@ -311,7 +312,7 @@
|
||||
/// </summary>
|
||||
public static void CloseFlowOperate(string menuId, string dataId, string opinion)
|
||||
{
|
||||
var updateUnFlowOperate = db.ProjectData_FlowOperate.FirstOrDefault(x => x.MenuId == menuId && x.DataId == dataId && (x.IsClosed == false || !x.IsClosed.HasValue));
|
||||
var updateUnFlowOperate = Funs.DB.ProjectData_FlowOperate.FirstOrDefault(x => x.MenuId == menuId && x.DataId == dataId && (x.IsClosed == false || !x.IsClosed.HasValue));
|
||||
if (updateUnFlowOperate != null)
|
||||
{
|
||||
updateUnFlowOperate.OperaterTime = DateTime.Now;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace BLL
|
||||
/// </summary>
|
||||
public class WeatherService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取事故类型
|
||||
|
||||
Reference in New Issue
Block a user