Esempio n. 1
0
        public LabMS.Model.VoteItemJson GetJsonModel(int id)
        {
            LabMS.Model.VoteItemJson json = new LabMS.Model.VoteItemJson();

            LabMS.Model.VoteItem voteItemInfo = base.GetModel(id);

            if (voteItemInfo == null)
            {
                return null;
            }

            VoteAnswer voteAnswer = new VoteAnswer();

            json.ID = id;
            json.Title = voteItemInfo.VoteItemContent;
            json.Answers = voteAnswer.GetJsonAnswers(id);

            return json;
        }
Esempio n. 2
0
        /// <summary>
        /// ��ȡ�������������µ�������
        /// </summary>
        /// <param name="voteID"></param>
        /// <returns></returns>
        public List<LabMS.Model.VoteItemJson> GetJsonVoteItems(int voteID)
        {
            List<LabMS.Model.VoteItemJson> items = new List<LabMS.Model.VoteItemJson>();

            List<LabMS.Model.VoteItem> voteItems = base.GetModelList(" [VoteID] = " + voteID);

            VoteAnswer voteAnswer = new VoteAnswer();

            foreach (LabMS.Model.VoteItem voteItem in voteItems)
            {
                LabMS.Model.VoteItemJson json = new LabMS.Model.VoteItemJson();

                json.ID = voteItem.key;
                json.Title = voteItem.VoteItemContent;
                json.Answers = voteAnswer.GetJsonAnswers(json.ID);

                items.Add(json);
            }

            return items;
        }