예제 #1
0
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions serviceoptions = new ServiceQueryOptions(gridManage.PageSize, gridManage.CurrentPageIndex);
     gridManage.DataSource = SessionManager.GetCollection<TransitAccountGroup>(
         serviceoptions, SessionManager.GroupService.GetAccountGroups);
     panelLinks.Update();
 }
 void PlaceWebsites_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions(PlaceWebsites.PageSize, PlaceWebsites.CurrentPageIndex);
     PlaceWebsites.DataSource = SessionManager.GetCollection<TransitPlaceWebsite, int>(
         PlaceId, options, SessionManager.PlaceService.GetPlaceWebsites);
     panelGrid.Update();
 }
예제 #3
0
 public ServiceQueryOptions GetServiceQueryOptions()
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageNumber = Grid.CurrentPageIndex;
     options.PageSize = Grid.PageSize;
     return options;
 }
예제 #4
0
 void queue_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageNumber = queue.CurrentPageIndex;
     options.PageSize = queue.PageSize;
     queue.DataSource = SessionManager.PlaceService.GetPlaceQueueItems(SessionManager.Ticket, RequestId, options);
 }
예제 #5
0
 public List <TransitAccountGroup> GetPublicAccountGroups(string ticket, ServiceQueryOptions options)
 {
     ICriterion[] expressions = { Expression.Eq("IsPrivate", false) };
     Order[]      orders      = { Order.Desc("Created") };
     return(WebServiceImpl <TransitAccountGroup, ManagedAccountGroup, AccountGroup> .GetList(
                ticket, options, expressions, orders));
 }
예제 #6
0
 void gridManageFavorites_OnGetDataSource(object sender, EventArgs e)
 {
         ServiceQueryOptions serviceoptions = new ServiceQueryOptions(
             gridManageFavorites.PageSize, gridManageFavorites.CurrentPageIndex);
         gridManageFavorites.DataSource = SessionManager.GetCollection<TransitPlace>(
             serviceoptions, SessionManager.PlaceService.GetFavoritePlaces);
 }
예제 #7
0
 public List <TransitDiscussion> GetDiscussions(string ticket, ServiceQueryOptions options)
 {
     ICriterion[] expressions = { Expression.Eq("Personal", false) };
     Order[]      orders      = { Order.Desc("Modified") };
     return(WebServiceImpl <TransitDiscussion, ManagedDiscussion, Discussion> .GetList(
                ticket, options, expressions, orders));
 }
예제 #8
0
 public List <TransitBug> GetBugs(string ticket, int project_id, ServiceQueryOptions options)
 {
     ICriterion[] expressions = { Expression.Eq("Project.Id", project_id) };
     Order[]      orders      = { Order.Desc("Created") };
     return(WebServiceImpl <TransitBug, ManagedBug, Bug> .GetList(
                ticket, options, expressions, orders));
 }
예제 #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ServiceQueryOptions options = new ServiceQueryOptions();
         options.PageNumber = 0;
         options.PageSize = 10;
         // get new members
         rssRepeaterMembers.DataSource = SessionManager.GetCollection<TransitAccountGroupAccount, int>(
             AccountGroupId, options, SessionManager.GroupService.GetAccountGroupAccounts);
         rssRepeaterMembers.DataBind();
         // get new places
         rssRepeaterPlaces.DataSource = SessionManager.GetCollection<TransitAccountGroupPlace, int>(
             AccountGroupId, options, SessionManager.GroupService.GetAccountGroupPlaces);
         rssRepeaterPlaces.DataBind();
         // get new discussion posts
         discussionsRss.ObjectId = RequestId;
         discussionsRss.Type = "AccountGroup";
         // get new blog posts
         if (AccountGroup.AccountBlogId > 0)
         {
             rssRepeaterBlogItems.DataSource = SessionManager.GetCollection<TransitAccountBlogPost, TransitAccountBlogPostQueryOptions>(
                 GetBlogPostsOptions(), options, SessionManager.BlogService.GetAccountBlogPosts);
             rssRepeaterBlogItems.DataBind();
         }
     }
 }
예제 #10
0
 public List <TransitState> GetStatesByCountryId(string ticket, int id, ServiceQueryOptions options)
 {
     ICriterion[] expressions = { Expression.Eq("Country.Id", id) };
     Order[]      orders      = { Order.Asc("Name") };
     return(WebServiceImpl <TransitState, ManagedState, State> .GetList(
                ticket, options, expressions, orders));
 }
