//为参会人员提供用户列表//排除已有参会人员 public Status getNewForDelegate(int meetingID, out List <UserForDelegate> users) { users = new List <UserForDelegate>(); PersonDAO personDao = Factory.getInstance <PersonDAO>(); DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>(); Dictionary <string, object> wherelist = new Dictionary <string, object>(); wherelist.Clear(); wherelist.Add("meetingID", meetingID); var delegateVolist = delegateDao.getAll <DelegateVO>(wherelist); wherelist.Clear(); wherelist.Add("personState", 0); //获取未冻结的用户信息 List <PersonVO> personVolist = personDao.getAll <PersonVO>(wherelist); if (personVolist == null || personVolist.Count == 0) { return(Status.NONFOUND); } foreach (PersonVO vo in personVolist) { DelegateVO delegateVoTemp = null; if (delegateVolist != null) { foreach (var delegateVo in delegateVolist) { if (delegateVo.personID == vo.personID) { delegateVoTemp = delegateVo; break; } } } if (delegateVoTemp == null) { users.Add( new UserForDelegate { userID = vo.personID, userName = vo.personName }); } } return(Status.SUCCESS); }
public Status getSpeakerForAgenda(int meetingID, out List <SpeakerForAgenda> speakers) { speakers = new List <SpeakerForAgenda>(); //获取会议中的全部主讲人和主持人 Dictionary <string, object> wherelist = new Dictionary <string, object>(); wherelist.Add("meetingID", meetingID); //wherelist.Add("personMeetingRole", 2);//主讲人 DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>(); List <DelegateVO> delegateVolist = delegateDao.getAll <DelegateVO>(wherelist); delegateVolist.RemoveAll(x => { if (x.personMeetingRole == 1 || x.personMeetingRole == 2) { return(false); } else { return(true); } }); if (delegateVolist == null) { return(Status.NONFOUND); } PersonDAO personDao = Factory.getInstance <PersonDAO>(); //将信息插入返回值 foreach (DelegateVO delegateVo in delegateVolist) { //获取主讲人信息 PersonVO personVo = personDao.getOne <PersonVO>(delegateVo.personID); if (personVo == null) { continue; } speakers.Add( new SpeakerForAgenda { userID = personVo.personID, userName = personVo.personName }); } return(Status.SUCCESS); }
/// <summary> /// 获取指定会议的参会人员 /// </summary> /// <param name="meetingID"></param> /// <param name="delegates"></param> /// <returns></returns> public Status getAll(int meetingID, out List <DelegateInfo> delegates) { delegates = new List <DelegateInfo>(); DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>(); DeviceDAO deviceDao = Factory.getInstance <DeviceDAO>(); PersonDAO personDao = Factory.getInstance <PersonDAO>(); Dictionary <string, object> wherelist = new Dictionary <string, object>(); wherelist.Add("meetingID", meetingID); List <DelegateVO> delegateVos = delegateDao.getAll <DelegateVO>(wherelist); if (delegateVos == null) { return(Status.NONFOUND); } foreach (DelegateVO delegateVo in delegateVos) { //获取设备信息 DeviceVO deviceVo = deviceDao.getOne <DeviceVO>(delegateVo.deviceID); //获取用户信息 PersonVO personVo = personDao.getOne <PersonVO>(delegateVo.personID); if (deviceVo == null || personVo == null) { return(Status.FAILURE); } delegates.Add( new DelegateInfo { delegateID = delegateVo.delegateID, userDepartment = personVo.personDepartment, meetingID = meetingID, userName = personVo.personName, userJob = personVo.personJob, userMeetingRole = delegateVo.personMeetingRole, deviceID = deviceVo.deviceID, deviceIndex = deviceVo.deviceIndex }); } return(Status.SUCCESS); }
public Status getAllForDelegate(DateTime start, DateTime end, out List <DeviceForDelegate> list) { list = new List <DeviceForDelegate>(); MeetingDAO meetingDao = Factory.getInstance <MeetingDAO>(); DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>(); DeviceDAO deviceDao = Factory.getInstance <DeviceDAO>(); Dictionary <string, object> wherelist = new Dictionary <string, object>(); List <MeetingVO> meetingVolist = meetingDao.getAll <MeetingVO>(); int dx; if (ConfigurationManager.AppSettings["DeviceOccupyTimeInterval"] == null) { dx = 30; } else { dx = Int32.Parse(ConfigurationManager.AppSettings["DeviceOccupyTimeInterval"]); if (dx < 1) { dx = 30; } } var tempMeetings = meetingVolist .Where( //包括与本次会议在几乎同一时间开启或结束的会议 m => (Math.Abs((m.meetingToStartTime - start).TotalMinutes) < dx || Math.Abs((m.meetingToStartTime - end).TotalMinutes) < dx || Math.Abs((m.meetingStartedTime - start).TotalMinutes) < dx || Math.Abs((m.meetingStartedTime - end).TotalMinutes) < dx) ) //包括已开或正在开启的会议 .Where(m => m.meetingStatus == 1 || m.meetingStatus == 2); wherelist.Clear(); //只允许未冻结的设备作为参会设备 wherelist.Add("deviceState", 0); var deviceVolist = deviceDao.getAll <DeviceVO>(wherelist); if (tempMeetings != null && deviceVolist != null) { var meetinglist = tempMeetings.ToList(); foreach (var meetingvo in meetinglist) { wherelist.Clear(); wherelist.Add("meetingID", meetingvo.meetingID); var delegateVolist = delegateDao.getAll <DelegateVO>(wherelist); if (delegateVolist != null) { foreach (var delegateVo in delegateVolist) { for (int i = 0; i < deviceVolist.Count; i++) { if (deviceVolist[i].deviceID == delegateVo.deviceID) { //去除已使用的设备 deviceVolist.RemoveAt(i); break; } } } } } } if (deviceVolist != null) { foreach (var devicevo in deviceVolist) { list.Add(new DeviceForDelegate { deviceID = devicevo.deviceID, deviceIndex = devicevo.deviceIndex }); } } return(Status.SUCCESS); }