コード例 #1
0
        public DataTable GetTask(Guid task_uuid)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("@task_uuid", task_uuid, DbType.Guid);
            return(DbActions.GetTable(coll, "vom_task_get", dp));
        }
コード例 #2
0
ファイル: DCategory.cs プロジェクト: thebinod7/vom
        public DataTable GetCategoryUUID(Category obj)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("category_name", obj.category_name, DbType.String);
            return(DbActions.GetTable(coll, "vom_category_getuuid", dp));
        }
コード例 #3
0
        protected virtual IQuery CreateQuery(
            string id, StorageProviderDefinition storageProviderDefinition, string statement, CommandParameter[] commandParameters, QueryType queryType)
        {
            ArgumentUtility.CheckNotNullOrEmpty("id", id);
            ArgumentUtility.CheckNotNull("storageProviderDefinition", storageProviderDefinition);
            ArgumentUtility.CheckNotNull("statement", statement);
            ArgumentUtility.CheckNotNull("commandParameters", commandParameters);

            var queryParameters = new QueryParameterCollection();

            foreach (var commandParameter in commandParameters)
            {
                queryParameters.Add(commandParameter.Name, commandParameter.Value, QueryParameterType.Value);
            }

            if (queryType == QueryType.Scalar)
            {
                return(QueryFactory.CreateScalarQuery(id, storageProviderDefinition, statement, queryParameters));
            }
            else if (queryType == QueryType.Collection)
            {
                return(QueryFactory.CreateCollectionQuery(id, storageProviderDefinition, statement, queryParameters, typeof(DomainObjectCollection)));
            }
            else
            {
                return(QueryFactory.CreateCustomQuery(id, storageProviderDefinition, statement, queryParameters));
            }
        }
コード例 #4
0
        public void InsertMethod(DataTable dt)
        {
            string sql = "INSERT INTO T_METHODS(MID,MNAME,COMMENTARY,DETAIL,VALUETYPE,METHODTYPE) " +
                         "Values(@MID,@MNAME,@COMMENTARY,@DETAIL,@VALUETYPE,@METHODTYPE)";

            QueryParameterCollection para = new QueryParameterCollection();

            para.Add("@MID", dt.Rows[0]["MID"]);
            para.Add("@MNAME", dt.Rows[0]["MNAME"]);
            para.Add("@COMMENTARY", dt.Rows[0]["COMMENTARY"]);
            para.Add("@DETAIL", dt.Rows[0]["DETAIL"]);
            para.Add("@VALUETYPE", dt.Rows[0]["VALUETYPE"]);
            para.Add("@METHODTYPE", dt.Rows[0]["METHODTYPE"]);

            _data.Open();

            try
            {
                _data.ExecuteNonQuery(sql, para);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                _data.Close();
            }
        }
コード例 #5
0
        public async Task <SourceResponse <BaseTrack> > GetItemsAsync(int count, string token,
                                                                      CancellationTokenSource cancellationToken = default(CancellationTokenSource))
        {
            // Call the SoundCloud API and get the items
            var tracks = await SoundByteService.Current.GetAsync <TrackHolder>(ServiceType.SoundCloud, $"/users/{User.UserId}/tracks",
                                                                               new Dictionary <string, string>
            {
                { "limit", count.ToString() },
                { "linked_partitioning", "1" },
                { "offset", token }
            }, cancellationToken).ConfigureAwait(false);

            // If there are no tracks
            if (!tracks.Response.Tracks.Any())
            {
                return(new SourceResponse <BaseTrack>(null, null, false, "Nothing to hear here", "Follow " + User.Username + " for updates on sounds they share in the future."));
            }

            // Parse uri for cursor
            var param     = new QueryParameterCollection(tracks.Response.NextList);
            var nextToken = param.FirstOrDefault(x => x.Key == "offset").Value;

            // Convert SoundCloud specific tracks to base tracks
            var baseTracks = new List <BaseTrack>();

            tracks.Response.Tracks.ForEach(x => baseTracks.Add(x.ToBaseTrack()));

            // Return the items
            return(new SourceResponse <BaseTrack>(baseTracks, nextToken));
        }