예제 #11
0
 public List <TransitMadLib> GetMadLibs(string ticket, int id, ServiceQueryOptions options)
 {
     ICriterion[] expressions = { Expression.Eq("Account.Id", id) };
     Order[]      orders      = { Order.Desc("Created") };
     return(WebServiceImpl <TransitMadLib, ManagedMadLib, MadLib> .GetList(
                ticket, options, expressions, orders));
 }
예제 #12
0
    private void GetData()
    {
        ServiceQueryOptions serviceoptions = new ServiceQueryOptions();
        serviceoptions.PageSize = accounts.RepeatColumns;

        // accounts
        accounts.DataSource = SessionManager.GetCollection<TransitFeature, string>(
            "Account", serviceoptions, SessionManager.ObjectService.GetFeatures);
        accounts.DataBind();

        // places
        places.DataSource = SessionManager.GetCollection<TransitFeature, string>(
            "Place", serviceoptions, SessionManager.ObjectService.GetFeatures);
        places.DataBind();

        // feeds
        accountfeeds.DataSource = SessionManager.GetCollection<TransitFeature, string>(
            "AccountFeed", serviceoptions, SessionManager.ObjectService.GetFeatures);
        accountfeeds.DataBind();

        // events
        TransitAccountEventInstanceQueryOptions eventoptions = new TransitAccountEventInstanceQueryOptions();
        eventoptions.StartDateTime = DateTime.UtcNow;
        eventoptions.EndDateTime = DateTime.MaxValue;
        accountevents.DataSource = SessionManager.GetCollection<TransitAccountEventInstance, TransitAccountEventInstanceQueryOptions>(
            eventoptions, serviceoptions, SessionManager.EventService.GetAccountEventInstances);
        accountevents.DataBind();
    }
예제 #13
0
 public List <TransitAccountStory> GetAllAccountStories(string ticket, ServiceQueryOptions options)
 {
     ICriterion[] expressions = { Expression.Eq("Publish", true) };
     Order[]      orders      = { Order.Desc("Created") };
     return(WebServiceImpl <TransitAccountStory, ManagedAccountStory, AccountStory> .GetList(
                ticket, options, expressions, orders));
 }
예제 #14
0
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageNumber = gridManage.CurrentPageIndex;
     options.PageSize = gridManage.PageSize;
     gridManage.DataSource = SessionManager.MarketingService.GetCampaigns(SessionManager.Ticket, options);
 }
예제 #15
0
 public List<TransitAccountGroup> GetPublicAccountGroups(string ticket, ServiceQueryOptions options)
 {
     ICriterion[] expressions = { Expression.Eq("IsPrivate", false) };
     Order[] orders = { Order.Desc("Created") };
     return WebServiceImpl<TransitAccountGroup, ManagedAccountGroup, AccountGroup>.GetList(
         ticket, options, expressions, orders);
 }
예제 #16
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"]);

            ServiceQueryOptions serviceoptions = new ServiceQueryOptions();
            serviceoptions.PageSize = pagesize;
            serviceoptions.PageNumber = pagenumber;

            TransitAccountFeedQueryOptions options = new TransitAccountFeedQueryOptions();
            gridManage.DataSource = SessionManager.SyndicationService.GetAccountFeeds(
                SessionManager.Ticket, options, serviceoptions);
            gridManage.DataBind();

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

            if (pagenumber < pagecount - 1)
                linkNext.HRef = string.Format("AccountFeedsViewList.aspx?PageNumber={0}&PageSize={1}&PageCount={2}",
                    pagenumber + 1, pagesize, pagecount);
        }
    }
예제 #17
0
 public List <TransitRefererAccount> GetRefererAccounts(string ticket, ServiceQueryOptions options)
 {
     return(WebServiceImpl <TransitRefererAccount, ManagedRefererAccount, RefererAccount> .GetList(
                ticket, options, "SELECT {ra.*} FROM RefererAccount {ra}, RefererHost rh" +
                " WHERE ra.RefererHost_Id = rh.RefererHost_Id" +
                " ORDER BY rh.Total DESC", "ra"));
 }
