/// <summary> /// 得到一个对象实体 /// </summary> public Model.article_nav GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from dt_article_nav "); strSql.Append(" where n_id=@n_id"); SqlParameter[] parameters = { new SqlParameter("@n_id", SqlDbType.Int, 4) }; parameters[0].Value = id; DTcms.Model.article_nav model = new DTcms.Model.article_nav(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["n_id"] != null && ds.Tables[0].Rows[0]["n_id"].ToString() != "") { model.n_id = int.Parse(ds.Tables[0].Rows[0]["n_id"].ToString()); } if (ds.Tables[0].Rows[0]["n_title"] != null && ds.Tables[0].Rows[0]["n_title"].ToString() != "") { model.n_title = ds.Tables[0].Rows[0]["n_title"].ToString(); } if (ds.Tables[0].Rows[0]["n_url"] != null && ds.Tables[0].Rows[0]["n_url"].ToString() != "") { model.n_url = ds.Tables[0].Rows[0]["n_url"].ToString(); } if (ds.Tables[0].Rows[0]["n_state"] != null && ds.Tables[0].Rows[0]["n_state"].ToString() != "") { model.n_state = int.Parse(ds.Tables[0].Rows[0]["n_state"].ToString()); } if (ds.Tables[0].Rows[0]["n_sequence"] != null && ds.Tables[0].Rows[0]["n_sequence"].ToString() != "") { model.n_sequence = int.Parse(ds.Tables[0].Rows[0]["n_sequence"].ToString()); } if (ds.Tables[0].Rows[0]["n_desc"] != null && ds.Tables[0].Rows[0]["n_desc"].ToString() != "") { model.n_desc = ds.Tables[0].Rows[0]["n_desc"].ToString(); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(DTcms.Model.article_nav model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(DTcms.Model.article_nav model) { return(dal.Add(model)); }