Esempio n. 1
0
        private void LoadData(int tourist_id)
        {
            places = DirectionDAO.GetDirByUser(tourist_id);

            if (places.Count == 0)
            {
                lblNoEntry.Visible = true;
                List <Direction> random = DirectionDAO.GetRandomPoI();
                gvDirections.DataSource = random;
                gvDirections.DataBind();
                GeoJsonHidden.Value = JsonConvert.SerializeObject(DirectionDAO.ParseGeoJsonFromList(random));
            }
            else
            {
                lblNoEntry.Visible      = false;
                GeoJsonHidden.Value     = JsonConvert.SerializeObject(DirectionDAO.GetGeoJsonsByUser(tourist_id));
                gvDirections.DataSource = places;
                gvDirections.DataBind();
                DropDownListSaved.Items.Clear();
                foreach (Direction i in places)
                {
                    DropDownListSaved.Items.Add(i.Name);
                }
                DropDownListSaved.DataBind();
            }
            gvDirections.Visible = true;
        }
Esempio n. 2
0
        protected void gvDirections_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow row        = gvDirections.SelectedRow;
            int         attraction = int.Parse(row.Cells[0].Text);

            DirectionDAO.RemoveOneDirByUser(attraction, int.Parse(Session["tourist_id"].ToString()));
            LoadData(int.Parse(Session["tourist_id"].ToString()));
        }
Esempio n. 3
0
 protected void BtnAddAttraction_Click(object sender, EventArgs e)
 {
     DirectionDAO.AddDirToUser(int.Parse(DropDownListAttractions.SelectedValue), int.Parse(Session["tourist_id"].ToString()));
     LoadData(int.Parse(Session["tourist_id"].ToString()));
 }