예제 #18
0
 public List <TransitCity> GetCitiesByStateId(string ticket, int id, ServiceQueryOptions options)
 {
     ICriterion[] expressions = { Expression.Eq("State.Id", id) };
     Order[]      orders      = { Order.Asc("Name") };
     return(WebServiceImpl <TransitCity, ManagedCity, City> .GetList(
                ticket, options, expressions, orders));
 }
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageSize = gridManage.PageSize;
     options.PageNumber = gridManage.CurrentPageIndex;
     gridManage.DataSource = SessionManager.AccountService.GetAllAccountRedirects(SessionManager.Ticket, options);
 }
예제 #20
0
 public List <TransitBugNote> GetBugNotes(string ticket, int bug_id, ServiceQueryOptions options)
 {
     ICriterion[] expressions = { Expression.Eq("Bug.Id", bug_id) };
     Order[]      orders      = { Order.Desc("Modified") };
     return(WebServiceImpl <TransitBugNote, ManagedBugNote, BugNote> .GetList(
                ticket, options, expressions, orders));
 }
 void accountWebsites_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions(accountWebsites.PageSize, accountWebsites.CurrentPageIndex);
     accountWebsites.DataSource = SessionManager.GetCollection<TransitAccountWebsite, int>(
         AccountId, options, SessionManager.AccountService.GetAccountWebsites);
     panelGrid.Update();
 }
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions(gridManage.PageSize, gridManage.CurrentPageIndex);
     gridManage.DataSource = SessionManager.GetCollection<TransitAccount, string, string, string>(
         Request["GroupName"], Request["PropertyName"], Request["PropertyValue"], options,
         SessionManager.AccountService.GetAccountsByPropertyValue);
 }
예제 #23
0
 public static List <TransitType> GetList(string ticket, ServiceQueryOptions options, ICriterion[] expressions, Order[] orders, GetTransformedInstanceDelegate functor)
 {
     using (SnCore.Data.Hibernate.Session.OpenConnection())
     {
         ISession session           = SnCore.Data.Hibernate.Session.Current;
         ManagedSecurityContext sec = new ManagedSecurityContext(session, ticket);
         ICriteria criteria         = session.CreateCriteria(typeof(DataType));
         // optional criterion expressions
         if (expressions != null)
         {
             foreach (ICriterion criterion in expressions)
             {
                 criteria.Add(criterion);
             }
         }
         // options orders
         if (orders != null)
         {
             foreach (Order order in orders)
             {
                 criteria.AddOrder(order);
             }
         }
         // query options
         if (options != null && options.PageSize > 0)
         {
             criteria.SetMaxResults(options.PageSize);
         }
         if (options != null && options.FirstResult > 0)
         {
             criteria.SetFirstResult(options.FirstResult);
         }
         return(GetTransformedList(session, sec, criteria.List <DataType>(), functor));
     }
 }
예제 #24
0
 void placesList_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions(placesList.PageSize, placesList.CurrentPageIndex);
     placesList.DataSource = SessionManager.GetCollection<TransitAccountPlace, int>(
         AccountId, options, SessionManager.PlaceService.GetAccountPlaces);
     panelGrid.Update();
 }
    public string GetReplies(int post_id, int thread_id)
    {
        StringBuilder result = new StringBuilder();
        
        ServiceQueryOptions options = new ServiceQueryOptions();
        options.PageNumber = 0;
        options.PageSize = 3;
        IList<TransitDiscussionPost> items = SessionManager.GetCollection<TransitDiscussionPost, int>(
            thread_id, options, SessionManager.DiscussionService.GetDiscussionThreadPostsByOrder);
        
        foreach (TransitDiscussionPost t_instance in items)
        {
            if (t_instance.Id == post_id)
                continue;

            result.Append(string.Format("<div>&#187; <b>{0}</b> replied {1}</a></div>",
                Renderer.Render(t_instance.AccountName), 
                SessionManager.ToAdjustedString(t_instance.Created)));
        }
        
        if (result.Length > 0)
        {
            result.Insert(0, "<div class=\"sncore_message_reply\">");
            result.Append("</div>");
        }

        return result.ToString();
    }
예제 #26
0
 public List<TransitAccountBlog> GetAccountBlogs(string ticket, int id, ServiceQueryOptions options)
 {
     ICriterion[] expression = { Expression.Eq("Account.Id", id) };
     Order[] orders = { Order.Desc("Created") };
     return WebServiceImpl<TransitAccountBlog, ManagedAccountBlog, AccountBlog>.GetList(
         ticket, options, expression, orders);
 }
 public void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageNumber = gridManage.CurrentPageIndex;
     options.PageSize = gridManage.PageSize;
     gridManage.DataSource = SessionManager.GetCollection<TransitDiscussionPost>(
         options, SessionManager.DiscussionService.GetDiscussionTopOfThreads);
 }
