Example #1
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Events", Request, "AccountEventsToday.aspx"));

            if (RequestId > 0)
            {
                TransitAccountEvent evt = SessionManager.EventService.GetAccountEventById(
                    SessionManager.Ticket, RequestId, SessionManager.UtcOffset.Ticks);

                this.Title          = string.Format("{0} Pictures", Renderer.Render(evt.Name));
                listView.DataSource = SessionManager.EventService.GetAccountEventPictures(
                    SessionManager.Ticket, RequestId, null);
                listView.DataBind();

                sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "AccountEventsToday.aspx", evt.PlaceCountry, evt.PlaceState, evt.PlaceCity, evt.PlaceNeighborhood, evt.AccountEventType));
                sitemapdata.Add(new SiteMapDataAttributeNode(evt.Name, Request, string.Format("AccountEventView.aspx?id={0}", evt.Id)));
                sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request.Url));
            }

            StackSiteMap(sitemapdata);
        }
    }
Example #2
0
    public void Page_Load(object sender, EventArgs e)
    {
        gridManage.OnGetDataSource += new EventHandler(gridManage_OnGetDataSource);

        LocationSelector.CountryChanged  += new EventHandler(LocationSelector_CountryChanged);
        LocationSelector.StateChanged    += new EventHandler(LocationSelector_StateChanged);
        LocationSelector.CityChanged     += new EventHandler(LocationSelector_CityChanged);
        LocationSelector.LocationChanged += new EventHandler(LocationSelector_LocationChanged);

        ((SnCoreMasterPage)Master).ScriptManager.Navigate += new EventHandler <HistoryEventArgs>(History_Navigate);

        neighborhoods.OnChange += new EventHandler(neighborhoods_OnChange);

        if (!IsPostBack)
        {
            linkLocal.Visible = SessionManager.IsLoggedIn && !string.IsNullOrEmpty(SessionManager.Account.City);

            if (SessionManager.IsLoggedIn)
            {
                linkLocal.Text = string.Format("&#187; All {0} Places", Renderer.Render(SessionManager.Account.City));
            }

            if (SessionManager.IsLoggedIn && (Request.QueryString.Count == 0))
            {
                LocationSelector.SelectLocation(sender, new LocationWithOptionsEventArgs(SessionManager.Account));
            }
            else
            {
                if (LocationSelector.SelectLocation(sender, new LocationWithOptionsEventArgs(Request)))
                {
                    panelSearchInternal.Visible = true;
                }
            }

            GetNeighborhoodsData(sender, e);

            GetData(sender, e);

            if ((gridManage.VirtualItemCount == 0) && (Request.QueryString.Count == 0))
            {
                panelSearchInternal.Visible = false;
                LocationSelector.ClearSelection();
                GetData(sender, e);
            }

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Places", Request, "PlacesView.aspx"));
            sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "PlacesView.aspx", inputCountry.SelectedValue, inputState.SelectedValue, inputCity.SelectedValue, inputNeighborhood.SelectedValue, inputType.SelectedValue));
            StackSiteMap(sitemapdata);
        }

        SetDefaultButton(search);
    }
Example #3
0
    public void Page_Load(object sender, EventArgs e)
    {
        gridManage.OnGetDataSource += new EventHandler(gridManage_OnGetDataSource);

        LocationSelector.CountryChanged += new EventHandler(LocationSelector_CountryChanged);
        LocationSelector.StateChanged   += new EventHandler(LocationSelector_StateChanged);
        LocationSelector.CityChanged    += new EventHandler(LocationSelector_CityChanged);

        neighborhoods.OnChange += new EventHandler(neighborhoods_OnChange);

        if (!IsPostBack)
        {
            if (SessionManager.IsLoggedIn && (Request.QueryString.Count == 0))
            {
                LocationSelector.SelectLocation(sender, new LocationWithOptionsEventArgs(SessionManager.Account));
            }
            else
            {
                if (LocationSelector.SelectLocation(sender, new LocationWithOptionsEventArgs(Request)))
                {
                    // panelSearchInternal.Visible = true;
                }
            }

            GetNeighborhoodsData(sender, e);
            GetData(sender, e);

            if ((gridManage.VirtualItemCount == 0) && (Request.QueryString.Count == 0))
            {
                LocationSelector.ClearSelection();
                GetData(sender, e);
            }

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Places", Request, "PlacesView.aspx"));
            if (Request.QueryString.Count != 0)
            {
                sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "PlacesView.aspx",
                                                                                    inputCountry.SelectedValue, inputState.SelectedValue, inputCity.SelectedValue, inputNeighborhood.SelectedValue, inputType.SelectedValue));
            }
            StackSiteMap(sitemapdata);
        }
    }