コード例 #6
0
        public override async Task <SourceResponse> GetItemsAsync(int count, string token,
                                                                  CancellationToken cancellationToken = default(CancellationToken))
        {
            // If the user has not connected their SoundByte account.
            if (!SoundByteService.Current.IsSoundByteAccountConnected)
            {
                return(await Task.Run(() =>
                                      new SourceResponse(null, null, false,
                                                         Resources.Resources.Sources_SoundByte_NoAccount_Title,
                                                         Resources.Resources.Sources_SoundByte_Like_NoAccount_Description)));
            }

            var likes = await SoundByteService.Current.GetAsync <LikesOutputModel>(ServiceTypes.SoundByte, "likes", new Dictionary <string, string>
            {
                { "PageNumber", token },
                { "PageSize", "30" }
            }, cancellationToken).ConfigureAwait(false);

            if (!likes.Response.Items.Any())
            {
                return(new SourceResponse(null, null, false, "No Likes", "Like a SoundCloud / Fanburst track or a YouTube music video to start!"));
            }

            var nextPage = likes.Response.Links.FirstOrDefault(x => x.Rel == "next_page");

            if (nextPage == null)
            {
                return(new SourceResponse(likes.Response.Items.Select(x => new BaseSoundByteItem(x)), "eol"));
            }

            var param     = new QueryParameterCollection(nextPage.Href);
            var nextToken = param.FirstOrDefault(x => x.Key == "PageNumber").Value;

            return(new SourceResponse(likes.Response.Items.Select(x => new BaseSoundByteItem(x)), nextToken));
        }
コード例 #7
0
        public DataTable GetProject(Guid project_uuid)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("@project_uuid", project_uuid, DbType.Guid);
            return(DbActions.GetTable(coll, "vom_project_get", dp));
        }
コード例 #8
0
        public override async Task <SourceResponse> GetItemsAsync(int count, string token, CancellationToken cancellationToken = default(CancellationToken))
        {
            // Call the SoundCloud API and get the items
            var users = await SoundByteService.Current.GetAsync <SearchUserHolder>(ServiceTypes.SoundCloud, "/users",
                                                                                   new Dictionary <string, string>
            {
                { "limit", count.ToString() },
                { "linked_partitioning", "1" },
                { "offset", token },
                { "q", WebUtility.UrlEncode(SearchQuery) }
            }, cancellationToken).ConfigureAwait(false);

            // If there are no users
            if (!users.Response.Users.Any())
            {
                return(new SourceResponse(null, null, false, Resources.Resources.Sources_All_NoResults_Title, string.Format(Resources.Resources.Sources_All_Search_NotResults_Description, SearchQuery)));
            }

            // Parse uri for offset
            var param     = new QueryParameterCollection(users.Response.NextList);
            var nextToken = param.FirstOrDefault(x => x.Key == "offset").Value;

            // Convert SoundCloud specific users to base users
            var baseUsers = new List <BaseSoundByteItem>();

            users.Response.Users.ForEach(x => baseUsers.Add(new BaseSoundByteItem(x.ToBaseUser())));

            // Return the items
            return(new SourceResponse(baseUsers, nextToken));
        }
コード例 #9
0
ファイル: DCategory.cs プロジェクト: thebinod7/vom
        public DataTable ListCategory(Category obj)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("company_uuid", obj.company_uuid, DbType.String);
            return(DbActions.GetTable(coll, "vom_category_list", dp));
        }
コード例 #10
0
        public override async Task <SourceResponse> GetItemsAsync(int count, string token,
                                                                  CancellationToken cancellationToken = default(CancellationToken))
        {
            // Convert SoundCloud specific playlists to base playlists
            var basePlaylists = new List <BaseSoundByteItem>();

            var endpoint    = $"/users/{UserId}/playlists";
            var serviceType = ServiceTypes.SoundCloud;

            // Call the SoundCloud api and get the items
            var playlists = await SoundByteService.Current.GetAsync <UserPlaylistHolder>(serviceType, endpoint,
                                                                                         new Dictionary <string, string>
            {
                { "limit", count.ToString() },
                { "offset", token },
                { "linked_partitioning", "1" }
            }, cancellationToken).ConfigureAwait(false);

            // If there are no tracks
            if (!playlists.Response.Playlists.Any())
            {
                return(new SourceResponse(null, null, false, "Nothing to hear here", "This user has uploaded no playlists"));
            }

            // Parse uri for cursor
            var param     = new QueryParameterCollection(playlists.Response.NextList);
            var nextToken = param.FirstOrDefault(x => x.Key == "offset").Value;

            playlists.Response.Playlists.ForEach(x => basePlaylists.Add(new BaseSoundByteItem(x.ToBasePlaylist())));

            // Return the items
            return(new SourceResponse(basePlaylists, nextToken));
        }
コード例 #11
0
        public DataTable GetEmployee(Guid user_uuid)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("@user_uuid", user_uuid, DbType.Guid);
            return(DbActions.GetTable(coll, "vom_employee_get", dp));
        }
