Example #1
0
        public IList<CY.GFive.Core.Business.VoteRecordDetail> GetVoteRecordDetailByItemAndAnswer(int ItemID, int AnswerID)
        {
            IList<Core.Business.VoteRecordDetail> voteRecordDetaillist = new List<Core.Business.VoteRecordDetail>();
            SqlServerUtility sql = new SqlServerUtility();
            sql.AddParameter("@voteItemID", SqlDbType.Int, ItemID);
            sql.AddParameter("@voteAnswerID", SqlDbType.Int, AnswerID);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetVoteRecordDetailByItemAndAnswer);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.VoteRecordDetail voteRecordDetail = new Core.Business.VoteRecordDetail();

                    if (!reader.IsDBNull(0)) voteRecordDetail.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) voteRecordDetail.VoteRecordID = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) voteRecordDetail.VoteItemID = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) voteRecordDetail.VoteAnswerID = reader.GetInt32(3);

                    voteRecordDetail.MarkOld();
                    voteRecordDetaillist.Add(voteRecordDetail);
                }
                reader.Close();
            }
            return voteRecordDetaillist;
        }
Example #2
0
        public IList<Core.Business.VoteRecordDetail> GetAllVoteRecordDetail()
        {
            IList<Core.Business.VoteRecordDetail> voteRecordDetaillist = new List<Core.Business.VoteRecordDetail>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllVoteRecordDetail);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.VoteRecordDetail voteRecordDetail = new Core.Business.VoteRecordDetail();

                    if (!reader.IsDBNull(0)) voteRecordDetail.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) voteRecordDetail.VoteRecordID = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) voteRecordDetail.VoteItemID = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) voteRecordDetail.VoteAnswerID = reader.GetInt32(3);

                    voteRecordDetail.MarkOld();
                    voteRecordDetaillist.Add(voteRecordDetail);
                }
                reader.Close();
            }
            return voteRecordDetaillist;
        }
Example #3
0
        public IList<VoteRecordDetail> GetVoteRecordDetailByVoteItemList(IList<VoteItem> vIList)
        {
            IList<Core.Business.VoteRecordDetail> voteRecordDetaillist = new List<Core.Business.VoteRecordDetail>();

            foreach (VoteItem vI in vIList)
            {
                SqlServerUtility sql = new SqlServerUtility();

                sql.AddParameter("@voteItemID", SqlDbType.Int, vI.Id);
                SqlDataReader reader = sql.ExecuteSqlReader(SqlGetVoteRecordDetailByVoteItemList);

                if (reader != null)
                {
                    while (reader.Read())
                    {
                        Core.Business.VoteRecordDetail voteRecordDetail = new Core.Business.VoteRecordDetail();

                        if (!reader.IsDBNull(0)) voteRecordDetail.Id = reader.GetInt32(0);
                        if (!reader.IsDBNull(1)) voteRecordDetail.VoteRecordID = reader.GetInt32(1);
                        if (!reader.IsDBNull(2)) voteRecordDetail.VoteItemID = reader.GetInt32(2);
                        if (!reader.IsDBNull(3)) voteRecordDetail.VoteAnswerID = reader.GetInt32(3);

                        voteRecordDetail.MarkOld();
                        voteRecordDetaillist.Add(voteRecordDetail);
                    }
                    reader.Close();
                }
            }
            return voteRecordDetaillist;
        }