143 lines
		
	
	
		
			7.4 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			143 lines
		
	
	
		
			7.4 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| 
 | |
| namespace BLL
 | |
| {
 | |
|     /// <summary>
 | |
|     /// 企业专题会
 | |
|     /// </summary>
 | |
|     public static class CompanySpecialMeetingService
 | |
|     {
 | |
|         public static Model.SGGLDB db = Funs.DB;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据主键获取企业专题会
 | |
|         /// </summary>
 | |
|         /// <param name="CompanySpecialMeetingId"></param>
 | |
|         /// <returns></returns>
 | |
|         public static Model.Meeting_CompanySpecialMeeting GetCompanySpecialMeetingById(string CompanySpecialMeetingId)
 | |
|         {
 | |
|             return Funs.DB.Meeting_CompanySpecialMeeting.FirstOrDefault(e => e.CompanySpecialMeetingId == CompanySpecialMeetingId);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据时间段获取月例会集合
 | |
|         /// </summary>
 | |
|         /// <param name="startTime"></param>
 | |
|         /// <param name="endTime"></param>
 | |
|         /// <param name="projectId"></param>
 | |
|         /// <returns></returns>
 | |
|         public static int GetCountByTime(DateTime startTime, DateTime endTime)
 | |
|         {
 | |
|             return (from x in Funs.DB.Meeting_CompanySpecialMeeting where x.CompanySpecialMeetingDate >= startTime && x.CompanySpecialMeetingDate < endTime select x).Count();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据时间段获取月例会参会人数
 | |
|         /// </summary>
 | |
|         /// <param name="startTime"></param>
 | |
|         /// <param name="endTime"></param>
 | |
|         /// <param name="projectId"></param>
 | |
|         /// <returns></returns>
 | |
|         public static int? GetSumAttentPersonNumByMeetingDate(DateTime startTime, DateTime endTime)
 | |
|         {
 | |
|             int? sumAttentPersonNum = (from x in Funs.DB.Meeting_CompanySpecialMeeting where x.CompanySpecialMeetingDate >= startTime && x.CompanySpecialMeetingDate < endTime select x.AttentPersonNum).Sum();
 | |
|             if (sumAttentPersonNum == null)
 | |
|             {
 | |
|                 return 0;
 | |
|             }
 | |
|             return sumAttentPersonNum;
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据日期和类型获取会议记录集合
 | |
|         /// </summary>
 | |
|         /// <param name="startTime">开始时间</param>
 | |
|         /// <param name="endTime">结束时间</param>
 | |
|         /// <param name="projectId">项目号</param>
 | |
|         /// <returns>会议记录集合</returns>
 | |
|         public static List<Model.Meeting_CompanySpecialMeeting> GetMeetingListsByDate(DateTime startTime, DateTime endTime)
 | |
|         {
 | |
|             return (from x in Funs.DB.Meeting_CompanySpecialMeeting where x.CompanySpecialMeetingDate >= startTime && x.CompanySpecialMeetingDate <= endTime orderby x.CompanySpecialMeetingDate select x).ToList();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 添加企业专题会
 | |
|         /// </summary>
 | |
|         /// <param name="CompanySpecialMeeting"></param>
 | |
|         public static void AddCompanySpecialMeeting(Model.Meeting_CompanySpecialMeeting CompanySpecialMeeting)
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             Model.Meeting_CompanySpecialMeeting newCompanySpecialMeeting = new Model.Meeting_CompanySpecialMeeting
 | |
|             {
 | |
|                 CompanySpecialMeetingId = CompanySpecialMeeting.CompanySpecialMeetingId,
 | |
|                 CompanySpecialMeetingCode = CompanySpecialMeeting.CompanySpecialMeetingCode,
 | |
|                 CompanySpecialMeetingName = CompanySpecialMeeting.CompanySpecialMeetingName,
 | |
|                 CompanySpecialMeetingDate = CompanySpecialMeeting.CompanySpecialMeetingDate,
 | |
|                 CompileMan = CompanySpecialMeeting.CompileMan,
 | |
|                 CompanySpecialMeetingContents = CompanySpecialMeeting.CompanySpecialMeetingContents,
 | |
|                 CompileDate = CompanySpecialMeeting.CompileDate,
 | |
|                 AttentPersonNum = CompanySpecialMeeting.AttentPersonNum,
 | |
|                 MeetingHours = CompanySpecialMeeting.MeetingHours,
 | |
|                 MeetingHostMan = CompanySpecialMeeting.MeetingHostMan,
 | |
|                 AttentPerson = CompanySpecialMeeting.AttentPerson,
 | |
|                 MeetingPlace = CompanySpecialMeeting.MeetingPlace,
 | |
|                 MeetingHostManId = CompanySpecialMeeting.MeetingHostManId,
 | |
|                 AttentPersonIds = CompanySpecialMeeting.AttentPersonIds,
 | |
|                 MeetingHostManOther = CompanySpecialMeeting.MeetingHostManOther
 | |
|             };
 | |
|             db.Meeting_CompanySpecialMeeting.InsertOnSubmit(newCompanySpecialMeeting);
 | |
|             db.SubmitChanges();
 | |
|             ////增加一条编码记录
 | |
|             BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.CompanySpecialMeetingMenuId, null, null, CompanySpecialMeeting.CompanySpecialMeetingId, CompanySpecialMeeting.CompileDate);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 修改企业专题会
 | |
|         /// </summary>
 | |
|         /// <param name="CompanySpecialMeeting"></param>
 | |
|         public static void UpdateCompanySpecialMeeting(Model.Meeting_CompanySpecialMeeting CompanySpecialMeeting)
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             Model.Meeting_CompanySpecialMeeting newCompanySpecialMeeting = db.Meeting_CompanySpecialMeeting.FirstOrDefault(e => e.CompanySpecialMeetingId == CompanySpecialMeeting.CompanySpecialMeetingId);
 | |
|             if (newCompanySpecialMeeting != null)
 | |
|             {
 | |
|                 newCompanySpecialMeeting.CompanySpecialMeetingCode = CompanySpecialMeeting.CompanySpecialMeetingCode;
 | |
|                 newCompanySpecialMeeting.CompanySpecialMeetingName = CompanySpecialMeeting.CompanySpecialMeetingName;
 | |
|                 newCompanySpecialMeeting.CompanySpecialMeetingDate = CompanySpecialMeeting.CompanySpecialMeetingDate;
 | |
|                 newCompanySpecialMeeting.CompileMan = CompanySpecialMeeting.CompileMan;
 | |
|                 newCompanySpecialMeeting.CompanySpecialMeetingContents = CompanySpecialMeeting.CompanySpecialMeetingContents;
 | |
|                 newCompanySpecialMeeting.CompileDate = CompanySpecialMeeting.CompileDate;
 | |
|                 newCompanySpecialMeeting.AttentPersonNum = CompanySpecialMeeting.AttentPersonNum;
 | |
|                 newCompanySpecialMeeting.MeetingHours = CompanySpecialMeeting.MeetingHours;
 | |
|                 newCompanySpecialMeeting.MeetingHostMan = CompanySpecialMeeting.MeetingHostMan;
 | |
|                 newCompanySpecialMeeting.AttentPerson = CompanySpecialMeeting.AttentPerson;
 | |
|                 newCompanySpecialMeeting.MeetingPlace = CompanySpecialMeeting.MeetingPlace;
 | |
|                 newCompanySpecialMeeting.MeetingHostManId = CompanySpecialMeeting.MeetingHostManId;
 | |
|                 newCompanySpecialMeeting.AttentPersonIds = CompanySpecialMeeting.AttentPersonIds;
 | |
|                 newCompanySpecialMeeting.MeetingHostManOther = CompanySpecialMeeting.MeetingHostManOther;
 | |
|                 db.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据主键删除企业专题会
 | |
|         /// </summary>
 | |
|         /// <param name="CompanySpecialMeetingId"></param>
 | |
|         public static void DeleteCompanySpecialMeetingById(string CompanySpecialMeetingId)
 | |
|         {
 | |
|             Model.SGGLDB db = Funs.DB;
 | |
|             Model.Meeting_CompanySpecialMeeting CompanySpecialMeeting = db.Meeting_CompanySpecialMeeting.FirstOrDefault(e => e.CompanySpecialMeetingId == CompanySpecialMeetingId);
 | |
|             if (CompanySpecialMeeting != null)
 | |
|             {
 | |
|                 ///删除编码表记录
 | |
|                 BLL.CodeRecordsService.DeleteCodeRecordsByDataId(CompanySpecialMeetingId);
 | |
|                 BLL.CommonService.DeleteAttachFileById(CompanySpecialMeetingId);
 | |
|                 db.Meeting_CompanySpecialMeeting.DeleteOnSubmit(CompanySpecialMeeting);
 | |
|                 db.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 |