コード例 #12
0
        public DataTable GetEmployeeDetails(Employees obj)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("email", obj.email, DbType.String);
            return(DbActions.GetTable(coll, "vom_employee_getdetails", dp));
        }
コード例 #13
0
        public DataTable ListEmployeeCount(Guid company_uuid)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("@company_uuid", company_uuid, DbType.String);
            return(DbActions.GetTable(coll, "vom_employee_count", dp));
        }
コード例 #14
0
        //public DataTable EditEmployee(Employees obj)
        //{
        //    QueryParameterCollection coll = new QueryParameterCollection();
        //    coll.Add("uuid", obj.uuid, DbType.Guid);
        //    coll.Add("emp_name", obj.emp_name, DbType.String);
        //    coll.Add("emp_salary", obj.emp_salary, DbType.Int64);
        //    coll.Add("email", obj.email, DbType.String);
        //    coll.Add("password", obj.password, DbType.String);
        //    coll.Add("emp_department", obj.emp_department, DbType.String);
        //    coll.Add("emp_phone_number", obj.emp_phone_number, DbType.Int64);
        //    coll.Add("emp_address", obj.emp_address, DbType.String);
        //    DataTable dt = DbActions.GetTable(coll, "vom_employee_editprofile", dp);
        //    return dt;
        //}
        public DataTable ListEmployee(Employees obj)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("company_uuid", obj.company_uuid, DbType.String);
            return(DbActions.GetTable(coll, "vom_employee_list", dp));
        }
コード例 #15
0
ファイル: DCategory.cs プロジェクト: thebinod7/vom
        public DataTable GetCategory(Guid category_uuid)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("@category_uuid", category_uuid, DbType.Guid);
            return(DbActions.GetTable(coll, "vom_category_get", dp));
        }
コード例 #16
0
ファイル: DCategory.cs プロジェクト: thebinod7/vom
        public DataTable RemoveCategory(string uuid)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("uuid", uuid, DbType.String);
            return(DbActions.GetTable(coll, "vom_category_remove", dp));
        }
コード例 #17
0
        public override void SetUp()
        {
            base.SetUp();

            _parameter  = new QueryParameter("name", "value");
            _collection = new QueryParameterCollection();
        }
コード例 #18
0
        public async Task <SourceResponse <BaseUser> > GetItemsAsync(int count, string token,
                                                                     CancellationTokenSource cancellationToken = default(CancellationTokenSource))
        {
            // Call the SoundCloud API and get the items
            var followings = await SoundByteV3Service.Current.GetAsync <UserListHolder>(ServiceType.SoundCloud, $"/users/{User.Id}/{Type}",
                                                                                        new Dictionary <string, string>
            {
                { "limit", count.ToString() },
                { "linked_partitioning", "1" },
                { "cursor", token }
            }, cancellationToken).ConfigureAwait(false);

            // If there are no users
            if (!followings.Users.Any())
            {
                return(new SourceResponse <BaseUser>(null, null, false, "No users", "This user does not follow anything  have anyone following them"));
            }

            // Parse uri for cursor
            var param     = new QueryParameterCollection(followings.NextList);
            var nextToken = param.FirstOrDefault(x => x.Key == "cursor").Value;

            // Convert SoundCloud specific tracks to base tracks
            var baseUsers = new List <BaseUser>();

            followings.Users.ForEach(x => baseUsers.Add(x.ToBaseUser()));

            // Return the items
            return(new SourceResponse <BaseUser>(baseUsers, nextToken));
        }
コード例 #19
0
        protected DbCommand CreateCommand(string sqlQuery, QueryParameterCollection parameters)
        {
            DbCommand dbCommand = Connection.CreateCommand();

            dbCommand.CommandType = CommandType.Text;
            dbCommand.CommandText = sqlQuery;

            dbCommand.Transaction = CurrentTransaction;


            dbCommand.CommandText = Regex.Replace(sqlQuery, @"@(?<name>[a-z0-9A-Z_]+)", match => SqlDialect.CreateParameterExpression(match.Value.Substring(1)));

            if (parameters != null)
            {
                foreach (var parameter in parameters)
                {
                    IDbDataParameter dataParameter = dbCommand.CreateParameter();

                    dataParameter.ParameterName = SqlDialect.CreateParameterExpression(parameter.Name);
                    dataParameter.Direction     = ParameterDirection.Input;
                    dataParameter.DbType        = DbType(parameter.Type);

                    dataParameter.Value = ConvertParameter(parameter.Value);

                    dbCommand.Parameters.Add(dataParameter);
                }
            }

            return(dbCommand);
        }
