Example #1
0
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="delegates"></param>
        /// <returns></returns>
        public Status deleteMultipe(List <int> delegates)
        {
            if (delegates == null || delegates.Count == 0)
            {
                return(Status.SUCCESS);
            }

            //用于出错后恢复数据
            var    backup = new List <DelegateVO>();
            Status status = Status.SUCCESS;

            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();
            AgendaDAO   agendaDao   = Factory.getInstance <AgendaDAO>();

            foreach (int delegateID in delegates)
            {
                DelegateVO delegateVo = delegateDao.getOne <DelegateVO>(delegateID);
                if (delegateVo == null)
                {
                    status = Status.NONFOUND;
                }

                //初始化会议操作
                meeting_initOperator(delegateVo.meetingID);
                //判断会议是否开启,如果不是”未开启“,直接退出
                if (!meeting_isNotOpen())
                {
                    status = Status.MEETING_OPENING;
                    break;
                }

                Dictionary <string, object> wherelist = new Dictionary <string, object>();
                //检查是否为主讲人,且是否存在主讲的议程,如果存在,直接返回
                wherelist.Clear();
                wherelist.Add("meetingID", delegateVo.meetingID);
                wherelist.Add("personID", delegateVo.personID);
                var tempAgenda = agendaDao.getAll <AgendaVO>(wherelist);
                if (tempAgenda != null && tempAgenda.Count > 0)
                {
                    status = Status.DELEGATE_USED;
                    break;
                }

                backup.Add(delegateVo);
                if (delegateDao.delete(delegateID) < 0)//删除失败就 恢复数据,返回
                {
                    status = Status.FAILURE;
                    break;
                }
            }
            if (status != Status.SUCCESS)
            {
                foreach (var delegateVo in backup)
                {
                    delegateDao.insert <DelegateVO>(delegateVo);
                }
            }
            return(status);
        }
Example #2
0
        /// <summary>
        /// 更新参会人员信息
        /// </summary>
        /// <param name="updateDelegate"></param>
        /// <returns></returns>
        public Status update(UpdateDelegate updateDelegate)
        {
            //初始化会议操作
            meeting_initOperator(updateDelegate.meetingID);
            //验证当前用户的更新当前会议权限

            //判断会议是否开启,如果正在开启,直接退出
            if (meeting_isOpening())
            {
                return(Status.MEETING_OPENING);
            }
            else if (meeting_isOpended())//如果会议已结束,直接退出
            {
                return(Status.FAILURE);
            }

            //更新参会人员信息
            DelegateDAO delegateDao = Factory.getInstance <DelegateDAO>();
            AgendaDAO   agendaDao   = Factory.getInstance <AgendaDAO>();
            DelegateVO  delegateVo  = delegateDao.getOne <DelegateVO>(updateDelegate.delegateID);

            if (delegateVo == null)
            {
                return(Status.NONFOUND);
            }

            Dictionary <string, object> wherelist = new Dictionary <string, object>();

            //检查是否存在主讲的议程,如果存在,直接返回
            wherelist.Clear();
            wherelist.Add("meetingID", delegateVo.meetingID);
            wherelist.Add("personID", delegateVo.personID);
            var tempAgenda = agendaDao.getAll <DelegateVO>(wherelist);

            if (tempAgenda != null && tempAgenda.Count > 0)
            {
                return(Status.DELEGATE_USED);
            }

            //此处限制某一设备在一个会议中,如果已经分配,则无法改变其分配情况,
            //但现在,需要交换同一个会议中的两台已分配的设备,故删去此限制
            //if(delegateVo.deviceID!=updateDelegate.deviceID)//设备改变
            //{
            //    wherelist.Clear();
            //    wherelist.Add("meetingID", updateDelegate.meetingID);
            //    wherelist.Add("deviceID", updateDelegate.deviceID);
            //    if (!unique<DelegateDAO, DelegateVO>(wherelist))
            //    {
            //        return Status.DEVICE_OCCUPY;
            //    }
            //}


            Dictionary <string, object> setlist = new Dictionary <string, object>();

            setlist.Add("deviceID", updateDelegate.deviceID);
            setlist.Add("personMeetingRole", updateDelegate.userMeetingRole);

            if (delegateDao.update(setlist, updateDelegate.delegateID) < 0)
            {
                return(Status.FAILURE);
            }

            return(Status.SUCCESS);
        }