示例#1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public webs_YueyxShop.Model.ProductImgBase DataRowToModel(DataRow row)
 {
     webs_YueyxShop.Model.ProductImgBase model=new webs_YueyxShop.Model.ProductImgBase();
     if (row != null)
     {
         if(row["pi_ID"]!=null && row["pi_ID"].ToString()!="")
         {
             model.pi_ID=int.Parse(row["pi_ID"].ToString());
         }
         if(row["sku_ID"]!=null && row["sku_ID"].ToString()!="")
         {
             model.sku_ID=int.Parse(row["sku_ID"].ToString());
         }
         if(row["pi_Url"]!=null)
         {
             model.pi_Url=row["pi_Url"].ToString();
         }
         if(row["pi_Type"]!=null && row["pi_Type"].ToString()!="")
         {
             model.pi_Type = bool.Parse(row["pi_Type"].ToString());
         }
         if (row["pi_StatusCode"] != null && row["pi_StatusCode"].ToString() != "")
         {
             model.pi_StatusCode = int.Parse(row["pi_StatusCode"].ToString());
         }
         if (row["pi_IsDel"] != null && row["pi_IsDel"].ToString() != "")
         {
             model.pi_IsDel = bool.Parse(row["pi_IsDel"].ToString());
         }
     }
     return model;
 }
示例#2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public webs_YueyxShop.Model.ProductImgBase GetModel(int pi_ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 pi_ID,sku_ID,pi_Url,pi_Type,pi_StatusCode,pi_IsDel from ProductImgBase ");
            strSql.Append(" where pi_ID=@pi_ID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@pi_ID", SqlDbType.Int,4)			};
            parameters[0].Value = pi_ID;

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