74 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			74 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Text; | |||
|  | using System.Threading.Tasks; | |||
|  | 
 | |||
|  | namespace BLL | |||
|  | { | |||
|  |     /// <summary> | |||
|  |     /// 党课 | |||
|  |     /// </summary> | |||
|  |     public class PartyLectureService | |||
|  |     { | |||
|  |         /// <summary> | |||
|  |         /// 根据主键获取党课 | |||
|  |         /// </summary> | |||
|  |         /// <param name="partyLectureId"></param> | |||
|  |         /// <returns></returns> | |||
|  |         public static Model.Party_PartyLecture GetPartyLectureById(string partyLectureId) | |||
|  |         { | |||
|  |             return Funs.DB.Party_PartyLecture.FirstOrDefault(e => e.PartyLectureId == partyLectureId); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 添加党课 | |||
|  |         /// </summary> | |||
|  |         /// <param name="partyLecture"></param> | |||
|  |         public static void AddPartyLecture(Model.Party_PartyLecture partyLecture) | |||
|  |         { | |||
|  |             Model.Party_PartyLecture newPartyLecture = new Model.Party_PartyLecture | |||
|  |             { | |||
|  |                 PartyLectureId = partyLecture.PartyLectureId, | |||
|  |                 Year = partyLecture.Year, | |||
|  |                 Quarter = partyLecture.Quarter, | |||
|  |                 CompileMan = partyLecture.CompileMan, | |||
|  |                 CompileDate = partyLecture.CompileDate | |||
|  |             }; | |||
|  |             Funs.DB.Party_PartyLecture.InsertOnSubmit(newPartyLecture); | |||
|  |             Funs.DB.SubmitChanges(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 修改党课 | |||
|  |         /// </summary> | |||
|  |         /// <param name="partyLecture"></param> | |||
|  |         public static void UpdatePartyLecture(Model.Party_PartyLecture partyLecture) | |||
|  |         { | |||
|  |             Model.Party_PartyLecture newPartyLecture = Funs.DB.Party_PartyLecture.FirstOrDefault(e => e.PartyLectureId == partyLecture.PartyLectureId); | |||
|  |             if (newPartyLecture != null) | |||
|  |             { | |||
|  |                 newPartyLecture.Quarter = partyLecture.Quarter; | |||
|  |                 Funs.DB.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据主键删除党课 | |||
|  |         /// </summary> | |||
|  |         /// <param name="partyLectureId"></param> | |||
|  |         public static void DeletePartyLectureById(string partyLectureId) | |||
|  |         { | |||
|  |             Model.Party_PartyLecture partyLecture = Funs.DB.Party_PartyLecture.FirstOrDefault(e => e.PartyLectureId == partyLectureId); | |||
|  |             if (partyLecture != null) | |||
|  |             { | |||
|  |                 CommonService.DeleteAttachFileById(partyLectureId); | |||
|  |                 CommonService.DeleteAttachFileById(partyLectureId + "2"); | |||
|  |                 CommonService.DeleteAttachFileById(partyLectureId + "3"); | |||
|  |                 Funs.DB.Party_PartyLecture.DeleteOnSubmit(partyLecture); | |||
|  |                 Funs.DB.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  |     } | |||
|  | } |