fix:问题修改
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL;
|
||||
|
||||
public class ProtectionStandardsService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取
|
||||
/// </summary>
|
||||
/// <param name="ProtectionStandardsId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Technique_ProtectionStandards GetProtectionStandardsListById(string ProtectionStandardsId)
|
||||
{
|
||||
return Funs.DB.Technique_ProtectionStandards.FirstOrDefault(e =>
|
||||
e.ProtectionStandardsId == ProtectionStandardsId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加
|
||||
/// </summary>
|
||||
/// <param name="ProtectionStandardsList"></param>
|
||||
public static void AddProtectionStandardsList(Model.Technique_ProtectionStandards ProtectionStandardsList)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_ProtectionStandards newProtectionStandardsList = new Model.Technique_ProtectionStandards
|
||||
{
|
||||
ProtectionStandardsId = ProtectionStandardsList.ProtectionStandardsId,
|
||||
ProtectionStandardsCode = ProtectionStandardsList.ProtectionStandardsCode,
|
||||
ProtectionStandardsName = ProtectionStandardsList.ProtectionStandardsName,
|
||||
AttachUrl = ProtectionStandardsList.AttachUrl,
|
||||
CompileMan = ProtectionStandardsList.CompileMan,
|
||||
CompileDate = ProtectionStandardsList.CompileDate,
|
||||
};
|
||||
newProtectionStandardsList.CompileMan = ProtectionStandardsList.CompileMan;
|
||||
newProtectionStandardsList.CompileDate = ProtectionStandardsList.CompileDate;
|
||||
newProtectionStandardsList.IsPass = ProtectionStandardsList.IsPass;
|
||||
newProtectionStandardsList.UpState = ProtectionStandardsList.UpState;
|
||||
newProtectionStandardsList.Remark = ProtectionStandardsList.Remark;
|
||||
db.Technique_ProtectionStandards.InsertOnSubmit(newProtectionStandardsList);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="ProtectionStandardsList"></param>
|
||||
public static void UpdateProtectionStandardsList(Model.Technique_ProtectionStandards ProtectionStandardsList)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_ProtectionStandards newProtectionStandardsList =
|
||||
db.Technique_ProtectionStandards.FirstOrDefault(e =>
|
||||
e.ProtectionStandardsId == ProtectionStandardsList.ProtectionStandardsId);
|
||||
if (newProtectionStandardsList != null)
|
||||
{
|
||||
newProtectionStandardsList.ProtectionStandardsCode = ProtectionStandardsList.ProtectionStandardsCode;
|
||||
newProtectionStandardsList.ProtectionStandardsName = ProtectionStandardsList.ProtectionStandardsName;
|
||||
newProtectionStandardsList.AttachUrl = ProtectionStandardsList.AttachUrl;
|
||||
newProtectionStandardsList.CompileMan = ProtectionStandardsList.CompileMan;
|
||||
newProtectionStandardsList.CompileDate = ProtectionStandardsList.CompileDate;
|
||||
newProtectionStandardsList.UpState = ProtectionStandardsList.UpState;
|
||||
newProtectionStandardsList.Remark = ProtectionStandardsList.Remark;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///根据主键删除
|
||||
/// </summary>
|
||||
/// <param name="ProtectionStandardsId"></param>
|
||||
public static void DeleteProtectionStandardsListById(string ProtectionStandardsId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Technique_ProtectionStandards ProtectionStandardsList =
|
||||
db.Technique_ProtectionStandards.FirstOrDefault(e => e.ProtectionStandardsId == ProtectionStandardsId);
|
||||
if (ProtectionStandardsList != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ProtectionStandardsList.AttachUrl))
|
||||
{
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, ProtectionStandardsList.AttachUrl);
|
||||
}
|
||||
|
||||
////删除附件表
|
||||
BLL.CommonService.DeleteAttachFileById(ProtectionStandardsList.ProtectionStandardsId);
|
||||
|
||||
db.Technique_ProtectionStandards.DeleteOnSubmit(ProtectionStandardsList);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user