Пример #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_ucard_sys DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_ucard_sys model=new MxWeiXinPF.Model.wx_ucard_sys();
     if (row != null)
     {
         if(row["id"]!=null && row["id"].ToString()!="")
         {
             model.id=int.Parse(row["id"].ToString());
         }
         if(row["wid"]!=null && row["wid"].ToString()!="")
         {
             model.wid=int.Parse(row["wid"].ToString());
         }
         if(row["tradeTel"]!=null)
         {
             model.tradeTel=row["tradeTel"].ToString();
         }
         if(row["tradeContent"]!=null)
         {
             model.tradeContent=row["tradeContent"].ToString();
         }
         if(row["cardType"]!=null && row["cardType"].ToString()!="")
         {
             model.cardType=int.Parse(row["cardType"].ToString());
         }
         if(row["createDate"]!=null && row["createDate"].ToString()!="")
         {
             model.createDate=DateTime.Parse(row["createDate"].ToString());
         }
     }
     return model;
 }
Пример #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_ucard_sys GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 id,wid,tradeTel,tradeContent,cardType,createDate from wx_ucard_sys ");
            strSql.Append(" where [email protected]");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

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