예제 #28
0
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageSize = gridManage.PageSize;
     options.PageNumber = gridManage.CurrentPageIndex;
     gridManage.DataSource = SessionManager.PlaceService.GetPlaceAttributes(
         SessionManager.Ticket, RequestId, options);
 }
 void picturesView_OnGetDataSource(object sender, EventArgs e)
 {
     AccountPicturesQueryOptions po = new AccountPicturesQueryOptions();
     po.Hidden = false;
     ServiceQueryOptions options = new ServiceQueryOptions(picturesView.PageSize, picturesView.CurrentPageIndex);
     picturesView.DataSource = SessionManager.GetCollection<TransitAccountPicture, int, AccountPicturesQueryOptions>(
         AccountId, po, options, SessionManager.AccountService.GetAccountPictures);
 }
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageNumber = discussionThreadView.CurrentPageIndex;
     options.PageSize = discussionThreadView.PageSize;
     discussionThreadView.DataSource = SessionManager.GetCollection<TransitDiscussionPost, DiscussionQueryOptions>(
         QueryOptions, options, SessionManager.DiscussionService.GetUserDiscussionThreads);
 }
 void accountsList_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageNumber = accountsList.CurrentPageIndex;
     options.PageSize = accountsList.PageSize;
     accountsList.DataSource = SessionManager.GetCollection<TransitAccountPlaceFavorite, int>(
         PlaceId, options, SessionManager.PlaceService.GetAccountPlaceFavorites);
 }
예제 #32
0
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageSize = gridManage.PageSize;
     options.PageNumber = gridManage.CurrentPageIndex;
     gridManage.DataSource = SessionManager.EventService.GetAccountEventsByAccountId(
         SessionManager.Ticket, SessionManager.AccountId, SessionManager.UtcOffset.Ticks, options);
 }
예제 #33
0
 void gridActivity_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageSize = gridActivity.PageSize;
     options.PageNumber = gridActivity.CurrentPageIndex;
     gridActivity.DataSource = SessionManager.GetCollection<TransitAccountAuditEntry>(
         options, SessionManager.SocialService.GetAccountAuditEntries);
 }
예제 #34
0
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageNumber = gridManage.CurrentPageIndex;
     options.PageSize = gridManage.PageSize;
     gridManage.DataSource = SessionManager.SyndicationService.GetAccountFeeds(
         SessionManager.Ticket, GetOptions(), options);
 }
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageSize = gridManage.PageSize;
     options.PageNumber = gridManage.CurrentPageIndex;
     gridManage.DataSource = SessionManager.StoryService.GetAccountStoryPictures(
         SessionManager.Ticket, RequestId, options);
 }
예제 #36
0
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions serviceoptions = new ServiceQueryOptions();
     serviceoptions.PageSize = gridManage.PageSize;
     serviceoptions.PageNumber = gridManage.CurrentPageIndex;
     gridManage.DataSource = SessionManager.GetCollection<TransitFeature, string>(
         "Account", serviceoptions, SessionManager.ObjectService.GetFeatures);
 }
예제 #37
0
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageNumber = gridManage.CurrentPageIndex;
     options.PageSize = gridManage.PageSize;
     gridManage.DataSource = SessionManager.GetCollection<TransitAccountFriend, TransitAccountFriendQueryOptions>(
         GetOptions(), options, SessionManager.SocialService.GetAccountFriends);
 }
예제 #38
0
 void gridManage_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageNumber = gridManage.CurrentPageIndex;
     options.PageSize = gridManage.PageSize;
     gridManage.DataSource = SessionManager.GetCollection<TransitAccountInvitation, int>(
         SessionManager.AccountId, options, SessionManager.AccountService.GetAccountInvitationsByAccountId);
 }
 void accountSurveyAnswers_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageSize = accountSurveyAnswers.PageSize;
     options.PageNumber = accountSurveyAnswers.CurrentPageIndex;
     accountSurveyAnswers.DataSource = SessionManager.GetCollection<TransitAccountSurveyAnswer, int>(
         SurveyQuestionId, options, SessionManager.AccountService.GetAccountSurveyAnswersByQuestionId);
 }
 void listSent_OnGetDataSource(object sender, EventArgs e)
 {
     ServiceQueryOptions options = new ServiceQueryOptions();
     options.PageNumber = listSent.CurrentPageIndex;
     options.PageSize = listSent.PageSize;
     listSent.DataSource = SessionManager.SocialService.GetSentAccountFriendRequests(
         SessionManager.Ticket, SessionManager.AccountId, options);
 }
