示例#1
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int pagenumber = int.Parse(Request["PageNumber"]);
            int pagecount  = int.Parse(Request["PageCount"]);
            int pagesize   = int.Parse(Request["PageSize"]);

            TransitPlaceQueryOptions options        = new TransitPlaceQueryOptions();
            ServiceQueryOptions      serviceoptions = new ServiceQueryOptions();
            serviceoptions.PageSize   = pagesize;
            serviceoptions.PageNumber = pagenumber;
            gridManage.DataSource     = SessionManager.PlaceService.GetPlaces(
                SessionManager.Ticket, options, serviceoptions);
            gridManage.DataBind();

            if (pagenumber > 0)
            {
                linkPrev.HRef = string.Format("PlacesViewList.aspx?PageNumber={0}&PageSize={1}&PageCount={2}",
                                              pagenumber - 1, pagesize, pagecount);
            }

            if (pagenumber < pagecount - 1)
            {
                linkNext.HRef = string.Format("PlacesViewList.aspx?PageNumber={0}&PageSize={1}&PageCount={2}",
                                              pagenumber + 1, pagesize, pagecount);
            }
        }
    }
示例#2
0
    public void Page_Load(object sender, EventArgs e)
    {
            if (!IsPostBack)
            {
                int pagenumber = int.Parse(Request["PageNumber"]);
                int pagecount = int.Parse(Request["PageCount"]);
                int pagesize = int.Parse(Request["PageSize"]);

                TransitPlaceQueryOptions options = new TransitPlaceQueryOptions();
                ServiceQueryOptions serviceoptions = new ServiceQueryOptions();
                serviceoptions.PageSize = pagesize;
                serviceoptions.PageNumber = pagenumber;
                gridManage.DataSource = SessionManager.PlaceService.GetPlaces(
                    SessionManager.Ticket, options, serviceoptions);
                gridManage.DataBind();

                if (pagenumber > 0)
                    linkPrev.HRef = string.Format("PlacesViewList.aspx?PageNumber={0}&PageSize={1}&PageCount={2}",
                        pagenumber - 1, pagesize, pagecount);

                if (pagenumber < pagecount - 1)
                    linkNext.HRef = string.Format("PlacesViewList.aspx?PageNumber={0}&PageSize={1}&PageCount={2}",
                        pagenumber + 1, pagesize, pagecount);
            }
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            linkSuggestFeature.HRef =
                string.Format("BugEdit.aspx?pid={0}&type=Suggestion",
                              SessionManager.GetCachedConfiguration(
                                  "SnCore.NewFeature.ProjectId", "0"));

            linkReportBug.HRef =
                string.Format("BugEdit.aspx?pid={0}&type=Bug",
                              SessionManager.GetCachedConfiguration(
                                  "SnCore.Bug.ProjectId", "0"));

            linkSiteDiscussion.HRef =
                string.Format("DiscussionView.aspx?id={0}",
                              SessionManager.GetCachedConfiguration(
                                  "SnCore.Site.DiscussionId", "0"));

            linkBlog.HRef =
                string.Format("AccountBlogView.aspx?id={0}",
                              SessionManager.GetCachedConfiguration(
                                  "SnCore.Blog.Id", "0"));

            AccountActivityQueryOptions aaqo = new AccountActivityQueryOptions();
            listAccounts.DataSource = GetPagedList(SessionManager.SocialService.GetAccountActivityCount(SessionManager.Ticket, aaqo));
            listAccounts.DataBind();

            TransitAccountFeedQueryOptions fqo = new TransitAccountFeedQueryOptions();
            listFeeds.DataSource = GetPagedList(SessionManager.SyndicationService.GetAccountFeedsCount(SessionManager.Ticket, fqo));
            listFeeds.DataBind();

            TransitPlaceQueryOptions pqo = new TransitPlaceQueryOptions();
            listPlaces.DataSource = GetPagedList(SessionManager.PlaceService.GetPlacesCount(SessionManager.Ticket, pqo));
            listPlaces.DataBind();

            TransitAccountEventQueryOptions aeqo = new TransitAccountEventQueryOptions();
            listAccountEvents.DataSource = GetPagedList(SessionManager.EventService.GetAccountEventsCount(SessionManager.Ticket, aeqo));
            listAccountEvents.DataBind();

            listAccountGroups.DataSource = GetPagedList(SessionManager.GroupService.GetAccountGroupsCount(SessionManager.Ticket));
            listAccountGroups.DataBind();

            listStories.DataSource = GetPagedList(SessionManager.StoryService.GetAllAccountStoriesCount(SessionManager.Ticket));
            listStories.DataBind();

            listDiscussions.DataSource = SessionManager.DiscussionService.GetDiscussions(SessionManager.Ticket, null);
            listDiscussions.DataBind();

            listSurveys.DataSource = SessionManager.ObjectService.GetSurveys(SessionManager.Ticket, null);
            listSurveys.DataBind();
        }
    }