コード例 #20
0
        public DataTable GetProjectUUID(Project obj)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("project_name", obj.project_name, DbType.String);
            return(DbActions.GetTable(coll, "vom_project_getuuid", dp));
        }
コード例 #21
0
        public override async Task <SourceResponse> GetItemsAsync(int count, string token,
                                                                  CancellationToken cancellationToken = default(CancellationToken))
        {
            // Call the SoundCloud API and get the items
            var tracks = await SoundByteService.Current.GetAsync <ExploreTrackHolder>(ServiceTypes.SoundCloudV2, "/charts",
                                                                                      new Dictionary <string, string>
            {
                { "genre", "soundcloud%3Agenres%3A" + Genre },
                { "kind", Kind },
                { "limit", count.ToString() },
                { "offset", token },
                { "linked_partitioning", "1" }
            }, cancellationToken).ConfigureAwait(false);

            // If there are no tracks
            if (!tracks.Response.Tracks.Any())
            {
                return(new SourceResponse(null, null, false, "No results found", "No items matching"));
            }

            // Parse uri for offset
            var param     = new QueryParameterCollection(tracks.Response.NextList);
            var nextToken = param.FirstOrDefault(x => x.Key == "offset").Value;

            // Convert SoundCloud specific tracks to base tracks
            var baseTracks = new List <BaseSoundByteItem>();

            tracks.Response.Tracks.ForEach(x => baseTracks.Add(new BaseSoundByteItem(x.Track.ToBaseTrack())));

            // Return the items
            return(new SourceResponse(baseTracks, nextToken));
        }
コード例 #22
0
        public override async Task <SourceResponse> GetItemsAsync(int count, string token,
                                                                  CancellationToken cancellationToken = default(CancellationToken))
        {
            // Call the SoundCloud API and get the items
            var tracks = await SoundByteService.Current.GetAsync <LikeTrackHolder>(ServiceTypes.SoundCloud, $"/users/{UserId}/favorites",
                                                                                   new Dictionary <string, string>
            {
                { "limit", count.ToString() },
                { "linked_partitioning", "1" },
                { "cursor", token }
            }, cancellationToken).ConfigureAwait(false);

            // If there are no tracks
            if (!tracks.Response.Tracks.Any())
            {
                return(new SourceResponse(null, null, false, "No likes", "This user has not liked any tracks"));
            }

            // Parse uri for cursor
            var param     = new QueryParameterCollection(tracks.Response.NextList);
            var nextToken = param.FirstOrDefault(x => x.Key == "cursor").Value;

            // Convert SoundCloud specific tracks to base tracks
            var baseTracks = new List <BaseSoundByteItem>();

            tracks.Response.Tracks.ForEach(x => baseTracks.Add(new BaseSoundByteItem(x.ToBaseTrack())));

            // Return the items
            return(new SourceResponse(baseTracks, nextToken));
        }
コード例 #23
0
        private static void AppendKeyClause(StringBuilder statement, QueryParameterCollection parameters, IRevisionKey key, ISqlDialect sqlDialect)
        {
            string revisionGlobalKeyColumn    = GetRevisionGlobalKeyColumnIdentifier(sqlDialect);
            string revisionLocalKeyColumn     = GetRevisionLocalKeyColumnIdentifier(sqlDialect);
            string revisionGlobalKeyParameter = sqlDialect.GetParameterName("globalKey");
            string revisionLocalKeyParameter  = sqlDialect.GetParameterName("localKey");

            statement.Append(revisionGlobalKeyColumn);
            statement.Append(" = ");
            statement.Append(revisionGlobalKeyParameter);
            if (!parameters.Contains(revisionGlobalKeyParameter))
            {
                parameters.Add(new QueryParameter(revisionGlobalKeyParameter, key.GlobalKey));
            }

            statement.Append(" AND ");
            statement.Append(revisionLocalKeyColumn);
            if (string.IsNullOrEmpty(key.LocalKey))
            {
                statement.Append(" IS NULL");
                if (!parameters.Contains(revisionLocalKeyParameter))
                {
                    parameters.Add(new QueryParameter(revisionLocalKeyParameter, null));
                }
            }
            else
            {
                statement.Append(" = ");
                statement.Append(revisionLocalKeyParameter);
                if (!parameters.Contains(revisionLocalKeyParameter))
                {
                    parameters.Add(new QueryParameter(revisionLocalKeyParameter, key.LocalKey));
                }
            }
        }