예제 #41
0
 public List <TransitConfiguration> GetConfigurations(string ticket, ServiceQueryOptions options)
 {
     using (SnCore.Data.Hibernate.Session.OpenConnection())
     {
         ISession session           = SnCore.Data.Hibernate.Session.Current;
         ManagedSecurityContext sec = new ManagedSecurityContext(session, ticket);
         return(WebServiceQueryOptions <TransitConfiguration> .Apply(options,
                                                                     WebServiceImpl <TransitConfiguration, ManagedConfiguration, Configuration> .GetTransformedList(
                                                                         session, sec, ManagedConfiguration.GetAllConfigurations(session))));
     }
 }
예제 #42
0
        public List <TransitDiscussion> GetAccountDiscussions(string ticket, int id, ServiceQueryOptions options)
        {
            ICriterion[] expressions =
            {
                Expression.Eq("Personal",   false),
                Expression.Eq("Account.Id", id)
            };

            return(WebServiceImpl <TransitDiscussion, ManagedDiscussion, Discussion> .GetList(
                       ticket, options, expressions, null));
        }
예제 #43
0
 public List <TransitDiscussionPost> GetDiscussionTopOfThreads(string ticket, ServiceQueryOptions options)
 {
     return(WebServiceImpl <TransitDiscussionPost, ManagedDiscussionPost, DiscussionPost> .GetList(
                ticket, options,
                "SELECT {Post.*} FROM DiscussionPost {Post}, DiscussionThread Thread, Discussion Discussion" +
                " WHERE Post.DiscussionThread_Id = Thread.DiscussionThread_Id" +
                " AND Thread.Discussion_Id = Discussion.Discussion_Id" +
                " AND Post.DiscussionPostParent_Id IS NULL" +
                " AND Discussion.Personal = 0" +
                " ORDER BY Post.Sticky DESC, Thread.Modified DESC",
                "Post"));
 }
예제 #44
0
        public static List <T> Apply(ServiceQueryOptions options, IList <T> collection)
        {
            if (options == null)
            {
                List <T> result = new List <T>();
                result.AddRange(collection);
                return(result);
            }

            return(SnCore.Data.Hibernate.Collection <T> .ApplyServiceOptions(
                       options.FirstResult, options.PageSize, collection));
        }
예제 #45
0
        public TransitRssChannelItems GetAccountRssWatchItems(string ticket, int id, ServiceQueryOptions options)
        {
            using (SnCore.Data.Hibernate.Session.OpenConnection())
            {
                ISession session                = SnCore.Data.Hibernate.Session.Current;
                ManagedSecurityContext sec      = new ManagedSecurityContext(session, ticket);
                ManagedAccountRssWatch rsswatch = new ManagedAccountRssWatch(session, id);
                TransitRssChannelItems result   = rsswatch.GetSubscriptionUpdates(sec);
                result.Items = WebServiceQueryOptions <TransitRssItem> .Apply(options, result.Items);

                return(result);
            }
        }
예제 #46
0
 public List <TransitAccount> GetActiveAccounts(string ticket, ServiceQueryOptions options)
 {
     return(WebServiceImpl <TransitAccount, ManagedAccount, Account> .GetList(
                ticket, options,
                "SELECT Account FROM Account Account WHERE EXISTS (" +
                " FROM AccountPicture AccountPicture " +
                " WHERE AccountPicture.Account = Account AND AccountPicture.Hidden = 0" +
                ") AND EXISTS (" +
                " FROM AccountEmail AccountEmail " +
                " WHERE AccountEmail.Account = Account AND " +
                " AccountEmail.Verified = 1" +
                ") ORDER BY Account.LastLogin DESC"));
 }
예제 #47
0
        public List <TransitAccount> GetTagWordAccountsById(string ticket, int id, ServiceQueryOptions options)
        {
            StringBuilder query = new StringBuilder();

            query.AppendFormat(
                "SELECT acct FROM Account acct, TagWordAccount twa " +
                "WHERE acct.Id = twa.AccountId " +
                "AND twa.TagWord.Id = {0} " +
                "ORDER BY acct.LastLogin DESC",
                id);

            return(WebServiceImpl <TransitAccount, ManagedAccount, Account> .GetList(
                       ticket, options, query.ToString()));
        }