示例#4
0
    private TransitPlaceQueryOptions GetQueryOptions()
    {
        TransitPlaceQueryOptions options = new TransitPlaceQueryOptions();

        options.PicturesOnly = checkboxPicturesOnly.Checked;
        options.Neighborhood = inputNeighborhood.Text;
        options.City         = inputCity.Text;
        options.Country      = inputCountry.SelectedValue;
        options.State        = inputState.SelectedValue;
        options.Name         = inputName.Text;
        options.Type         = inputType.SelectedValue;
        return(options);
    }
示例#5
0
    void gridManage_OnGetDataSource(object sender, EventArgs e)
    {
        TransitPlaceQueryOptions options = GetQueryOptions();

        string args = string.Format("city={0}&country={1}&state={2}&name={3}&type={4}&pictures={5}&neighborhood={6}&page={7}",
                                    Renderer.UrlEncode(options.City),
                                    Renderer.UrlEncode(options.Country),
                                    Renderer.UrlEncode(options.State),
                                    Renderer.UrlEncode(options.Name),
                                    Renderer.UrlEncode(options.Type),
                                    Renderer.UrlEncode(options.PicturesOnly),
                                    Renderer.UrlEncode(options.Neighborhood),
                                    gridManage.CurrentPageIndex);

        Title = titlePlaces.Text = (string.IsNullOrEmpty(options.City)
            ? titlePlaces.DefaultText
            : string.Format("{0}: {1}", titlePlaces.DefaultText, options.City));

        if (IsPostBack)
        {
            Title = string.Format("{0} - {1}", SessionManager.GetCachedConfiguration(
                                      "SnCore.Title", "SnCore"), titlePlaces.Text);
        }

        linkRelRss.NavigateUrl    = string.Format("PlacesRss.aspx?{0}", args);
        linkPermalink.NavigateUrl = string.Format("PlacesView.aspx?{0}", args);

        if (((SnCoreMasterPage)Master).ScriptManager.IsInAsyncPostBack &&
            !((SnCoreMasterPage)Master).ScriptManager.IsNavigating)
        {
            NameValueCollection history = new NameValueCollection();
            history.Add("city", options.City);
            history.Add("country", options.Country);
            history.Add("state", options.State);
            history.Add("name", options.Name);
            history.Add("type", options.Type);
            history.Add("picturesonly", options.PicturesOnly.ToString());
            history.Add("neighborhood", options.Neighborhood);
            history.Add("page", gridManage.CurrentPageIndex.ToString());
            ((SnCoreMasterPage)Master).ScriptManager.AddHistoryPoint(history, Page.Title);
        }

        ServiceQueryOptions serviceoptions = new ServiceQueryOptions(gridManage.PageSize, gridManage.CurrentPageIndex);

        gridManage.DataSource = SessionManager.GetCollection <TransitPlace, TransitPlaceQueryOptions>(
            options, serviceoptions, SessionManager.PlaceService.GetPlaces);

        panelLinks.Update();
    }
示例#6
0
    public void gridManage_ItemCommand(object source, DataGridCommandEventArgs e)
    {
        switch (e.Item.ItemType)
        {
            case ListItemType.AlternatingItem:
            case ListItemType.Item:
            case ListItemType.SelectedItem:
            case ListItemType.EditItem:

                int id = int.Parse(e.Item.Cells[(int)Cells.id].Text);
                switch (e.CommandName)
                {
                    case "Delete":                        
                        
                        TransitCity t_city = SessionManager.LocationService.GetCityById(
                            SessionManager.Ticket, id);
                        
                        // deleting a city may need to orphan places
                        TransitPlaceQueryOptions t_placeoptions = new TransitPlaceQueryOptions();
                        t_placeoptions.City = t_city.Name;
                        t_placeoptions.Country = t_city.Country;
                        t_placeoptions.State = t_city.State;
                        t_placeoptions.PicturesOnly = false;
                        int count = SessionManager.PlaceService.GetPlacesCount(SessionManager.Ticket, t_placeoptions);
                        if (count > 0) 
                        {
                            throw new Exception(string.Format("You must orphan {0} place(s) to delete this city.",
                                count));
                        }

                        SessionManager.Delete<TransitCity>(id, SessionManager.LocationService.DeleteCity);
                        ReportInfo("City deleted.");
                        gridManage.CurrentPageIndex = 0;
                        gridManage_OnGetDataSource(source, e);
                        gridManage.DataBind();
                        break;
                }
                break;
        }
    }
示例#7
0
    public void gridManage_ItemCommand(object source, DataGridCommandEventArgs e)
    {
        switch (e.Item.ItemType)
        {
        case ListItemType.AlternatingItem:
        case ListItemType.Item:
        case ListItemType.SelectedItem:
        case ListItemType.EditItem:

            int id = int.Parse(e.Item.Cells[(int)Cells.id].Text);
            switch (e.CommandName)
            {
            case "Delete":

                TransitCity t_city = SessionManager.LocationService.GetCityById(
                    SessionManager.Ticket, id);

                // deleting a city may need to orphan places
                TransitPlaceQueryOptions t_placeoptions = new TransitPlaceQueryOptions();
                t_placeoptions.City         = t_city.Name;
                t_placeoptions.Country      = t_city.Country;
                t_placeoptions.State        = t_city.State;
                t_placeoptions.PicturesOnly = false;
                int count = SessionManager.PlaceService.GetPlacesCount(SessionManager.Ticket, t_placeoptions);
                if (count > 0)
                {
                    throw new Exception(string.Format("You must orphan {0} place(s) to delete this city.",
                                                      count));
                }

                SessionManager.Delete <TransitCity>(id, SessionManager.LocationService.DeleteCity);
                ReportInfo("City deleted.");
                gridManage.CurrentPageIndex = 0;
                gridManage_OnGetDataSource(source, e);
                gridManage.DataBind();
                break;
            }
            break;
        }
    }
示例#8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TransitPlaceQueryOptions options = new TransitPlaceQueryOptions();
            options.SortAscending = Ascending;
            options.SortOrder     = SortOrder;
            options.Neighborhood  = Neighborhood;
            options.City          = City;
            options.Country       = Country;
            options.State         = State;
            options.Name          = Name;
            options.Type          = Type;
            options.PicturesOnly  = Pictures;

            ServiceQueryOptions queryoptions = new ServiceQueryOptions();
            queryoptions.PageNumber = 0;
            queryoptions.PageSize   = 10;

            rssRepeater.DataSource = SessionManager.PlaceService.GetPlaces(
                SessionManager.Ticket, options, queryoptions);
            rssRepeater.DataBind();
        }
    }
示例#9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            linkSuggestFeature.HRef =
                string.Format("BugEdit.aspx?pid={0}&type=Suggestion",
                       SessionManager.GetCachedConfiguration(
                        "SnCore.NewFeature.ProjectId", "0"));

            linkReportBug.HRef =
                string.Format("BugEdit.aspx?pid={0}&type=Bug",
                       SessionManager.GetCachedConfiguration(
                        "SnCore.Bug.ProjectId", "0"));

            linkSiteDiscussion.HRef =
                string.Format("DiscussionView.aspx?id={0}",
                       SessionManager.GetCachedConfiguration(
                        "SnCore.Site.DiscussionId", "0"));

            linkBlog.HRef = 
                string.Format("AccountBlogView.aspx?id={0}",
                       SessionManager.GetCachedConfiguration(
                        "SnCore.Blog.Id", "0"));

            AccountActivityQueryOptions aaqo = new AccountActivityQueryOptions();
            listAccounts.DataSource = GetPagedList(SessionManager.SocialService.GetAccountActivityCount(SessionManager.Ticket, aaqo));
            listAccounts.DataBind();

            TransitAccountFeedQueryOptions fqo = new TransitAccountFeedQueryOptions();
            listFeeds.DataSource = GetPagedList(SessionManager.SyndicationService.GetAccountFeedsCount(SessionManager.Ticket, fqo));
            listFeeds.DataBind();

            TransitPlaceQueryOptions pqo = new TransitPlaceQueryOptions();
            listPlaces.DataSource = GetPagedList(SessionManager.PlaceService.GetPlacesCount(SessionManager.Ticket, pqo));
            listPlaces.DataBind();

            TransitAccountEventQueryOptions aeqo = new TransitAccountEventQueryOptions();
            listAccountEvents.DataSource = GetPagedList(SessionManager.EventService.GetAccountEventsCount(SessionManager.Ticket, aeqo));
            listAccountEvents.DataBind();

            listAccountGroups.DataSource = GetPagedList(SessionManager.GroupService.GetAccountGroupsCount(SessionManager.Ticket));
            listAccountGroups.DataBind();

            listStories.DataSource = GetPagedList(SessionManager.StoryService.GetAllAccountStoriesCount(SessionManager.Ticket));
            listStories.DataBind();

            listDiscussions.DataSource = SessionManager.DiscussionService.GetDiscussions(SessionManager.Ticket, null);
            listDiscussions.DataBind();

            listSurveys.DataSource = SessionManager.ObjectService.GetSurveys(SessionManager.Ticket, null);
            listSurveys.DataBind();
        }
    }
示例#10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TransitPlaceQueryOptions options = new TransitPlaceQueryOptions();
            options.SortAscending = Ascending;
            options.SortOrder = SortOrder;
            options.Neighborhood = Neighborhood;
            options.City = City;
            options.Country = Country;
            options.State = State;
            options.Name = Name;
            options.Type = Type;
            options.PicturesOnly = Pictures;

            ServiceQueryOptions queryoptions = new ServiceQueryOptions();
            queryoptions.PageNumber = 0;
            queryoptions.PageSize = 10;

            rssRepeater.DataSource = SessionManager.PlaceService.GetPlaces(
                SessionManager.Ticket, options, queryoptions);
            rssRepeater.DataBind();
        }
    }
示例#11
0
 public List<TransitPlace> GetPlaces(string ticket, TransitPlaceQueryOptions qopt, ServiceQueryOptions options)
 {
     return WebServiceImpl<TransitPlace, ManagedPlace, Place>.GetList(
         ticket, options, qopt.CreateQuery());
 }
示例#12
0
 public int GetPlacesCount(string ticket, TransitPlaceQueryOptions qopt)
 {
     return WebServiceImpl<TransitPlace, ManagedPlace, Place>.GetCount(
         ticket, qopt.CreateCountQuery());
 }
示例#13
0
 private TransitPlaceQueryOptions GetQueryOptions()
 {
     TransitPlaceQueryOptions options = new TransitPlaceQueryOptions();
     options.PicturesOnly = checkboxPicturesOnly.Checked;
     options.Neighborhood = inputNeighborhood.Text;
     options.City = inputCity.Text;
     options.Country = inputCountry.SelectedValue;
     options.State = inputState.SelectedValue;
     options.Name = inputName.Text;
     options.Type = inputType.SelectedValue;
     return options;
 }
示例#14
0
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     TransitPlaceQueryOptions options = new TransitPlaceQueryOptions();
     gridManage.DataSource = SessionManager.PlaceService.GetPlaces(SessionManager.Ticket, options, null);
 }
示例#15
0
    void gridManage_OnGetDataSource(object sender, EventArgs e)
    {
        TransitPlaceQueryOptions options = new TransitPlaceQueryOptions();

        gridManage.DataSource = SessionManager.PlaceService.GetPlaces(SessionManager.Ticket, options, null);
    }