using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { /// /// 其他会议记录 /// public static class AttendMeetingService { public static Model.SGGLDB db = Funs.DB; /// /// 根据主键获取其他会议记录 /// /// /// public static Model.Meeting_AttendMeeting GetAttendMeetingById(string attendMeetingId) { return Funs.DB.Meeting_AttendMeeting.FirstOrDefault(e => e.AttendMeetingId == attendMeetingId); } /// /// 根据时间段获取其他会议集合 /// /// /// /// /// public static int GetCountByTime(DateTime startTime, DateTime endTime, string projectId) { return (from x in Funs.DB.Meeting_AttendMeeting where x.AttendMeetingDate >= startTime && x.AttendMeetingDate < endTime && x.ProjectId == projectId select x).Count(); } /// /// 根据日期和类型获取会议记录集合 /// /// 开始时间 /// 结束时间 /// 项目号 /// 会议记录集合 public static List GetMeetingListsByDate(DateTime startTime, DateTime endTime, string projectId) { return (from x in Funs.DB.Meeting_AttendMeeting where x.AttendMeetingDate >= startTime && x.AttendMeetingDate <= endTime && x.ProjectId == projectId orderby x.AttendMeetingDate select x).ToList(); } /// /// 添加其他会议记录 /// /// public static void AddAttendMeeting(Model.Meeting_AttendMeeting attendMeeting) { Model.SGGLDB db = Funs.DB; Model.Meeting_AttendMeeting newAttendMeeting = new Model.Meeting_AttendMeeting { AttendMeetingId = attendMeeting.AttendMeetingId, ProjectId = attendMeeting.ProjectId, UnitId = attendMeeting.UnitId, AttendMeetingCode = attendMeeting.AttendMeetingCode, AttendMeetingName = attendMeeting.AttendMeetingName, AttendMeetingDate = attendMeeting.AttendMeetingDate, CompileMan = attendMeeting.CompileMan, AttendMeetingContents = attendMeeting.AttendMeetingContents, CompileDate = attendMeeting.CompileDate, States = attendMeeting.States, MeetingHours = attendMeeting.MeetingHours, MeetingHostMan = attendMeeting.MeetingHostMan, AttentPerson = attendMeeting.AttentPerson, MeetingPlace = attendMeeting.MeetingPlace, MeetingHostManId = attendMeeting.MeetingHostManId, AttentPersonIds=attendMeeting.AttentPersonIds, AttentPersonNum = attendMeeting.AttentPersonNum, MeetingHostManOther=attendMeeting.MeetingHostManOther }; db.Meeting_AttendMeeting.InsertOnSubmit(attendMeeting); db.SubmitChanges(); ////增加一条编码记录 CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectAttendMeetingMenuId, attendMeeting.ProjectId, null, attendMeeting.AttendMeetingId, attendMeeting.CompileDate); } public static void AddAttendMeetingForApi(Model.Meeting_AttendMeeting attendMeeting) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { Model.Meeting_AttendMeeting newAttendMeeting = new Model.Meeting_AttendMeeting { AttendMeetingId = attendMeeting.AttendMeetingId, ProjectId = attendMeeting.ProjectId, UnitId = attendMeeting.UnitId, AttendMeetingCode = attendMeeting.AttendMeetingCode, AttendMeetingName = attendMeeting.AttendMeetingName, AttendMeetingDate = attendMeeting.AttendMeetingDate, CompileMan = attendMeeting.CompileMan, AttendMeetingContents = attendMeeting.AttendMeetingContents, CompileDate = attendMeeting.CompileDate, States = attendMeeting.States, MeetingHours = attendMeeting.MeetingHours, MeetingHostMan = attendMeeting.MeetingHostMan, AttentPerson = attendMeeting.AttentPerson, MeetingPlace = attendMeeting.MeetingPlace, MeetingHostManId = attendMeeting.MeetingHostManId, AttentPersonIds = attendMeeting.AttentPersonIds, AttentPersonNum = attendMeeting.AttentPersonNum, MeetingHostManOther = attendMeeting.MeetingHostManOther }; db.Meeting_AttendMeeting.InsertOnSubmit(attendMeeting); db.SubmitChanges(); ////增加一条编码记录 CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectAttendMeetingMenuId, attendMeeting.ProjectId, null, attendMeeting.AttendMeetingId, attendMeeting.CompileDate); } } /// /// 修改其他会议记录 /// /// public static void UpdateAttendMeeting(Model.Meeting_AttendMeeting attendMeeting) { Model.SGGLDB db = Funs.DB; Model.Meeting_AttendMeeting newAttendMeeting = db.Meeting_AttendMeeting.FirstOrDefault(e => e.AttendMeetingId == attendMeeting.AttendMeetingId); if (newAttendMeeting != null) { //newAttendMeeting.ProjectId = attendMeeting.ProjectId; newAttendMeeting.UnitId = attendMeeting.UnitId; newAttendMeeting.AttendMeetingCode = attendMeeting.AttendMeetingCode; newAttendMeeting.AttendMeetingName = attendMeeting.AttendMeetingName; newAttendMeeting.AttendMeetingDate = attendMeeting.AttendMeetingDate; newAttendMeeting.CompileMan = attendMeeting.CompileMan; newAttendMeeting.AttendMeetingContents = attendMeeting.AttendMeetingContents; newAttendMeeting.CompileDate = attendMeeting.CompileDate; newAttendMeeting.States = attendMeeting.States; newAttendMeeting.MeetingHours = attendMeeting.MeetingHours; newAttendMeeting.MeetingHostMan = attendMeeting.MeetingHostMan; newAttendMeeting.AttentPerson = attendMeeting.AttentPerson; newAttendMeeting.MeetingPlace = attendMeeting.MeetingPlace; newAttendMeeting.MeetingHostManId = attendMeeting.MeetingHostManId; newAttendMeeting.AttentPersonIds = attendMeeting.AttentPersonIds; newAttendMeeting.MeetingHostManOther = attendMeeting.MeetingHostManOther; newAttendMeeting.AttentPersonNum = attendMeeting.AttentPersonNum; db.SubmitChanges(); } } public static void UpdateAttendMeetingForApi(Model.Meeting_AttendMeeting attendMeeting) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { Model.Meeting_AttendMeeting newAttendMeeting = db.Meeting_AttendMeeting.FirstOrDefault(e => e.AttendMeetingId == attendMeeting.AttendMeetingId); if (newAttendMeeting != null) { //newAttendMeeting.ProjectId = attendMeeting.ProjectId; newAttendMeeting.UnitId = attendMeeting.UnitId; newAttendMeeting.AttendMeetingCode = attendMeeting.AttendMeetingCode; newAttendMeeting.AttendMeetingName = attendMeeting.AttendMeetingName; newAttendMeeting.AttendMeetingDate = attendMeeting.AttendMeetingDate; newAttendMeeting.CompileMan = attendMeeting.CompileMan; newAttendMeeting.AttendMeetingContents = attendMeeting.AttendMeetingContents; newAttendMeeting.CompileDate = attendMeeting.CompileDate; newAttendMeeting.States = attendMeeting.States; newAttendMeeting.MeetingHours = attendMeeting.MeetingHours; newAttendMeeting.MeetingHostMan = attendMeeting.MeetingHostMan; newAttendMeeting.AttentPerson = attendMeeting.AttentPerson; newAttendMeeting.MeetingPlace = attendMeeting.MeetingPlace; newAttendMeeting.MeetingHostManId = attendMeeting.MeetingHostManId; newAttendMeeting.AttentPersonIds = attendMeeting.AttentPersonIds; newAttendMeeting.MeetingHostManOther = attendMeeting.MeetingHostManOther; newAttendMeeting.AttentPersonNum = attendMeeting.AttentPersonNum; db.SubmitChanges(); } } } /// /// 根据主键删除其他会议记录 /// /// public static void DeleteAttendMeetingById(string attendMeetingId) { Model.SGGLDB db = Funs.DB; Model.Meeting_AttendMeeting attendMeeting = db.Meeting_AttendMeeting.FirstOrDefault(e => e.AttendMeetingId == attendMeetingId); if (attendMeeting != null) { ///删除编码表记录 BLL.CodeRecordsService.DeleteCodeRecordsByDataId(attendMeetingId); BLL.CommonService.DeleteAttachFileById(attendMeetingId);//删除附件 ////删除流程表 BLL.CommonService.DeleteFlowOperateByID(attendMeeting.AttendMeetingId); db.Meeting_AttendMeeting.DeleteOnSubmit(attendMeeting); db.SubmitChanges(); } } } }