예제 #48
0
        public List <TransitAccount> FindRefererAccounts(string ticket, string uri, ServiceQueryOptions options)
        {
            string like = string.Format("%{0}%", Renderer.SqlEncode(uri));

            return(WebServiceImpl <TransitAccount, ManagedAccount, Account> .GetList(ticket, options,
                                                                                     "SELECT {Account.*} FROM {Account} WHERE EXISTS ( " +
                                                                                     " SELECT AccountWebsite.AccountWebsite_Id FROM AccountWebsite AccountWebsite " +
                                                                                     " WHERE Account.Account_Id = AccountWebsite.Account_Id AND AccountWebsite.Url LIKE '" + like + "'" +
                                                                                     " ) OR EXISTS (" +
                                                                                     " SELECT AccountFeed.AccountFeed_Id FROM AccountFeed AccountFeed " +
                                                                                     " WHERE Account.Account_Id = AccountFeed.Account_Id " +
                                                                                     " AND ( AccountFeed.LinkUrl LIKE '" + like + "' OR AccountFeed.FeedUrl LIKE '" + like + "')" +
                                                                                     ")", "Account"));
        }
예제 #49
0
 public List <TransitDiscussionPost> GetDiscussionThreads(string ticket, ServiceQueryOptions options)
 {
     return(WebServiceImpl <TransitDiscussionPost, ManagedDiscussionPost, DiscussionPost> .GetList(
                ticket, options,
                "SELECT {Post.*} FROM DiscussionPost {Post}" +
                " WHERE Post.DiscussionPost_Id IN ( " +
                " SELECT MAX(dp.DiscussionPost_Id) FROM DiscussionPost dp, DiscussionThread dt, Discussion d" +
                "  WHERE dp.DiscussionThread_Id = dt.DiscussionThread_Id" +
                "  AND d.Discussion_Id = dt.Discussion_Id" +
                "  AND d.Personal = 0" +
                "  GROUP BY dt.DiscussionThread_Id" +
                " ) ORDER BY Post.Sticky DESC, Post.Modified DESC",
                "Post"));
 }
예제 #50
0
 public static List <TransitType> GetList(string ticket, ServiceQueryOptions options, string sqlquery, string returnalias, GetTransformedInstanceDelegate functor)
 {
     using (SnCore.Data.Hibernate.Session.OpenConnection())
     {
         ISession session           = SnCore.Data.Hibernate.Session.Current;
         ManagedSecurityContext sec = new ManagedSecurityContext(session, ticket);
         IQuery query = session.CreateSQLQuery(sqlquery).AddEntity(returnalias, typeof(DataType));
         if (options != null && options.PageSize > 0)
         {
             query.SetMaxResults(options.PageSize);
         }
         if (options != null && options.FirstResult > 0)
         {
             query.SetFirstResult(options.FirstResult);
         }
         return(GetTransformedList(session, sec, query.List <DataType>(), functor));
     }
 }
예제 #51
0
 public static List <TransitType> GetListFromIds(string ticket, ServiceQueryOptions options, string sqlquery)
 {
     using (SnCore.Data.Hibernate.Session.OpenConnection())
     {
         ISession session           = SnCore.Data.Hibernate.Session.Current;
         ManagedSecurityContext sec = new ManagedSecurityContext(session, ticket);
         IQuery query = session.CreateQuery(sqlquery);
         if (options != null && options.PageSize > 0)
         {
             query.SetMaxResults(options.PageSize);
         }
         if (options != null && options.FirstResult > 0)
         {
             query.SetFirstResult(options.FirstResult);
         }
         return(GetTransformedList(session, sec, query.List <int>()));
     }
 }
예제 #52
0
 public static List <TransitType> GetListFromNamedQuery(string ticket, ServiceQueryOptions options, string namedquery, GetTransformedInstanceDelegate functor)
 {
     using (SnCore.Data.Hibernate.Session.OpenConnection())
     {
         ISession session           = SnCore.Data.Hibernate.Session.Current;
         ManagedSecurityContext sec = new ManagedSecurityContext(session, ticket);
         IQuery query = session.GetNamedQuery(namedquery);
         if (options != null && options.PageSize > 0)
         {
             query.SetMaxResults(options.PageSize);
         }
         if (options != null && options.FirstResult > 0)
         {
             query.SetFirstResult(options.FirstResult);
         }
         query = query.SetResultTransformer(Transformers.AliasToBean(typeof(DataType)));
         return(GetTransformedList(session, sec, query.List <DataType>(), functor));
     }
 }
