Esempio n. 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MZZ.Model.tb_lntegral_users DataRowToModel(DataRow row)
 {
     MZZ.Model.tb_lntegral_users model=new MZZ.Model.tb_lntegral_users();
     if (row != null)
     {
         if(row["id"]!=null && row["id"].ToString()!="")
         {
             model.id=int.Parse(row["id"].ToString());
         }
         if(row["openid"]!=null)
         {
             model.openid=row["openid"].ToString();
         }
         if(row["prizeid"]!=null && row["prizeid"].ToString()!="")
         {
             model.prizeid=int.Parse(row["prizeid"].ToString());
         }
         if(row["address"]!=null)
         {
             model.address=row["address"].ToString();
         }
         if(row["name"]!=null)
         {
             model.name=row["name"].ToString();
         }
         if(row["cellphone"]!=null)
         {
             model.cellphone=row["cellphone"].ToString();
         }
         if(row["createdate"]!=null && row["createdate"].ToString()!="")
         {
             model.createdate=DateTime.Parse(row["createdate"].ToString());
         }
     }
     return model;
 }
Esempio n. 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MZZ.Model.tb_lntegral_users GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select id,openid,prizeid,address,name,cellphone,createdate from tb_lntegral_users ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

            MZZ.Model.tb_lntegral_users model=new MZZ.Model.tb_lntegral_users();
            DataSet ds=DbHelperMySQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }