ZHJA_HJGL/HJGL_ZH/BLL/HJGLServer/FileControl/HJGL_FileControl_DomesticSt...

87 lines
4.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
/// <summary>
/// 国内现行相关标准规范
/// </summary>
public static class HJGL_FileControl_DomesticStandardsService
{
/// <summary>
/// 根据主键获取国内现行相关标准规范
/// </summary>
/// <param name="DomesticStandardsId"></param>
/// <returns></returns>
public static Model.HJGL_FileControl_DomesticStandards GetDomesticStandardsById(string DomesticStandardsId)
{
return Funs.DB.HJGL_FileControl_DomesticStandards.FirstOrDefault(e => e.DomesticStandardsId == DomesticStandardsId);
}
/// <summary>
/// 添加国内现行相关标准规范
/// </summary>
/// <param name="DomesticStandards"></param>
public static void AddDomesticStandards(Model.HJGL_FileControl_DomesticStandards DomesticStandards)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_FileControl_DomesticStandards newDomesticStandards = new Model.HJGL_FileControl_DomesticStandards();
newDomesticStandards.DomesticStandardsId = DomesticStandards.DomesticStandardsId;
newDomesticStandards.DomesticStandardsCode = DomesticStandards.DomesticStandardsCode;
newDomesticStandards.DomesticStandardsName = DomesticStandards.DomesticStandardsName;
newDomesticStandards.Summary = DomesticStandards.Summary;
newDomesticStandards.CompileDate = DomesticStandards.CompileDate;
newDomesticStandards.AttachUrl = DomesticStandards.AttachUrl;
newDomesticStandards.CompileMan = DomesticStandards.CompileMan;
newDomesticStandards.CompileDate = DomesticStandards.CompileDate;
newDomesticStandards.Remarks = DomesticStandards.Remarks;
db.HJGL_FileControl_DomesticStandards.InsertOnSubmit(newDomesticStandards);
db.SubmitChanges();
}
/// <summary>
/// 修改国内现行相关标准规范
/// </summary>
/// <param name="DomesticStandards"></param>
public static void UpdateDomesticStandards(Model.HJGL_FileControl_DomesticStandards DomesticStandards)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_FileControl_DomesticStandards newDomesticStandards = db.HJGL_FileControl_DomesticStandards.FirstOrDefault(e => e.DomesticStandardsId == DomesticStandards.DomesticStandardsId);
if (newDomesticStandards != null)
{
newDomesticStandards.DomesticStandardsCode = DomesticStandards.DomesticStandardsCode;
newDomesticStandards.DomesticStandardsName = DomesticStandards.DomesticStandardsName;
newDomesticStandards.Summary = DomesticStandards.Summary;
newDomesticStandards.CompileDate = DomesticStandards.CompileDate;
newDomesticStandards.AttachUrl = DomesticStandards.AttachUrl;
newDomesticStandards.CompileMan = DomesticStandards.CompileMan;
newDomesticStandards.CompileDate = DomesticStandards.CompileDate;
newDomesticStandards.Remarks = DomesticStandards.Remarks;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除国内现行相关标准规范
/// </summary>
/// <param name="DomesticStandardsId"></param>
public static void DeleteDomesticStandardsById(string DomesticStandardsId)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_FileControl_DomesticStandards DomesticStandards = db.HJGL_FileControl_DomesticStandards.FirstOrDefault(e => e.DomesticStandardsId == DomesticStandardsId);
if (DomesticStandards != null)
{
if (!string.IsNullOrEmpty(DomesticStandards.AttachUrl))
{
BLL.UploadFileService.DeleteFile(Funs.RootPath, DomesticStandards.AttachUrl);//删除附件
}
BLL.AttachFileService.DeleteAttachFile(Funs.RootPath, DomesticStandardsId, Const.HJGLServer_DomesticStandardsMenuId);//删除附件
db.HJGL_FileControl_DomesticStandards.DeleteOnSubmit(DomesticStandards);
db.SubmitChanges();
}
}
}
}