Пример #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public webs_YueyxShop.Model.VipCollectionBase DataRowToModel(DataRow row)
 {
     webs_YueyxShop.Model.VipCollectionBase model=new webs_YueyxShop.Model.VipCollectionBase();
     if (row != null)
     {
         if(row["vc_ID"]!=null && row["vc_ID"].ToString()!="")
         {
             model.vc_ID=int.Parse(row["vc_ID"].ToString());
         }
         if(row["sku_ID"]!=null && row["sku_ID"].ToString()!="")
         {
             model.sku_ID=int.Parse(row["sku_ID"].ToString());
         }
         if(row["m_ID"]!=null && row["m_ID"].ToString()!="")
         {
             model.m_ID=int.Parse(row["m_ID"].ToString());
         }
         if(row["vc_CreateOn"]!=null && row["vc_CreateOn"].ToString()!="")
         {
             model.vc_CreateOn=DateTime.Parse(row["vc_CreateOn"].ToString());
         }
         if(row["vc_IsDel"]!=null && row["vc_IsDel"].ToString()!="")
         {
             if((row["vc_IsDel"].ToString()=="1")||(row["vc_IsDel"].ToString().ToLower()=="true"))
             {
                 model.vc_IsDel=true;
             }
             else
             {
                 model.vc_IsDel=false;
             }
         }
     }
     return model;
 }
Пример #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public webs_YueyxShop.Model.VipCollectionBase GetModel(int vc_ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 vc_ID,sku_ID,m_ID,vc_CreateOn,vc_IsDel from VipCollectionBase ");
            strSql.Append(" where vc_ID=@vc_ID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@vc_ID", SqlDbType.Int,4)			};
            parameters[0].Value = vc_ID;

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