Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            tabs.Visible = !_hideTabs;

            if (!_hideTabs)
            {
                switch (_selectedTab)
                {
                    case 1:
                        link1.Attributes["class"] = "homeOn";
                        break;
                    case 2:
                    case 3:
                    case 4:
                        ((HtmlGenericControl)FindControl("link" + _selectedTab.ToString())).Attributes["class"] = "tabOn";
                        break;
                }
            }

            //citiesMenu.Visible = _checkCity;

            if (_checkCity)
            {
                PlaceManager pm = new PlaceManager();
                Place currentCity = ((BasePage)Page).CurrentCity;
                //currentCityAnchor.InnerHtml = currentCity.Name;
                //currentCityAnchor.HRef = currentCity.Link + "index.aspx";

                linkSearch.HRef = currentCity.Link + "cerca.aspx";
                linkHome.HRef = currentCity.Link + "index.aspx";
                linkSignal.HRef = currentCity.Link + "invia.aspx";
                linkRss.HRef = currentCity.Link + "rss.aspx";
                geoRSSLink.HRef = currentCity.Link + "georss.aspx";
                linkLogo.HRef = currentCity.Link + "index.aspx";

                //linkSearch.HRef = ((BasePage)Page).GetRouteUrl("search", new { place = ((BasePage)Page).RouteData.Values["place"] }); // currentCity.Link + "cerca.aspx";
                //linkHome.HRef = currentCity.Link + "index.aspx";
                //linkSignal.HRef = currentCity.Link + "invia.aspx";
                //linkRss.HRef = currentCity.Link + "rss.aspx";
                //geoRSSLink.HRef = currentCity.Link + "georss.aspx";
                //linkLogo.HRef = currentCity.Link + "index.aspx";

                ltCurrentCity.Text = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(currentCity.Name);

                //List<Place> places = pm.GetActivePlaces();
                //places.Remove(currentCity);
                //rptCities.DataSource = places;
                //rptCities.DataBind();
            }
        }
Esempio n. 2
0
        public Place AddPlace(JsonObject param)
        {
            CheckRequest(param["ajaxSessionKey"].ToString());

            Place p = new Place();
            p.Open311ApiKey = string.Empty;
            p.Open311CityID = string.Empty;
            p.Open311URL = string.Empty;

            p.Latitude = Convert.ToDecimal(param["lat"]);
            p.Longitude = Convert.ToDecimal(param["lng"]);
            p.MapZoom = Convert.ToInt32(param["zoom"]);
            p.Name = param["name"].ToString();
            p.Status = false;
            PlaceManager pm = new PlaceManager();
            pm.CreatePlace(p);

            CitySubmissionEmail cse = new CitySubmissionEmail();
            cse.Send(param["name"].ToString(), param["email"].ToString());

            return p;
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the current city.
        /// </summary>
        public void InitClientObjects()
        {
            PlaceManager pm = new PlaceManager();
            string defaultCity = ConfigurationOptions.Current.GetString("system_default_city");

            if (QueryStringContains("city"))
                defaultCity = GetFromQueryString("city");

            _currentCity = pm.LoadPlaceByRewritedName(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(defaultCity));

            if (_currentCity != null)
            {

            }
            else
            {
                _currentCity = pm.LoadPlace(ConfigurationOptions.Current.GetString("system_default_city"));

                RegisterDocumentReadyFunction("notExistingCity", JsUtils.CreateJsFunction("showNotExistingCityDialog", false, defaultCity));
            }

            JsonObject o = new JsonObject();
            o["name"] = _currentCity.Name;
            o["link"] = _currentCity.Link;
            o["id"] = _currentCity.PlaceID;
            o["lat"] = _currentCity.GeolocationInfo.Location.Latitude;
            o["lng"] = _currentCity.GeolocationInfo.Location.Longitude;
            o["zoom"] = _currentCity.MapZoom;

            ClientScript.RegisterClientScriptBlock(this.GetType(), "clientPageObjects", "var currentCity = " + o.ToString() + ";", true);

            //if (SessionContains("CurrentCity"))
            //{
            //    _currentCity = (Place)GetFromSession("CurrentCity");
            //    if (QueryStringContains("city") && GetFromQueryString("city") != _currentCity.Name)
            //    {

            //        _currentCity = pm.LoadPlace(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(defaultCity));
            //        AddToSession("CurrentCity", _currentCity);
            //    }
            //}
            //else
            //{
            //    _currentCity = pm.LoadPlace(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(defaultCity));

            //    if (_currentCity != null)
            //        AddToSession("CurrentCity", _currentCity);
            //    else
            //    {
            //        _currentCity = pm.LoadPlace(ConfigurationOptions.Current.GetString("system_default_city"));
            //        RegisterDocumentReadyFunction("notExistingCity", JsUtils.CreateJsFunction("showNotExistingCityDialog", false, defaultCity));
            //    }
            //}

            List<Place> places = pm.GetActivePlaces();

            JsonArray citiesArr = new JsonArray();
            foreach (Place p in places)
            {
                JsonObject c = new JsonObject();
                c["label"] = p.Name;
                c["link"] = p.Link;
                citiesArr.Add(c);
            }

            ClientScript.RegisterClientScriptBlock(this.GetType(), "cities", "var places = " + citiesArr.ToString() + ";", true);
        }
Esempio n. 4
0
        public JsonObject CheckPlace(string placeName, string sessionKey)
        {
            CheckRequest(sessionKey);

            PlaceManager pm = new PlaceManager();
            Place p = pm.CheckPlace(placeName);
            JsonObject o = new JsonObject();
            o["name"] = p.Name;
            o["link"] = p.Link;
            o["status"] = p.Status;
            return o;
        }