using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { public class MeetingSortBService { public static Model.SGGLDB db = Funs.DB; /// /// 根据月报告主键获取所有月报告HSE会议情况信息 /// /// 月报告主键 /// public static List GetMeetingSortsByMonthReportId(string monthReportId) { return (from x in Funs.DB.Manager_MeetingSortB where x.MonthReportId == monthReportId select x).ToList(); } public static Model.Manager_MeetingSortB GetMeetingSortsByMonthReportIdAndMeetingType(string monthReportId, string meetingType) { return (from x in Funs.DB.Manager_MeetingSortB where x.MonthReportId == monthReportId && x.MeetingType == meetingType select x).FirstOrDefault(); } /// /// 根据月报告主键获取总会议次数 /// /// 会议类型 /// 月报告主键 /// public static decimal? GetSumMeetingNumberByMonthReportId(string monthReportId, string meetingType) { return (from x in Funs.DB.Manager_MeetingSortB where x.MonthReportId == monthReportId && x.MeetingType == meetingType select x.MeetingNumber).Sum(); } /// /// 根据月报告主键获取总参加人数 /// /// 会议类型 /// 月报告主键 /// public static decimal? GetSumMeetingPersonNumberByMonthReportId(string monthReportId, string meetingType) { return (from x in Funs.DB.Manager_MeetingSortB where x.MonthReportId == monthReportId && x.MeetingType == meetingType select x.MeetingPersonNumber).Sum(); } /// /// 增加月报告HSE会议情况信息 /// /// 月报告HSE会议情况实体 public static void AddMeetingSort(Model.Manager_MeetingSortB meetingSort) { Model.SGGLDB db = Funs.DB; string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_MeetingSortB)); Model.Manager_MeetingSortB newMeetingSort = new Model.Manager_MeetingSortB { MeetingSortId = newKeyID, MonthReportId = meetingSort.MonthReportId, MeetingType = meetingSort.MeetingType, MeetingNumber = meetingSort.MeetingNumber, TotalMeetingNum = meetingSort.TotalMeetingNum, MeetingPersonNumber = meetingSort.MeetingPersonNumber, TotalMeetingPersonNum = meetingSort.TotalMeetingPersonNum }; db.Manager_MeetingSortB.InsertOnSubmit(newMeetingSort); db.SubmitChanges(); } /// /// 根据月报告主键删除对应的所有月报告HSE会议情况信息 /// /// 月报告主键 public static void DeleteMeetingSortsByMonthReportId(string monthReportId) { var q = (from x in db.Manager_MeetingSortB where x.MonthReportId == monthReportId select x).ToList(); db.Manager_MeetingSortB.DeleteAllOnSubmit(q); db.SubmitChanges(); } } }