Пример #1
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("System Preferences", Request, "SystemPreferencesManage.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode("Cities", Request, "SystemCitiesManage.aspx"));

            DomainClass cs = SessionManager.GetDomainClass("City");
            inputName.MaxLength = cs["Name"].MaxLengthInChars;
            inputTag.MaxLength  = cs["Tag"].MaxLengthInChars;

            string defaultcountry = SessionManager.GetCachedConfiguration("SnCore.Country.Default", "United States");
            inputCountry.DataSource = SessionManager.GetCollection <TransitCountry, string>(
                defaultcountry, (ServiceQueryOptions)null, SessionManager.LocationService.GetCountriesWithDefault);
            inputCountry.DataBind();

            if (RequestId > 0)
            {
                TransitCity tc = SessionManager.LocationService.GetCityById(
                    SessionManager.Ticket, RequestId);
                inputName.Text = tc.Name;
                inputTag.Text  = tc.Tag;
                ListItemManager.TrySelect(inputCountry, tc.Country);
                inputCountry_SelectedIndexChanged(sender, e);
                ListItemManager.TrySelect(inputState, tc.State);
                sitemapdata.Add(new SiteMapDataAttributeNode(tc.Name, Request.Url));
            }
            else if (!string.IsNullOrEmpty(Request["city"]))
            {
                LocationSelectorCountryState ls = new LocationSelectorCountryState(
                    this, true, inputCountry, inputState);
                ls.SelectLocation(sender, new LocationEventArgs(Request));
                inputName.Text = Request["city"];
            }
            else
            {
                inputCountry_SelectedIndexChanged(sender, e);
                panelMerge.Visible = false;
                sitemapdata.Add(new SiteMapDataAttributeNode("New City", Request.Url));
            }

            StackSiteMap(sitemapdata);
        }

        SetDefaultButton(manageAdd);
        PageManager.SetDefaultButton(mergeLookup, panelMerge.Controls);
    }
Пример #2
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("System Preferences", Request, "SystemPreferencesManage.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode("Cities", Request, "SystemCitiesManage.aspx"));

            DomainClass cs = SessionManager.GetDomainClass("City");
            inputName.MaxLength = cs["Name"].MaxLengthInChars;
            inputTag.MaxLength = cs["Tag"].MaxLengthInChars;

            string defaultcountry = SessionManager.GetCachedConfiguration("SnCore.Country.Default", "United States");
            inputCountry.DataSource = SessionManager.GetCollection<TransitCountry, string>(
                defaultcountry, (ServiceQueryOptions)null, SessionManager.LocationService.GetCountriesWithDefault);
            inputCountry.DataBind();

            if (RequestId > 0)
            {
                TransitCity tc = SessionManager.LocationService.GetCityById(
                    SessionManager.Ticket, RequestId);
                inputName.Text = tc.Name;
                inputTag.Text = tc.Tag;
                ListItemManager.TrySelect(inputCountry, tc.Country);
                inputCountry_SelectedIndexChanged(sender, e);
                ListItemManager.TrySelect(inputState, tc.State);
                sitemapdata.Add(new SiteMapDataAttributeNode(tc.Name, Request.Url));
            }
            else if (!string.IsNullOrEmpty(Request["city"]))
            {
                LocationSelectorCountryState ls = new LocationSelectorCountryState(
                    this, true, inputCountry, inputState);
                ls.SelectLocation(sender, new LocationEventArgs(Request));
                inputName.Text = Request["city"];
            }
            else
            {
                inputCountry_SelectedIndexChanged(sender, e);
                panelMerge.Visible = false;
                sitemapdata.Add(new SiteMapDataAttributeNode("New City", Request.Url));
            }

            StackSiteMap(sitemapdata);
        }

        SetDefaultButton(manageAdd);
        PageManager.SetDefaultButton(mergeLookup, panelMerge.Controls);
    }