Example #4
0
    public void Page_Load(object sender, EventArgs e)
    {
        picturesView.OnGetDataSource += new EventHandler(picturesView_OnGetDataSource);

        if (!IsPostBack)
        {
            mPictureId = RequestId;
            GetPictureData(sender, e);
            GetPicturesData(sender, e);

            TransitPlace         p           = Place;
            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Places", Request, "PlacesView.aspx"));
            sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "PlacesView.aspx", p.Country, p.State, p.City, p.Neighborhood, p.Type));
            sitemapdata.Add(new SiteMapDataAttributeNode(p.Name, Request, string.Format("PlaceView.aspx?id={0}", p.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request.Url));
            StackSiteMap(sitemapdata);
        }
    }
Example #5
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (RequestId == 0)
            {
                throw new Exception("Missing place merge request.");
            }

            TransitPlaceChangeRequest request = SessionManager.PlaceService.GetPlaceChangeRequestById(
                SessionManager.Ticket, RequestId);

            TransitPlace place = SessionManager.PlaceService.GetPlaceById(
                SessionManager.Ticket, request.PlaceId);

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Places", Request, "PlacesView.aspx"));
            sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "PlacesView.aspx", place.Country, place.State, place.City, place.Neighborhood, place.Type));
            sitemapdata.Add(new SiteMapDataAttributeNode(place.Name, Request, string.Format("PlaceView.aspx?id={0}", place.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Merge Changes", Request.Url));
            StackSiteMap(sitemapdata);

            Title = labelName.Text = string.Format("{0}: Merge Changes", Renderer.Render(place.Name));
            linkBack.NavigateUrl = string.Format("PlaceChangeRequestsManage.aspx?id={0}", place.Id);

            AddListItem(place.Name, request.Name, selectName);
            AddListItem(place.Type, request.Type, selectType);
            AddListItem(place.Description, request.Description, selectDescription);
            AddListItem(place.Country, request.Country, selectCountry);
            AddListItem(place.State, request.State, selectState);
            AddListItem(place.City, request.City, selectCity);
            AddListItem(place.Neighborhood, request.Neighborhood, selectNeighborhood);
            AddListItem(place.Phone, request.Phone, selectPhone);
            AddListItem(place.Fax, request.Fax, selectFax);
            AddListItem(place.Street, request.Street, selectStreet);
            AddListItem(place.Zip, request.Zip, selectZip);
            AddListItem(place.CrossStreet, request.CrossStreet, selectCrossStreet);
            AddListItem(place.Email, request.Email, selectEmail);
        }

        SetDefaultButton(merge);
    }
Example #6
0
    public void Page_Load(object sender, EventArgs e)
    {
        picturesView.OnGetDataSource += new EventHandler(picturesView_OnGetDataSource);
        if (!IsPostBack)
        {
            mPictureId = RequestId;
            GetPictureData(sender, e);
            GetPicturesData(sender, e);

            TransitAccountEvent        t = AccountEvent;
            TransitAccountEventPicture p = AccountEventPicture;

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Events", Request, "AccountEventsView.aspx"));
            sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "AccountEventsToday.aspx", t.PlaceCountry, t.PlaceState, t.PlaceCity, t.PlaceNeighborhood, t.AccountEventType));
            sitemapdata.Add(new SiteMapDataAttributeNode(t.Name, Request, string.Format("AccountEventView.aspx?id={0}", t.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request.Url));
            StackSiteMap(sitemapdata);
        }
    }
Example #7
0
    public void Page_Load(object sender, EventArgs e)
    {
        gridManage.OnGetDataSource += new EventHandler(gridManage_OnGetDataSource);

        if (!IsPostBack)
        {
            TransitPlace place = SessionManager.PlaceService.GetPlaceById(
                SessionManager.Ticket, RequestId);

            labelTitle.Text      = Title = string.Format("{0}: Change Requests", Renderer.Render(place.Name));
            linkBack.NavigateUrl = string.Format("PlaceView.aspx?id={0}", place.Id);

            GetData(sender, e);

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Places", Request, "PlacesView.aspx"));
            sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "PlacesView.aspx", place.Country, place.State, place.City, place.Neighborhood, place.Type));
            sitemapdata.Add(new SiteMapDataAttributeNode(place.Name, Request, string.Format("PlaceView.aspx?id={0}", place.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Change Requests", Request.Url));
            StackSiteMap(sitemapdata);
        }
    }
Example #8
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Place == null)
            {
                throw new Exception("Place does not exist.");
            }

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Places", Request, "PlacesView.aspx"));
            sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "PlacesView.aspx",
                                                                                Place.Country, Place.State, Place.City, Place.Neighborhood, Place.Type));
            sitemapdata.Add(new SiteMapDataAttributeNode(Place.Name, Request.Url));
            StackSiteMap(sitemapdata);

            this.Title = Renderer.Render(string.Format("{0}, {1}", Place.Name, Place.City));

            placeZip.Text         = Renderer.Render(Place.Zip);
            placeStreet.Text      = Renderer.Render(Place.Street);
            placeCrossStreet.Text = Renderer.Render(Place.CrossStreet);
            placeType.Text        = Renderer.Render(Place.Type);
            placeCity.Text        = Renderer.Render(Place.City);
            placeState.Text       = Renderer.Render(Place.State);
            placeCountry.Text     = Renderer.Render(Place.Country);

            placeImage.Visible  = Place.PictureId != 0;
            placeImage.ImageUrl = string.Format("PlacePictureThumbnail.aspx?id={0}",
                                                Place.PictureId);

            linkPictures.NavigateUrl = placeLinkPictures.HRef = string.Format("PlacePicturesView.aspx?id={0}",
                                                                              Place.Id);

            GetReviews(sender, e);
        }
    }
Example #9
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (RequestId > 0)
            {
                TransitPlace   place   = Place;
                TransitAccount account = PlaceAccount;

                if (place == null)
                {
                    ReportWarning("Place does not exist.");
                    panelPlace.Visible = false;
                    return;
                }

                SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
                sitemapdata.Add(new SiteMapDataAttributeNode("Places", Request, "PlacesView.aspx"));
                sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "PlacesView.aspx", place.Country, place.State, place.City, place.Neighborhood, place.Type));
                sitemapdata.Add(new SiteMapDataAttributeNode(place.Name, Request.Url));
                StackSiteMap(sitemapdata);

                groups.PlaceId = RequestId;

                Title = Renderer.Render(string.Format("{0}, {1}", place.Name, place.City));

                MetaDescription.Content = string.Format("Get photos, information and reviews on {0} and other places in {1} on {2}.",
                                                        Renderer.Render(place.Name),
                                                        Renderer.Render(place.City),
                                                        Renderer.Render(SessionManager.GetCachedConfiguration("SnCore.Title", "SnCore")));

                placeType.NavigateUrl =
                    string.Format("PlacesView.aspx?city={0}&state={1}&country={2}&neighborhood={3}&type={4}",
                                  Renderer.UrlEncode(place.City),
                                  Renderer.UrlEncode(place.State),
                                  Renderer.UrlEncode(place.Country),
                                  Renderer.UrlEncode(place.Neighborhood),
                                  Renderer.UrlEncode(place.Type));

                placeNeighborhood.NavigateUrl =
                    string.Format("PlacesView.aspx?city={0}&state={1}&country={2}&neighborhood={3}",
                                  Renderer.UrlEncode(place.City),
                                  Renderer.UrlEncode(place.State),
                                  Renderer.UrlEncode(place.Country),
                                  Renderer.UrlEncode(place.Neighborhood));

                placeCity.NavigateUrl =
                    string.Format("PlacesView.aspx?city={0}&state={1}&country={2}",
                                  Renderer.UrlEncode(place.City),
                                  Renderer.UrlEncode(place.State),
                                  Renderer.UrlEncode(place.Country));

                placeState.NavigateUrl =
                    string.Format("PlacesView.aspx?state={0}&country={1}",
                                  Renderer.UrlEncode(place.State),
                                  Renderer.UrlEncode(place.Country));

                placeCountry.NavigateUrl =
                    string.Format("PlacesView.aspx?country={0}",
                                  Renderer.UrlEncode(place.Country));

                linkDirections.HRef = DrivingDirectionsUrl;
                linkAdd.NavigateUrl =
                    string.Format("PlaceEdit.aspx?city={0}&state={1}&country={2}&neighborhood={3}&type={4}",
                                  Renderer.UrlEncode(place.City),
                                  Renderer.UrlEncode(place.State),
                                  Renderer.UrlEncode(place.Country),
                                  Renderer.UrlEncode(place.Neighborhood),
                                  Renderer.UrlEncode(place.Type));

                placeAccounts.PlaceId      = RequestId;
                placeAccountEvents.PlaceId = RequestId;
                placeFriends.PlaceId       = RequestId;
                attributesView.PlaceId     = RequestId;
                picturesView.PlaceId       = RequestId;

                labelDescription.Text    = base.RenderEx(place.Description);
                panelDescription.Visible = !string.IsNullOrEmpty(labelDescription.Text);
                placeName.Text           = Renderer.Render(place.Name);
                placeId.Text             = string.Format("#{0}", place.Id);

                linkManagePictures.NavigateUrl = string.Format("PlacePicturesManage.aspx?id={0}", place.Id);

                linkClaimOwnership.Visible     = !place.CanWrite;
                linkClaimOwnership.NavigateUrl = string.Format("AccountPlaceRequestEdit.aspx?pid={0}", place.Id);

                linkPlaceChangeRequestEdit.Visible     = !place.CanWrite;
                linkPlaceChangeRequestEdit.NavigateUrl = string.Format("PlaceChangeRequestEdit.aspx?pid={0}", place.Id);

                if (account != null)
                {
                    linkAddedBy.Text        = Renderer.Render(account.Name);
                    linkAddedBy.NavigateUrl = string.Format("AccountView.aspx?id={0}", account.Id);
                }
                else
                {
                    linkAddedBy.Text = "a deleted user";
                }

                labelAddedOn.Text = Adjust(place.Created).ToString("d");

                linkAdminManageChanges.Visible     = linkAdminEdit.Visible = place.CanWrite || SessionManager.IsAdministrator;
                linkAdminEdit.NavigateUrl          = string.Format("PlaceEdit.aspx?id={0}", place.Id);
                linkAdminManageChanges.NavigateUrl = string.Format("PlaceChangeRequestsManage.aspx?id={0}", place.Id);
                linkAdminAttributes.NavigateUrl    = string.Format("PlaceAttributesManage.aspx?id={0}", place.Id);
                linkMerge.NavigateUrl = string.Format("PlaceMerge.aspx?id={0}", place.Id);
                placeAddress.Text     = Renderer.Render(place.Street);
                placeZip.Text         = Renderer.Render(place.Zip);
                if (!string.IsNullOrEmpty(place.Fax))
                {
                    placeFax.Text = string.Format("{0} (fax)", Renderer.Render(place.Fax));
                }
                if (!string.IsNullOrEmpty(place.Phone))
                {
                    placePhone.Text = string.Format("{0} (phone)", Renderer.Render(place.Phone));
                }
                if (!string.IsNullOrEmpty(place.CrossStreet))
                {
                    placeCrossStreet.Text = string.Format("cross-street: {0}", Renderer.Render(place.CrossStreet));
                }

                placeType.Text         = Renderer.Render(place.Type);
                placeEmail.NavigateUrl = string.Format("mailto:{0}", Renderer.Render(place.Email));
                placeEmail.Visible     = !string.IsNullOrEmpty(place.Email);

                discussionPlaces.DiscussionId = SessionManager.GetCount <TransitDiscussion, string, int>(
                    typeof(Place).Name, RequestId, SessionManager.DiscussionService.GetOrCreateDiscussionId);
                discussionPlaces.DataBind();

                websitesView.PlaceId = RequestId;

                madlibs.ObjectId        = RequestId;
                madlibs.Table           = "Place";
                madlibs.MadLibId        = int.Parse(SessionManager.GetCachedConfiguration("SnCore.MadLibs.Place.Id", "0"));
                madlibs.ReturnUrl       = Request.Url.PathAndQuery;
                madlibs.ObjectAccountId = place.AccountId;
                madlibs.QueryString     = string.Format("&Place.Name={0}", Renderer.UrlEncode(place.Name));

                if (SessionManager.IsAdministrator)
                {
                    linkFeature.Text = (LatestPlaceFeature != null)
                        ? string.Format("Feature &#187; Last on {0}", Adjust(LatestPlaceFeature.Created).ToString("d"))
                        : "Feature &#187; Never Featured";
                }

                redirect.TargetUri = string.Format("PlaceView.aspx?id={0}", place.Id);
                redirect.AccountId = place.AccountId;

                linkAddToGroup.NavigateUrl = string.Format("AccountGroupPlaceAdd.aspx?id={0}", RequestId);
            }
            else
            {
                placeName.Text = Renderer.Render(Request.QueryString["name"]);
                TransitCity city = SessionManager.LocationService.GetCityByTag(
                    SessionManager.Ticket, Request.QueryString["city"]);
                if (city != null)
                {
                    placeCity.Text    = Renderer.Render(city.Name);
                    placeState.Text   = Renderer.Render(city.State);
                    placeCountry.Text = Renderer.Render(city.Country);
                }

                panelViews.Visible          = false;
                panelDetails.Visible        = false;
                panelSubmit.Visible         = true;
                panelDescription.Visible    = false;
                panelPropertyGroups.Visible = false;
                panelEvents.Visible         = false;
                discussionPlaces.Visible    = false;
                madlibs.Visible             = false;
                panelInfo.Visible           = false;
                panelCounter.Visible        = false;
                websitesView.Visible        = false;
                linkEdit.NavigateUrl        = string.Format("PlaceEdit.aspx?{0}", Request.QueryString.ToString());
            }
        }
    }
    public void Page_Load(object sender, EventArgs e)
    {
        if (RequestId <= 0 && GetId("pid") == 0)
        {
            throw new Exception("Missing Place");
        }

        LocationSelector.LocationChanged += new EventHandler(LocationSelector_LocationChanged);

        if (!IsPostBack)
        {
            DomainClass cs = SessionManager.GetDomainClass("PlaceChangeRequest");
            inputName.MaxLength        = cs["Name"].MaxLengthInChars;
            inputStreet.MaxLength      = cs["Street"].MaxLengthInChars;
            inputZip.MaxLength         = cs["Zip"].MaxLengthInChars;
            inputCrossStreet.MaxLength = cs["CrossStreet"].MaxLengthInChars;
            inputPhone.MaxLength       = cs["Phone"].MaxLengthInChars;
            inputFax.MaxLength         = cs["Fax"].MaxLengthInChars;
            inputEmail.MaxLength       = cs["Email"].MaxLengthInChars;

            ArrayList types = new ArrayList();
            types.Add(new TransitAccountPlaceType());
            types.AddRange(SessionManager.PlaceService.GetPlaceTypes(SessionManager.Ticket, null));
            selectType.DataSource = types;
            selectType.DataBind();

            TransitPlace place = null;

            if (RequestId > 0)
            {
                TransitPlaceChangeRequest request = SessionManager.PlaceService.GetPlaceChangeRequestById(
                    SessionManager.Ticket, RequestId);
                labelName.Text        = Renderer.Render(request.Name);
                inputName.Text        = request.Name;
                inputDescription.Text = request.Description;
                inputCrossStreet.Text = request.CrossStreet;
                inputEmail.Text       = request.Email;
                inputFax.Text         = request.Fax;
                inputPhone.Text       = request.Phone;
                inputStreet.Text      = request.Street;
                inputZip.Text         = request.Zip;
                ListItemManager.TrySelect(selectType, request.Type);
                LocationSelector.SelectLocation(sender, new LocationEventArgs(request));

                place = SessionManager.PlaceService.GetPlaceById(
                    SessionManager.Ticket, request.PlaceId);
            }
            else
            {
                place = SessionManager.PlaceService.GetPlaceById(
                    SessionManager.Ticket, PlaceId);
                labelName.Text        = Renderer.Render(place.Name);
                inputName.Text        = place.Name;
                inputDescription.Text = place.Description;
                inputCrossStreet.Text = place.CrossStreet;
                inputEmail.Text       = place.Email;
                inputFax.Text         = place.Fax;
                inputPhone.Text       = place.Phone;
                inputStreet.Text      = place.Street;
                inputZip.Text         = place.Zip;
                ListItemManager.TrySelect(selectType, place.Type);
                LocationSelector.SelectLocation(sender, new LocationEventArgs(place));
            }

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Places", Request, "PlacesView.aspx"));
            sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "PlacesView.aspx", place.Country, place.State, place.City, place.Neighborhood, place.Type));
            sitemapdata.Add(new SiteMapDataAttributeNode(place.Name, Request, string.Format("PlaceView.aspx?id={0}", place.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Request Changes", Request.Url));
            StackSiteMap(sitemapdata);

            linkBack.NavigateUrl = (RequestId > 0 ?
                                    string.Format("AccountPlaceChangeRequestsManage.aspx?id={0}", RequestId)
                : string.Format("PlaceView.aspx?id={0}", place.Id));
        }

        if (!SessionManager.HasVerified())
        {
            ReportWarning("You don't have any verified e-mail addresses and/or profile photos.\n" +
                          "You must add/confirm a valid e-mail address and upload a profile photo before editing places.");

            save.Enabled = false;
        }

        LocationSelector_LocationChanged(sender, e);
        SetDefaultButton(save);
    }
Example #11
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (RequestId > 0)
            {
                TransitAccountEvent t = AccountEvent;

                if (t == null)
                {
                    ReportWarning("Event does not exist.");
                    pnlAccountEvent.Visible = false;
                    return;
                }

                SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
                sitemapdata.Add(new SiteMapDataAttributeNode("Events", Request, "AccountEventsView.aspx"));
                sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "AccountEventsToday.aspx", t.PlaceCountry, t.PlaceState, t.PlaceCity, t.PlaceNeighborhood, t.AccountEventType));
                sitemapdata.Add(new SiteMapDataAttributeNode(t.Name, Request.Url));
                StackSiteMap(sitemapdata);

                picturesView.AccountEventId = RequestId;

                this.Title = Renderer.Render(t.Name);

                labelDescription.Text    = base.RenderEx(t.Description);
                panelDescription.Visible = !string.IsNullOrEmpty(labelDescription.Text);
                eventName.Text           = Renderer.Render(t.Name);
                eventId.Text             = "#" + t.Id.ToString();

                linkEdit.NavigateUrl = string.Format("AccountEventEdit.aspx?id={0}", t.Id);

                eventWebsite.NavigateUrl = t.Website;
                if (!string.IsNullOrEmpty(t.Website))
                {
                    eventWebsite.NavigateUrl = t.Website;
                    if (t.Website.Length < 64)
                    {
                        eventWebsite.Text = Renderer.Render(t.Website);
                    }
                }

                eventWebsite.Visible   = !string.IsNullOrEmpty(t.Website);
                eventPhone.Text        = Renderer.Render(t.Phone);
                eventType.Text         = Renderer.Render(t.AccountEventType);
                eventEmail.NavigateUrl = string.Format("mailto:{0}", Renderer.Render(t.Email));
                eventEmail.Visible     = !string.IsNullOrEmpty(t.Email);
                eventCost.Text         = Renderer.Render(t.Cost);

                discussionAccountEvents.DiscussionId = SessionManager.GetCount <TransitDiscussion, string, int>(
                    typeof(AccountEvent).Name, RequestId, SessionManager.DiscussionService.GetOrCreateDiscussionId);
                discussionAccountEvents.DataBind();

                if (SessionManager.IsAdministrator)
                {
                    linkFeature.Text = (LatestAccountEventFeature != null)
                        ? string.Format("Feature &#187; Last on {0}", Adjust(LatestAccountEventFeature.Created).ToString("d"))
                        : "Feature &#187; Never Featured";
                }

                panelOwner.Visible = SessionManager.IsLoggedIn &&
                                     (SessionManager.IsAdministrator || t.AccountId == SessionManager.Account.Id);

                TransitPlace pl = AccountEventPlace;
                placeImage.Src         = string.Format("PlacePictureThumbnail.aspx?id={0}", pl.PictureId);
                placeLink2.HRef        = placeLink.HRef = string.Format("PlaceView.aspx?id={0}", pl.Id);
                placeNeighborhood.Text = Renderer.Render(pl.Neighborhood);
                placeName.Text         = Renderer.Render(pl.Name);
                placeCity.Text         = Renderer.Render(pl.City);
                placeState.Text        = Renderer.Render(pl.State);
                placeCountry.Text      = Renderer.Render(pl.Country);

                labelSchedule.Text = Renderer.Render(t.Schedule);
            }
        }
    }