public bool InsertCity() { bool cambiado = false; FavoriteClass f = new FavoriteClass(); cambiado = f.addFavorite((int)Session["idUser"], cityActive, countryActive); return cambiado; }
public bool InsertFavorite() { bool cambiado = false; FavoriteClass f = new FavoriteClass(); f.addFavorite((int)Session["idUser"], cityName, countryName); cambiado = true; return cambiado; }
/**DETAILS :Print all the favorites of a given user * PARAMETERS :The ID of the user * RETURN :A collection (DATASET) of favorites * */ public DataSet printMyFavoritesCAD(int userID) { FavoriteClass fav = new FavoriteClass(); DataSet bdvirtual = new DataSet(); string connectionString = ConfigurationManager.ConnectionStrings["WebApplication1.Properties.Settings.Setting"].ToString(); SqlConnection connection = new SqlConnection(connectionString); try { SqlDataAdapter adapter = new SqlDataAdapter("select * from Favorite where idUser =\'" + userID + "\' order by city", c); adapter.Fill(bdvirtual, "favorite"); } catch (Exception ex) { } finally { c.Close(); } return bdvirtual; }
private void Load_Favorite() { FavoriteClass f=new FavoriteClass(); ListView1.DataSource = f.printMyFavorites((int)Session["idUser"]); ListView1.DataBind(); }
//Constructor of copy public FavoriteClass(FavoriteClass fav) { favorites = fav.favorites; idFavorite = fav.idFavorite; }