Esempio n. 1
0
        /// <summary>
        /// 获得投票信息
        /// </summary>
        /// <param name="wid"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public Model.wx_vote_base GetVoteBaseByWid(int wid, int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1");
            strSql.Append(" * ");
            strSql.Append(" from wx_vote_base  where   id=@id  and wId=@wId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",  SqlDbType.Int, 4),
                new SqlParameter("@wId", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;
            parameters[1].Value = wid;
            SqlDataReader sr = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters);

            Model.wx_vote_base category = new Model.wx_vote_base();
            while (sr.Read())
            {
                category                = new Model.wx_vote_base();
                category.id             = MyCommFun.Obj2Int(sr["id"]);
                category.title          = MyCommFun.ObjToStr(sr["title"]);
                category.votepic        = MyCommFun.ObjToStr(sr["votepic"]);
                category.picdisplay     = MyCommFun.ObjBool(sr["picdisplay"]);
                category.votecontent    = MyCommFun.ObjToStr(sr["votecontent"]);
                category.isRadio        = MyCommFun.ObjBool(sr["isRadio"]);
                category.beginTime      = MyCommFun.Obj2DateTime(sr["beginTime"]);
                category.endTime        = MyCommFun.Obj2DateTime(sr["endTime"]);
                category.resultShowtype = MyCommFun.Obj2Int(sr["resultShowtype"]);
                category.actUrl         = MyCommFun.ObjToStr(sr["actUrl"]);
                category.voteType       = MyCommFun.Obj2Int(sr["voteType"]);
                category.sort_id        = MyCommFun.Obj2Int(sr["sort_id"]);
                category.creatDate      = MyCommFun.Obj2DateTime(sr["creatDate"]);
            }
            sr.Close();

            return(category);
        }