CNCEC_SUBQHSE_WUHUAN/SGGL/BLL/Party/CommentPartyerService.cs

76 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
/// <summary>
/// 民主评议党员
/// </summary>
public class CommentPartyerService
{
/// <summary>
/// 根据主键获取民主评议党员
/// </summary>
/// <param name="commentPartyerId"></param>
/// <returns></returns>
public static Model.Party_CommentPartyer GetCommentPartyerById(string commentPartyerId)
{
return Funs.DB.Party_CommentPartyer.FirstOrDefault(e => e.CommentPartyerId == commentPartyerId);
}
/// <summary>
/// 添加民主评议党员
/// </summary>
/// <param name="commentPartyer"></param>
public static void AddCommentPartyer(Model.Party_CommentPartyer commentPartyer)
{
Model.Party_CommentPartyer newCommentPartyer = new Model.Party_CommentPartyer
{
CommentPartyerId = commentPartyer.CommentPartyerId,
Year = commentPartyer.Year,
ProjectId = commentPartyer.ProjectId,
Partyers = commentPartyer.Partyers,
Host=commentPartyer.Host,
CompileMan = commentPartyer.CompileMan,
CompileDate = commentPartyer.CompileDate
};
Funs.DB.Party_CommentPartyer.InsertOnSubmit(newCommentPartyer);
Funs.DB.SubmitChanges();
}
/// <summary>
/// 修改民主评议党员
/// </summary>
/// <param name="commentPartyer"></param>
public static void UpdateCommentPartyer(Model.Party_CommentPartyer commentPartyer)
{
Model.Party_CommentPartyer newCommentPartyer = Funs.DB.Party_CommentPartyer.FirstOrDefault(e => e.CommentPartyerId == commentPartyer.CommentPartyerId);
if (newCommentPartyer != null)
{
newCommentPartyer.ProjectId = commentPartyer.ProjectId;
newCommentPartyer.Partyers = commentPartyer.Partyers;
newCommentPartyer.Host = commentPartyer.Host;
Funs.DB.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除民主评议党员
/// </summary>
/// <param name="commentPartyerId"></param>
public static void DeleteCommentPartyerById(string commentPartyerId)
{
Model.Party_CommentPartyer commentPartyer = Funs.DB.Party_CommentPartyer.FirstOrDefault(e => e.CommentPartyerId == commentPartyerId);
if (commentPartyer != null)
{
CommonService.DeleteAttachFileById(commentPartyerId);
Funs.DB.Party_CommentPartyer.DeleteOnSubmit(commentPartyer);
Funs.DB.SubmitChanges();
}
}
}
}