示例#1
0
        /// <summary>
        /// 删除会议时使用
        /// </summary>
        /// <param name="agendaID"></param>
        /// <returns></returns>
        public Status deleteAll(int agendaID)
        {
            Dictionary <string, object> wherelist = new Dictionary <string, object>();
            VoteDAO       voteDao       = Factory.getInstance <VoteDAO>();
            VoteOptionDAO voteOptionDao = Factory.getInstance <VoteOptionDAO>();

            wherelist.Add("agendaID", agendaID);

            var voteVolist = voteDao.getAll <VoteVO>(wherelist);

            if (voteVolist != null)
            {
                foreach (var voteVo in voteVolist)
                {
                    wherelist.Clear();
                    wherelist.Add("voteID", voteVo.voteID);
                    voteOptionDao.delete(wherelist);
                }
            }

            wherelist.Clear();
            wherelist.Add("agendaID", agendaID);

            voteDao.delete(wherelist);//删除表决
            return(Status.SUCCESS);
        }
示例#2
0
        public Status deleteMultipe(List <int> votes)
        {
            if (votes == null || votes.Count == 0)
            {
                return(Status.SUCCESS);
            }

            VoteDAO       voteDao                 = Factory.getInstance <VoteDAO>();
            VoteOptionDAO voteOptionDao           = Factory.getInstance <VoteOptionDAO>();
            AgendaDAO     agendaDao               = Factory.getInstance <AgendaDAO>();
            Dictionary <string, object> wherelist = new Dictionary <string, object>();

            foreach (int voteID in votes)
            {
                //获取表决信息
                VoteVO voteVo = voteDao.getOne <VoteVO>(voteID);
                if (voteVo == null)
                {
                    continue;
                }

                //判断投票是否未开启,如果 不是”未开启“,直接退出
                if (!IsNotOpen_Vote(voteVo.voteStatus))
                {
                    return(Status.FAILURE);
                }

                //获取议程信息
                AgendaVO agendaVo = agendaDao.getOne <AgendaVO>(voteVo.agendaID);
                if (agendaVo == null)
                {
                    continue;
                }

                //初始化会场操作
                meeting_initOperator(agendaVo.meetingID);

                //判断会议是否 未开启,如果 不是”未开启“,直接退出
                if (!meeting_isNotOpen())
                {
                    return(Status.FAILURE);
                }
                //删除选项
                wherelist.Clear();
                wherelist.Add("voteID", voteID);
                voteOptionDao.delete(wherelist);

                //更新其他投票的序号信息
                voteDao.updateIndex(voteVo.agendaID, voteVo.voteIndex);
                //删除当前投票
                voteDao.delete(voteVo.voteID);
            }
            return(Status.SUCCESS);
        }