Basf_TCC11/HJGL/BLL/PublicInfo/FileControl/FileControl_DomesticLawsReg...

78 lines
4.2 KiB
C#

using System.Linq;
namespace BLL
{
/// <summary>
/// 国内法律法规相关条款
/// </summary>
public static class FileControl_DomesticLawsRegulationsService
{
/// <summary>
/// 根据主键获取国内法律法规相关条款
/// </summary>
/// <param name="domesticLawsRegulationsId"></param>
/// <returns></returns>
public static Model.FileControl_DomesticLawsRegulations GetDomesticLawsRegulationsById(string domesticLawsRegulationsId)
{
return Funs.DB.FileControl_DomesticLawsRegulations.FirstOrDefault(e => e.DomesticLawsRegulationsId == domesticLawsRegulationsId);
}
/// <summary>
/// 添加国内法律法规相关条款
/// </summary>
/// <param name="domesticLawsRegulations"></param>
public static void AddDomesticLawsRegulations(Model.FileControl_DomesticLawsRegulations domesticLawsRegulations)
{
Model.HJGLDB db = Funs.DB;
Model.FileControl_DomesticLawsRegulations newDomesticLawsRegulations = new Model.FileControl_DomesticLawsRegulations();
newDomesticLawsRegulations.DomesticLawsRegulationsId = domesticLawsRegulations.DomesticLawsRegulationsId;
newDomesticLawsRegulations.DomesticLawsRegulationsCode = domesticLawsRegulations.DomesticLawsRegulationsCode;
newDomesticLawsRegulations.DomesticLawsRegulationsName = domesticLawsRegulations.DomesticLawsRegulationsName;
newDomesticLawsRegulations.Abstract = domesticLawsRegulations.Abstract;
newDomesticLawsRegulations.CompileMan = domesticLawsRegulations.CompileMan;
newDomesticLawsRegulations.CompileDate = domesticLawsRegulations.CompileDate;
newDomesticLawsRegulations.Remarks = domesticLawsRegulations.Remarks;
newDomesticLawsRegulations.AttachUrl = domesticLawsRegulations.AttachUrl;
db.FileControl_DomesticLawsRegulations.InsertOnSubmit(newDomesticLawsRegulations);
db.SubmitChanges();
}
/// <summary>
/// 修改国内法律法规相关条款
/// </summary>
/// <param name="domesticLawsRegulations"></param>
public static void UpdateDomesticLawsRegulations(Model.FileControl_DomesticLawsRegulations domesticLawsRegulations)
{
Model.HJGLDB db = Funs.DB;
Model.FileControl_DomesticLawsRegulations newDomesticLawsRegulations = db.FileControl_DomesticLawsRegulations.FirstOrDefault(e => e.DomesticLawsRegulationsId == domesticLawsRegulations.DomesticLawsRegulationsId);
if (newDomesticLawsRegulations != null)
{
newDomesticLawsRegulations.DomesticLawsRegulationsCode = domesticLawsRegulations.DomesticLawsRegulationsCode;
newDomesticLawsRegulations.DomesticLawsRegulationsName = domesticLawsRegulations.DomesticLawsRegulationsName;
newDomesticLawsRegulations.Abstract = domesticLawsRegulations.Abstract;
newDomesticLawsRegulations.CompileMan = domesticLawsRegulations.CompileMan;
newDomesticLawsRegulations.CompileDate = domesticLawsRegulations.CompileDate;
newDomesticLawsRegulations.Remarks = domesticLawsRegulations.Remarks;
newDomesticLawsRegulations.AttachUrl = domesticLawsRegulations.AttachUrl;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除国内法律法规相关条款
/// </summary>
/// <param name="domesticLawsRegulationsId"></param>
public static void DeleteDomesticLawsRegulationsById(string domesticLawsRegulationsId)
{
Model.HJGLDB db = Funs.DB;
Model.FileControl_DomesticLawsRegulations domesticLawsRegulations = db.FileControl_DomesticLawsRegulations.FirstOrDefault(e => e.DomesticLawsRegulationsId == domesticLawsRegulationsId);
if (domesticLawsRegulations != null)
{
BLL.AttachFileService.DeleteAttachFile(Funs.RootPath, domesticLawsRegulationsId, Const.DomesticLawsRegulationsMenuId);//删除附件
db.FileControl_DomesticLawsRegulations.DeleteOnSubmit(domesticLawsRegulations);
db.SubmitChanges();
}
}
}
}