using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
///
/// 国内法律法规相关条款表
///
public static class HJGL_FileControl_DomesticLawsRegulationsService
{
///
/// 根据主键获取国内法律法规相关条款
///
///
///
public static Model.HJGL_FileControl_DomesticLawsRegulations GetDomesticLawsRegulationsById(string domesticLawsRegulationsId)
{
return Funs.DB.HJGL_FileControl_DomesticLawsRegulations.FirstOrDefault(e => e.DomesticLawsRegulationsId == domesticLawsRegulationsId);
}
///
/// 添加国内法律法规相关条款
///
///
public static void AddDomesticLawsRegulations(Model.HJGL_FileControl_DomesticLawsRegulations domesticLawsRegulations)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_FileControl_DomesticLawsRegulations newDomesticLawsRegulations = new Model.HJGL_FileControl_DomesticLawsRegulations();
newDomesticLawsRegulations.DomesticLawsRegulationsId = domesticLawsRegulations.DomesticLawsRegulationsId;
newDomesticLawsRegulations.DomesticLawsRegulationsCode = domesticLawsRegulations.DomesticLawsRegulationsCode;
newDomesticLawsRegulations.DomesticLawsRegulationsName = domesticLawsRegulations.DomesticLawsRegulationsName;
newDomesticLawsRegulations.Summary = domesticLawsRegulations.Summary;
newDomesticLawsRegulations.CompileDate = domesticLawsRegulations.CompileDate;
newDomesticLawsRegulations.AttachUrl = domesticLawsRegulations.AttachUrl;
newDomesticLawsRegulations.CompileMan = domesticLawsRegulations.CompileMan;
newDomesticLawsRegulations.CompileDate = domesticLawsRegulations.CompileDate;
newDomesticLawsRegulations.Remarks = domesticLawsRegulations.Remarks;
db.HJGL_FileControl_DomesticLawsRegulations.InsertOnSubmit(newDomesticLawsRegulations);
db.SubmitChanges();
}
///
/// 修改国内法律法规相关条款
///
///
public static void UpdateDomesticLawsRegulations(Model.HJGL_FileControl_DomesticLawsRegulations domesticLawsRegulations)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_FileControl_DomesticLawsRegulations newDomesticLawsRegulations = db.HJGL_FileControl_DomesticLawsRegulations.FirstOrDefault(e => e.DomesticLawsRegulationsId == domesticLawsRegulations.DomesticLawsRegulationsId);
if (newDomesticLawsRegulations != null)
{
newDomesticLawsRegulations.DomesticLawsRegulationsCode = domesticLawsRegulations.DomesticLawsRegulationsCode;
newDomesticLawsRegulations.DomesticLawsRegulationsName = domesticLawsRegulations.DomesticLawsRegulationsName;
newDomesticLawsRegulations.Summary = domesticLawsRegulations.Summary;
newDomesticLawsRegulations.CompileDate = domesticLawsRegulations.CompileDate;
newDomesticLawsRegulations.AttachUrl = domesticLawsRegulations.AttachUrl;
newDomesticLawsRegulations.CompileMan = domesticLawsRegulations.CompileMan;
newDomesticLawsRegulations.CompileDate = domesticLawsRegulations.CompileDate;
newDomesticLawsRegulations.Remarks = domesticLawsRegulations.Remarks;
db.SubmitChanges();
}
}
///
/// 根据主键删除国内法律法规相关条款
///
///
public static void DeleteDomesticLawsRegulationsById(string domesticLawsRegulationsId)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_FileControl_DomesticLawsRegulations DomesticLawsRegulations = db.HJGL_FileControl_DomesticLawsRegulations.FirstOrDefault(e => e.DomesticLawsRegulationsId == domesticLawsRegulationsId);
if (DomesticLawsRegulations != null)
{
if (!string.IsNullOrEmpty(DomesticLawsRegulations.AttachUrl))
{
BLL.UploadFileService.DeleteFile(Funs.RootPath, DomesticLawsRegulations.AttachUrl);//删除附件
}
BLL.AttachFileService.DeleteAttachFile(Funs.RootPath, domesticLawsRegulationsId, Const.HJGLServer_DomesticLawsRegulationsMenuId);//删除附件
db.HJGL_FileControl_DomesticLawsRegulations.DeleteOnSubmit(DomesticLawsRegulations);
db.SubmitChanges();
}
}
}
}