示例#1
0
 public List<Maticsoft.Model.Poll.Reply> GetModelList(string strWhere)
 {
     DataSet set = this.dal.GetList(strWhere);
     List<Maticsoft.Model.Poll.Reply> list = new List<Maticsoft.Model.Poll.Reply>();
     int count = set.Tables[0].Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.Poll.Reply item = new Maticsoft.Model.Poll.Reply();
             if (set.Tables[0].Rows[i]["ID"].ToString() != "")
             {
                 item.ID = int.Parse(set.Tables[0].Rows[i]["ID"].ToString());
             }
             if (set.Tables[0].Rows[i]["TopicID"].ToString() != "")
             {
                 item.TopicID = new int?(int.Parse(set.Tables[0].Rows[i]["TopicID"].ToString()));
             }
             item.ReContent = set.Tables[0].Rows[i]["ReContent"].ToString();
             if (set.Tables[0].Rows[i]["ReTime"].ToString() != "")
             {
                 item.ReTime = new DateTime?(DateTime.Parse(set.Tables[0].Rows[i]["ReTime"].ToString()));
             }
             list.Add(item);
         }
     }
     return list;
 }
示例#2
0
 public Maticsoft.Model.Poll.Reply GetModel(int ID)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select  top 1 ID,TopicID,ReContent,ReTime from Poll_Reply ");
     builder.Append(" where ID=@ID ");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.Int, 4) };
     cmdParms[0].Value = ID;
     Maticsoft.Model.Poll.Reply reply = new Maticsoft.Model.Poll.Reply();
     DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if (set.Tables[0].Rows[0]["ID"].ToString() != "")
     {
         reply.ID = int.Parse(set.Tables[0].Rows[0]["ID"].ToString());
     }
     if (set.Tables[0].Rows[0]["TopicID"].ToString() != "")
     {
         reply.TopicID = new int?(int.Parse(set.Tables[0].Rows[0]["TopicID"].ToString()));
     }
     reply.ReContent = set.Tables[0].Rows[0]["ReContent"].ToString();
     if (set.Tables[0].Rows[0]["ReTime"].ToString() != "")
     {
         reply.ReTime = new DateTime?(DateTime.Parse(set.Tables[0].Rows[0]["ReTime"].ToString()));
     }
     return reply;
 }