/// <summary> /// 得到一个对象实体 /// </summary> public MxWeiXinPF.Model.wx_shop_category GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,title,code,parent_id,class_list,class_layer,sort_id,link_url,img_url,class_content,remark,seo_title,seo_keywords,seo_description,wid,ico_url from wx_shop_category "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; MxWeiXinPF.Model.wx_shop_category model = new MxWeiXinPF.Model.wx_shop_category(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public MxWeiXinPF.Model.wx_shop_category GetModel(int id) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 id,title,code,parent_id,class_list,class_layer,sort_id,link_url,img_url,class_content,remark,seo_title,seo_keywords,seo_description,wid,ico_url from wx_shop_category "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4) }; parameters[0].Value = id; MxWeiXinPF.Model.wx_shop_category model=new MxWeiXinPF.Model.wx_shop_category(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }
/// <summary> /// 得到一个对象实体 /// </summary> public MxWeiXinPF.Model.wx_shop_category DataRowToModel(DataRow row) { MxWeiXinPF.Model.wx_shop_category model=new MxWeiXinPF.Model.wx_shop_category(); if (row != null) { if(row["id"]!=null && row["id"].ToString()!="") { model.id=int.Parse(row["id"].ToString()); } if(row["title"]!=null) { model.title=row["title"].ToString(); } if(row["code"]!=null) { model.code=row["code"].ToString(); } if(row["parent_id"]!=null && row["parent_id"].ToString()!="") { model.parent_id=int.Parse(row["parent_id"].ToString()); } if(row["class_list"]!=null) { model.class_list=row["class_list"].ToString(); } if(row["class_layer"]!=null && row["class_layer"].ToString()!="") { model.class_layer=int.Parse(row["class_layer"].ToString()); } if(row["sort_id"]!=null && row["sort_id"].ToString()!="") { model.sort_id=int.Parse(row["sort_id"].ToString()); } if(row["link_url"]!=null) { model.link_url=row["link_url"].ToString(); } if(row["img_url"]!=null) { model.img_url=row["img_url"].ToString(); } if(row["class_content"]!=null) { model.class_content=row["class_content"].ToString(); } if(row["remark"]!=null) { model.remark=row["remark"].ToString(); } if(row["seo_title"]!=null) { model.seo_title=row["seo_title"].ToString(); } if(row["seo_keywords"]!=null) { model.seo_keywords=row["seo_keywords"].ToString(); } if(row["seo_description"]!=null) { model.seo_description=row["seo_description"].ToString(); } if(row["wid"]!=null && row["wid"].ToString()!="") { model.wid=int.Parse(row["wid"].ToString()); } if(row["ico_url"]!=null) { model.ico_url=row["ico_url"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public MxWeiXinPF.Model.wx_shop_category DataRowToModel(DataRow row) { MxWeiXinPF.Model.wx_shop_category model = new MxWeiXinPF.Model.wx_shop_category(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["title"] != null) { model.title = row["title"].ToString(); } if (row["code"] != null) { model.code = row["code"].ToString(); } if (row["parent_id"] != null && row["parent_id"].ToString() != "") { model.parent_id = int.Parse(row["parent_id"].ToString()); } if (row["class_list"] != null) { model.class_list = row["class_list"].ToString(); } if (row["class_layer"] != null && row["class_layer"].ToString() != "") { model.class_layer = int.Parse(row["class_layer"].ToString()); } if (row["sort_id"] != null && row["sort_id"].ToString() != "") { model.sort_id = int.Parse(row["sort_id"].ToString()); } if (row["link_url"] != null) { model.link_url = row["link_url"].ToString(); } if (row["img_url"] != null) { model.img_url = row["img_url"].ToString(); } if (row["class_content"] != null) { model.class_content = row["class_content"].ToString(); } if (row["remark"] != null) { model.remark = row["remark"].ToString(); } if (row["seo_title"] != null) { model.seo_title = row["seo_title"].ToString(); } if (row["seo_keywords"] != null) { model.seo_keywords = row["seo_keywords"].ToString(); } if (row["seo_description"] != null) { model.seo_description = row["seo_description"].ToString(); } if (row["wid"] != null && row["wid"].ToString() != "") { model.wid = int.Parse(row["wid"].ToString()); } if (row["ico_url"] != null) { model.ico_url = row["ico_url"].ToString(); } } return(model); }