コード例 #24
0
        public async Task <SourceResponse <BaseTrack> > GetItemsAsync(int count, string token,
                                                                      CancellationTokenSource cancellationToken = default(CancellationTokenSource))
        {
            // Call the SoundCloud API and get the items
            var tracks = await SoundByteService.Current.GetAsync <TrackListHolder>(ServiceType.SoundCloud, "/tracks",
                                                                                   new Dictionary <string, string>
            {
                { "limit", count.ToString() },
                { "linked_partitioning", "1" },
                { "offset", token },
                { "q", WebUtility.UrlEncode(SearchQuery) }
            }, cancellationToken).ConfigureAwait(false);

            // If there are no tracks
            if (!tracks.Response.Tracks.Any())
            {
                return(new SourceResponse <BaseTrack>(null, null, false, "No results found", "Could not find any results for '" + SearchQuery + "'"));
            }

            // Parse uri for offset
            var param     = new QueryParameterCollection(tracks.Response.NextList);
            var nextToken = param.FirstOrDefault(x => x.Key == "offset").Value;

            // Convert SoundCloud specific tracks to base tracks
            var baseTracks = new List <BaseTrack>();

            tracks.Response.Tracks.ForEach(x => baseTracks.Add(x.ToBaseTrack()));

            // Return the items
            return(new SourceResponse <BaseTrack>(baseTracks, nextToken));
        }
コード例 #25
0
        public static IQuery GetGetRevisionQuery(IRevisionKey revisionKey)
        {
            ArgumentUtility.CheckNotNull("revisionKey", revisionKey);

            var storageProviderDefinition = GetStorageProviderDefinition();
            var sqlDialect = storageProviderDefinition.Factory.CreateSqlDialect(storageProviderDefinition);

            var parameters = new QueryParameterCollection();

            var statement = new StringBuilder();

            statement.Append("SELECT ");
            statement.Append(GetRevisionValueColumnIdentifier(sqlDialect));
            statement.Append(" FROM ");
            statement.Append(GetRevisionTableIdentifier(sqlDialect));
            statement.Append(" WHERE (");
            AppendKeyClause(statement, parameters, revisionKey, sqlDialect);
            statement.Append(")");
            statement.Append(sqlDialect.StatementDelimiter);

            return(QueryFactory.CreateQuery(
                       new QueryDefinition(
                           typeof(Revision) + "." + MethodBase.GetCurrentMethod().Name,
                           storageProviderDefinition,
                           statement.ToString(),
                           QueryType.Scalar),
                       parameters));
        }
コード例 #26
0
ファイル: XpoObjectHacker.cs プロジェクト: krazana/eXpand
 int FindIdentityValue(QueryParameterCollection queryParameterCollection, SimpleDataLayer simpleDataLayer) {
     using (var session = new Session(simpleDataLayer) { IdentityMapBehavior = IdentityMapBehavior.Strong }) {
         var typeName = queryParameterCollection[0].Value.ToString();
         var assemblyName = queryParameterCollection[1].Value.ToString();
         return session.FindObject<XPObjectType>(type => type.TypeName == typeName && type.AssemblyName == assemblyName).Oid;
     }
 }
コード例 #27
0
        public override async Task <SourceResponse> GetItemsAsync(int count, string token, CancellationToken cancellationToken = default(CancellationToken))
        {
            // Call the SoundCloud API and get the items
            var items = await SoundByteService.Current.GetAsync <TrackHolder>(ServiceTypes.SoundCloud, $"/tracks/{TrackId}/related",
                                                                              new Dictionary <string, string>
            {
                { "limit", count.ToString() },
                { "linked_partitioning", "1" },
                { "cursor", token }
            }, cancellationToken).ConfigureAwait(false);

            // If there are no tracks
            if (!items.Response.Tracks.Any())
            {
                return(new SourceResponse(null, null, false, "No items", "Follow someone to get started."));
            }

            // Parse uri for cursor
            var param     = new QueryParameterCollection(items.Response.NextList);
            var nextToken = param.FirstOrDefault(x => x.Key == "cursor").Value;

            // Convert the items to base items
            var baseItems = new List <BaseSoundByteItem>();

            foreach (var item in items.Response.Tracks)
            {
                baseItems.Add(new BaseSoundByteItem(item.ToBaseTrack()));
            }

            // Return the items
            return(new SourceResponse(baseItems, nextToken));
        }
