Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public webs_YueyxShop.Model.RushPurchaseBase DataRowToModel(DataRow row)
 {
     webs_YueyxShop.Model.RushPurchaseBase model=new webs_YueyxShop.Model.RushPurchaseBase();
     if (row != null)
     {
         if(row["rp_ID"]!=null && row["rp_ID"].ToString()!="")
         {
             model.rp_ID=int.Parse(row["rp_ID"].ToString());
         }
         if(row["p_ID"]!=null && row["p_ID"].ToString()!="")
         {
             model.p_ID=int.Parse(row["p_ID"].ToString());
         }
         if(row["rp_StartTime"]!=null && row["rp_StartTime"].ToString()!="")
         {
             model.rp_StartTime=DateTime.Parse(row["rp_StartTime"].ToString());
         }
         if(row["rp_EndTiime"]!=null && row["rp_EndTiime"].ToString()!="")
         {
             model.rp_EndTiime=DateTime.Parse(row["rp_EndTiime"].ToString());
         }
         if(row["rp_pCount"]!=null && row["rp_pCount"].ToString()!="")
         {
             model.rp_pCount=int.Parse(row["rp_pCount"].ToString());
         }
         if(row["rp_pPric"]!=null && row["rp_pPric"].ToString()!="")
         {
             model.rp_pPric=decimal.Parse(row["rp_pPric"].ToString());
         }
         if(row["rp_CreateOn"]!=null && row["rp_CreateOn"].ToString()!="")
         {
             model.rp_CreateOn=DateTime.Parse(row["rp_CreateOn"].ToString());
         }
         if(row["rp_CreateBy"]!=null && row["rp_CreateBy"].ToString()!="")
         {
             model.rp_CreateBy= new Guid(row["rp_CreateBy"].ToString());
         }
         if(row["rp_StatusCode"]!=null && row["rp_StatusCode"].ToString()!="")
         {
             model.rp_StatusCode=int.Parse(row["rp_StatusCode"].ToString());
         }
         if(row["rp_isdel"]!=null && row["rp_isdel"].ToString()!="")
         {
             if((row["rp_isdel"].ToString()=="1")||(row["rp_isdel"].ToString().ToLower()=="true"))
             {
                 model.rp_isdel=true;
             }
             else
             {
                 model.rp_isdel=false;
             }
         }
     }
     return model;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public webs_YueyxShop.Model.RushPurchaseBase GetModel(int rp_ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 rp_ID,p_ID,rp_StartTime,rp_EndTiime,rp_pCount,rp_pPric,rp_CreateOn,rp_CreateBy,rp_StatusCode,rp_isdel from RushPurchaseBase ");
            strSql.Append(" where rp_ID=@rp_ID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@rp_ID", SqlDbType.Int,4)			};
            parameters[0].Value = rp_ID;

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