예제 #53
0
 public List <TransitCampaignAccountRecepient> GetCampaignAccountRecepients(string ticket, int id, ServiceQueryOptions options)
 {
     ICriterion[] expressions = { Expression.Eq("Campaign.Id", id) };
     return(WebServiceImpl <TransitCampaignAccountRecepient, ManagedCampaignAccountRecepient, CampaignAccountRecepient> .GetList(
                ticket, options, expressions, null));
 }
예제 #54
0
 public List <TransitCampaign> GetCampaigns(string ticket, ServiceQueryOptions options)
 {
     return(WebServiceImpl <TransitCampaign, ManagedCampaign, Campaign> .GetList(
                ticket, options));
 }
예제 #55
0
 public List <TransitRefererHostDup> GetRefererHostDups(string ticket, ServiceQueryOptions options)
 {
     return(WebServiceImpl <TransitRefererHostDup, ManagedRefererHostDup, RefererHostDup> .GetList(
                ticket, options));
 }
예제 #56
0
 public List <TransitCounter> GetCounters(string ticket, ServiceQueryOptions options)
 {
     Order[] orders = { Order.Desc("Total") };
     return(WebServiceImpl <TransitCounter, ManagedCounter, Counter> .GetList(
                ticket, options, null, orders));
 }
예제 #57
0
 public List <TransitRefererQuery> GetRefererQueries(string ticket, ServiceQueryOptions options)
 {
     Order[] orders = { Order.Desc("Total") };
     return(WebServiceImpl <TransitRefererQuery, ManagedRefererQuery, RefererQuery> .GetList(
                ticket, options, null, orders));
 }
예제 #58
0
 public List <TransitRefererHost> GetRefererHosts(string ticket, RefererHostQueryOptions qopt, ServiceQueryOptions options)
 {
     return(WebServiceImpl <TransitRefererHost, ManagedRefererHost, RefererHost> .GetList(
                ticket, options, qopt.CreateQuery()));
 }
예제 #59
0
        public List <TransitAccount> SearchTagWordAccounts(string ticket, string search, ServiceQueryOptions options)
        {
            MatchCollection mc = Regex.Matches(search, @"\w+");

            if (mc.Count == 0)
            {
                return(null);
            }

            StringBuilder query = new StringBuilder();

            query.Append("SELECT DISTINCT acct FROM Account acct, TagWordAccount twa");
            query.Append(" WHERE acct.Id = twa.AccountId AND (");
            StringBuilder subquery = new StringBuilder();

            foreach (Match m in mc)
            {
                if (subquery.Length > 0)
                {
                    subquery.Append(" OR ");
                }

                subquery.Append(string.Format("twa.TagWord.Word LIKE '%{0}%'", m.Value.ToLower()));
            }
            query.Append(subquery);
            query.Append(") ORDER BY acct.LastLogin DESC");

            return(WebServiceImpl <TransitAccount, ManagedAccount, Account> .GetList(
                       ticket, options, query.ToString()));
        }
예제 #60
0
        public List <TransitTagWord> GetTagWords(string ticket, TransitTagWordQueryOptions queryoptions, ServiceQueryOptions options)
        {
            StringBuilder query = new StringBuilder();

            query.Append("SELECT word FROM TagWord word LEFT JOIN word.TagWordAccounts acct");
            query.Append(" GROUP BY word.Id, word.Promoted, word.Excluded, word.Word");
            switch (queryoptions)
            {
            case TransitTagWordQueryOptions.Excluded:
                query.Append(" WHERE Excluded = 1");
                break;

            case TransitTagWordQueryOptions.New:
                query.Append(" WHERE Excluded = 0 and Promoted = 0");
                break;

            case TransitTagWordQueryOptions.Promoted:
                query.Append(" WHERE Promoted = 1");
                break;
            }
            query.Append(" ORDER BY COUNT(acct) DESC");

            return(WebServiceImpl <TransitTagWord, ManagedTagWord, TagWord> .GetList(
                       ticket, options, query.ToString()));
        }