コード例 #28
0
        public override void Purge(TableSchema schema)
        {
            var tableName = SqlDialect.QuoteTable(schema.MappedName);

            ExecuteSql($"DELETE FROM {tableName}", null);
            ExecuteSql("delete from sqlite_sequence where name=@name", QueryParameterCollection.FromObject(new { name = schema.MappedName }));
        }
コード例 #29
0
        public override void SetUp()
        {
            base.SetUp();

            _dbCommandBuilderFactoryStrictMock = MockRepository.GenerateStrictMock <IDbCommandBuilderFactory>();

            _objectReaderFactoryStrictMock = MockRepository.GenerateStrictMock <IObjectReaderFactory>();
            _dataStoragePropertyDefinitionFactoryStrictMock = MockRepository.GenerateStrictMock <IDataStoragePropertyDefinitionFactory> ();

            _factory = new QueryCommandFactory(
                _objectReaderFactoryStrictMock,
                _dbCommandBuilderFactoryStrictMock,
                _dataStoragePropertyDefinitionFactoryStrictMock);

            _dataContainerReader1Stub = MockRepository.GenerateStub <IObjectReader <DataContainer> >();
            _resultRowReaderStub      = MockRepository.GenerateStub <IObjectReader <IQueryResultRow> >();

            _queryParameter1 = new QueryParameter("first", DomainObjectIDs.Order1);
            _queryParameter2 = new QueryParameter("second", DomainObjectIDs.Order3.Value);
            _queryParameter3 = new QueryParameter("third", DomainObjectIDs.Official1);
            var collection = new QueryParameterCollection {
                _queryParameter1, _queryParameter2, _queryParameter3
            };

            _queryStub = MockRepository.GenerateStub <IQuery>();
            _queryStub.Stub(stub => stub.Statement).Return("statement");
            _queryStub.Stub(stub => stub.Parameters).Return(new QueryParameterCollection(collection, true));

            _property1 = ObjectIDStoragePropertyDefinitionObjectMother.Create("Test");
            _property2 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty();
            _property3 = SerializedObjectIDStoragePropertyDefinitionObjectMother.Create("Test");
        }
コード例 #30
0
        public override async Task <SourceResponse> GetItemsAsync(int count, string token,
                                                                  CancellationToken cancellationToken = default(CancellationToken))
        {
            // If the user has not connected their SoundByte account.
            if (!SoundByteService.Current.IsSoundByteAccountConnected)
            {
                return(await Task.Run(() =>
                                      new SourceResponse(null, null, false,
                                                         Resources.Resources.Sources_SoundByte_NoAccount_Title,
                                                         Resources.Resources.Sources_SoundByte_History_NoAccount_Description)));
            }

            var history = await SoundByteService.Current.GetAsync <MostPlayedOutputModel>(ServiceTypes.SoundByte, "most-played", new Dictionary <string, string>
            {
                { "PageNumber", token },
                { "PageSize", "30" }
            }, cancellationToken).ConfigureAwait(false);

            if (!history.Response.Items.Any())
            {
                return(new SourceResponse(null, null, false, Resources.Resources.Sources_SoundByte_History_NoResults_Title, Resources.Resources.Sources_SoundByte_History_NoResults_Description));
            }

            var nextPage = history.Response.Links.FirstOrDefault(x => x.Rel == "next_page");

            if (nextPage == null)
            {
                return(new SourceResponse(history.Response.Items.Select(x => new BaseSoundByteItem(x)), "eol"));
            }

            var param     = new QueryParameterCollection(nextPage.Href);
            var nextToken = param.FirstOrDefault(x => x.Key == "PageNumber").Value;

            return(new SourceResponse(history.Response.Items.Select(x => new BaseSoundByteItem(x)), nextToken));
        }
コード例 #31
0
        public DataTable GetAssignedTask(Guid emp_uuid)
        {
            QueryParameterCollection coll = new QueryParameterCollection();

            coll.Add("@emp_uuid", emp_uuid, DbType.Guid);
            return(DbActions.GetTable(coll, "vom_employee_getassignedtask", dp));
        }
コード例 #32
0
ファイル: FacilityTests.cs プロジェクト: ruanzx/mausch
 public void SolrQueryBuilder()
 {
     var qb = container.Resolve<ISolrQueryBuilder>();
     qb.Query = new Query();
     var parameters = new List<QueryParameter> {new QueryParameter("price", "[500 TO 1000]")};
     var qp = new QueryParameterCollection("q", parameters);
     qb.Query.AddQueryParameters(qp, ParameterJoin.AND);
     var results = new SolrSearchResults(qb);
     Console.WriteLine(results.TotalResults);
 }
