Beispiel #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MxWeiXinPF.Model.wx_xt_photo DataRowToModel(DataRow row)
 {
     MxWeiXinPF.Model.wx_xt_photo model=new MxWeiXinPF.Model.wx_xt_photo();
     if (row != null)
     {
         if(row["id"]!=null && row["id"].ToString()!="")
         {
             model.id=int.Parse(row["id"].ToString());
         }
         if(row["bId"]!=null && row["bId"].ToString()!="")
         {
             model.bId=int.Parse(row["bId"].ToString());
         }
         if(row["pName"]!=null)
         {
             model.pName=row["pName"].ToString();
         }
         if(row["pUrl"]!=null)
         {
             model.pUrl=row["pUrl"].ToString();
         }
         if(row["remark"]!=null)
         {
             model.remark=row["remark"].ToString();
         }
         if(row["seq"]!=null && row["seq"].ToString()!="")
         {
             model.seq=int.Parse(row["seq"].ToString());
         }
     }
     return model;
 }
Beispiel #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MxWeiXinPF.Model.wx_xt_photo GetModel(int id)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 id,bId,pName,pUrl,remark,seq from wx_xt_photo ");
            strSql.Append(" where [email protected]");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int,4)
            };
            parameters[0].Value = id;

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