CNCEC_SUBQHSE_WUHUAN/SGGL/BLL/Party/LastWorkSummaryService.cs

70 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
/// <summary>
/// 上年度党建工作总结
/// </summary>
public class LastWorkSummaryService
{
/// <summary>
/// 根据主键获取上年度党建工作总结
/// </summary>
/// <param name="lastWorkSummaryId"></param>
/// <returns></returns>
public static Model.Party_LastWorkSummary GetLastWorkSummaryById(string lastWorkSummaryId)
{
return Funs.DB.Party_LastWorkSummary.FirstOrDefault(e => e.LastWorkSummaryId == lastWorkSummaryId);
}
/// <summary>
/// 添加上年度党建工作总结
/// </summary>
/// <param name="lastWorkSummary"></param>
public static void AddLastWorkSummary(Model.Party_LastWorkSummary lastWorkSummary)
{
Model.Party_LastWorkSummary newLastWorkSummary = new Model.Party_LastWorkSummary
{
LastWorkSummaryId = lastWorkSummary.LastWorkSummaryId,
Year = lastWorkSummary.Year,
CompileMan = lastWorkSummary.CompileMan,
CompileDate = lastWorkSummary.CompileDate
};
Funs.DB.Party_LastWorkSummary.InsertOnSubmit(newLastWorkSummary);
Funs.DB.SubmitChanges();
}
/// <summary>
/// 修改上年度党建工作总结
/// </summary>
/// <param name="lastWorkSummary"></param>
public static void UpdateLastWorkSummary(Model.Party_LastWorkSummary lastWorkSummary)
{
Model.Party_LastWorkSummary newLastWorkSummary = Funs.DB.Party_LastWorkSummary.FirstOrDefault(e => e.LastWorkSummaryId == lastWorkSummary.LastWorkSummaryId);
if (newLastWorkSummary != null)
{
Funs.DB.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除上年度党建工作总结
/// </summary>
/// <param name="lastWorkSummaryId"></param>
public static void DeleteLastWorkSummaryById(string lastWorkSummaryId)
{
Model.Party_LastWorkSummary lastWorkSummary = Funs.DB.Party_LastWorkSummary.FirstOrDefault(e => e.LastWorkSummaryId == lastWorkSummaryId);
if (lastWorkSummary != null)
{
CommonService.DeleteAttachFileById(lastWorkSummaryId);
Funs.DB.Party_LastWorkSummary.DeleteOnSubmit(lastWorkSummary);
Funs.DB.SubmitChanges();
}
}
}
}