コード例 #33
0
        public void Can_Add_Parameter_To_Collection()
        {
            var pc = new QueryParameterCollection();
            pc.Add("file", "lenny.jpg");

            Assert.That(pc.Count, Is.EqualTo(1));

            var p1 = pc[0];

            Assert.That(p1.Key, Is.EqualTo("file"));
            Assert.That(p1.Value, Is.EqualTo("lenny.jpg"));
        }
コード例 #34
0
ファイル: Tests.cs プロジェクト: ruanzx/mausch
        public void Query()
        {
            var solrSearcher = new SolrSearcher("http://localhost:8983/solr/", Mode.ReadWrite);
            ISolrSearcher searcher = new SolrSearcherAdapter(solrSearcher);
            var updater = new SolrUpdater(solrSearcher);
            ISolrUpdater s = new SolrUpdaterAdapter(updater);
            ISolrQueryBuilder qb = new SolrQueryBuilder(searcher);

            qb.Query = new Query();
            var parameters = new List<QueryParameter>();
            parameters.Add(new QueryParameter("price", "[500 TO 1000]"));
            var qp = new QueryParameterCollection("q", parameters);
            qb.Query.AddQueryParameters(qp, ParameterJoin.AND);
            var results = new SolrSearchResults(qb);
            Console.WriteLine(results.TotalResults);
        }
コード例 #35
0
        private string GenerateOpenAuthorization(HttpRequestDetails httpRequest, string signatureMethod, string nonce, string timestamp)
        {
            QueryParameterCollection signatureParameters = new QueryParameterCollection();

            foreach (var queryParameter in httpRequest.QueryParameters)
            {
                signatureParameters.Add(queryParameter);
            }

            signatureParameters.Add(new QueryParameter(OAuthVersionKey, OAuthVersion));
            signatureParameters.Add(new QueryParameter(OAuthNonceKey, nonce));
            signatureParameters.Add(new QueryParameter(OAuthTimestampKey, timestamp));
            signatureParameters.Add(new QueryParameter(OAuthSignatureMethodKey, signatureMethod));
            signatureParameters.Add(new QueryParameter(OAuthConsumerKeyKey, openAuthorizationDetails.ConsumerKey));

            return string.Empty;
        }
コード例 #36
0
ファイル: MemoryDataProvider.cs プロジェクト: abrobston/DB
 public IEnumerable<SerializedEntity> Query(string sql, QueryParameterCollection parameters)
 {
     throw new NotSupportedException();
 }
コード例 #37
0
ファイル: MemoryDataProvider.cs プロジェクト: abrobston/DB
 public int ExecuteSql(string sql, QueryParameterCollection parameters)
 {
     throw new NotSupportedException();
 }
コード例 #38
0
 public void Can_Create_Empty_Parameter_Collection()
 {
     var pc = new QueryParameterCollection();
     Assert.That(pc, Is.Not.Null);
 }
コード例 #39
0
ファイル: MemoryDataProvider.cs プロジェクト: abrobston/DB
 public IEnumerable<object> QueryScalar(string sql, QueryParameterCollection parameters)
 {
     throw new NotSupportedException();
 }
コード例 #40
0
ファイル: YZStringHelper.cs プロジェクト: linxueyang/F7
    public static string GetKeyWordString(QueryParameterCollection peramaterDefines, BPMDBParameterCollection currentParamaters)
    {
        StringBuilder sb = new StringBuilder();
        foreach (BPMDBParameter parameter in currentParamaters)
        {
            QueryParameter queryParameter = peramaterDefines.TryGetItem(parameter.Name);
            if (queryParameter == null)
                continue;

            if (queryParameter.ParameterUIBindType != BPM.Data.Common.ParameterUIBindType.QuickSearch &&
                queryParameter.ParameterUIBindType != BPM.Data.Common.ParameterUIBindType.AdvancedSearch &&
                queryParameter.ParameterUIBindType != BPM.Data.Common.ParameterUIBindType.Both)
                continue;

            if (parameter.Value == null)
                continue;

            string keyword = parameter.Value.ToString().Trim();
            if (String.IsNullOrEmpty(keyword))
                continue;

            if (sb.Length != 0)
                sb.Append(";");

            sb.Append(keyword);
        }

        return sb.ToString();
    }
コード例 #41
0
 private SelectStatementResult GetDataForTables(ICollection tables, TablesFilter filter, string queryText)
 {
     QueryParameterCollection parameters = new QueryParameterCollection();
     List<SelectStatementResult> resultList = new List<SelectStatementResult>();
     int paramIndex = 0;
     int pos = 0;
     int count = tables.Count;
     int currentSize = 0;
     StringCollection inGroup = null;
     foreach (DBTable table in tables)
     {
         if (currentSize == 0)
         {
             if (inGroup == null)
             {
                 inGroup = new StringCollection();
             }
             else
             {
                 if (inGroup.Count == 0)
                 {
                     resultList.Add(new SelectStatementResult());
                 }
                 resultList.Add(SelectData(new Query(string.Format(CultureInfo.InvariantCulture, queryText, StringListHelper.DelimitedText(inGroup, ",")), parameters, inGroup)));
                 inGroup.Clear();
                 parameters.Clear();
             }
             paramIndex = 0;
             currentSize = (pos < count) ? (count - pos < 15 ? count - pos : 15) : 0;
         }
         if (filter == null || filter(table))
         {
             parameters.Add(new OperandValue(ComposeSafeTableName(table.Name)));
             inGroup.Add(":p" + paramIndex.ToString(CultureInfo.InvariantCulture));
             ++paramIndex;
             --currentSize;
         }
         ++pos;
     }
     if (inGroup != null && inGroup.Count > 0)
     {
         resultList.Add(SelectData(new Query(string.Format(CultureInfo.InvariantCulture, queryText, StringListHelper.DelimitedText(inGroup, ",")), parameters, inGroup)));
     }
     if (resultList.Count == 0) return new SelectStatementResult();
     if (resultList.Count == 1) return resultList[0];
     int fullResultSize = 0;
     for (int i = 0; i < resultList.Count; i++)
     {
         fullResultSize += resultList[i].Rows.Length;
     }
     if (fullResultSize == 0) return new SelectStatementResult();
     SelectStatementResultRow[] fullResult = new SelectStatementResultRow[fullResultSize];
     int copyPos = 0;
     for (int i = 0; i < resultList.Count; i++)
     {
         Array.Copy(resultList[i].Rows, 0, fullResult, copyPos, resultList[i].Rows.Length);
         copyPos += resultList[i].Rows.Length;
     }
     return new SelectStatementResult(fullResult);
 }
コード例 #42
0
 /// <summary>
 /// Конструктор с указанным представителем форматирования запросов и параметрами
 /// </summary>
 /// <param name="formatter">Представитель форматирования запросов</param>
 /// <param name="identities">Представитель идентификации одинаковых параметров</param>
 /// <param name="parameters">Параметры</param>
 public OracleSecuredModifySqlGenerator(ISecuredSqlGeneratorFormatter formatter, TaggedParametersHolder identities, Dictionary<OperandValue, string> parameters)
     : base(formatter, identities, parameters)
 {
     this.formatterSequred = formatter;
     this.identitiesByTag = identities;
     this.commandParams = new QueryParameterCollection();
     this.commandParamsNames = new List<string>();
 }
コード例 #43
0
 /// <summary>
 /// Переопределяет создание команды
 /// </summary>
 /// <param name="sql">Sql-команда</param>
 /// <param name="parameters">Параметры команды</param>
 /// <param name="parametersNames">Имена параметров запроса</param>
 /// <returns>Запрос на основе исходного</returns>
 protected override Query CreateQuery(string sql, QueryParameterCollection parameters, IList parametersNames)
 {
     return new Query(sql, commandParams, commandParamsNames);
 }
コード例 #44
0
 /// <summary>
 /// Переопределяет создание запроса
 /// </summary>
 /// <param name="sql">Sql-выражение</param>
 /// <param name="parameters">Параметры запроса</param>
 /// <param name="parametersNames">Имена параметров запроса</param>
 /// <returns>Запрос на основе исходного</returns>
 protected override Query CreateQuery(string sql, QueryParameterCollection parameters, IList parametersNames)
 {
     return new Query(sql, parameters, parametersNames, Root.SkipSelectedRecords, Root.TopSelectedRecords, constantValues, operandIndexes);
 }
コード例 #45
0
ファイル: SolrQueryBuilder.cs プロジェクト: ruanzx/mausch
 private void AddSearchTerms(string searchterms)
 {
     if (searchterms != null && searchterms != "") {
         var qp = new QueryParameter(SolrSearcher.SolrSchema.DefaultSearchField, searchterms);
         var qpList = new List<QueryParameter> {qp};
         var qps = new QueryParameterCollection("default", qpList);
         Query.AddQueryParameters(qps, ParameterJoin.OR);
     }
 }