public int Add(Postgres connection, User user) { var queryConstructor = new QueryConstructor <User>(); var sql = queryConstructor.BuildeInsertQuery(user, "public", "user", false); return(connection.ExecuteReturnIdIntTransaction(sql, "id")); }
private List <Result> WindowsIndexTopLevelFolderSearch(Query query, string path) { var queryConstructor = new QueryConstructor(settings); return(indexSearch.WindowsIndexSearch(path, queryConstructor.CreateQueryHelper().ConnectionString, queryConstructor.QueryForTopLevelDirectorySearch, query)); }
private List <Result> WindowsIndexFilesAndFoldersSearch(Query query, string querySearchString) { var queryConstructor = new QueryConstructor(settings); return(indexSearch.WindowsIndexSearch(querySearchString, queryConstructor.CreateQueryHelper().ConnectionString, queryConstructor.QueryForAllFilesAndFolders, query)); }
public void GivenWindowsIndexSearch_WhenSearchTypeIsTopLevelDirectorySearch_ThenQueryShouldUseExpectedString(string folderPath, string expectedString) { // Given var queryConstructor = new QueryConstructor(new Settings()); //When var queryString = queryConstructor.QueryForTopLevelDirectorySearch(folderPath); // Then Assert.IsTrue(queryString == expectedString, $"Expected string: {expectedString}{Environment.NewLine} " + $"Actual string was: {queryString}{Environment.NewLine}"); }
public void GivenWindowsIndexSearch_WhenSearchPatternHotKeyIsSearchAll_ThenQueryWhereRestrictionsShouldUseScopeString(string path, string expectedString) { // Given var queryConstructor = new QueryConstructor(new Settings()); //When var resultString = queryConstructor.QueryWhereRestrictionsForTopLevelDirectoryAllFilesAndFoldersSearch(path); // Then Assert.IsTrue(resultString == expectedString, $"Expected QueryWhereRestrictions string: {expectedString}{Environment.NewLine} " + $"Actual string was: {resultString}{Environment.NewLine}"); }
public void GivenWindowsIndexSearchTopLevelDirectory_WhenSearchingForSpecificItem_ThenQueryWhereRestrictionsShouldUseDirectoryString( string userSearchString, string expectedString) { // Given var queryConstructor = new QueryConstructor(new Settings()); //When var queryString = queryConstructor.QueryWhereRestrictionsForTopLevelDirectorySearch(userSearchString); // Then Assert.IsTrue(queryString == expectedString, $"Expected string: {expectedString}{Environment.NewLine} " + $"Actual string was: {queryString}{Environment.NewLine}"); }
public void GivenWindowsIndexSearch_WhenProvidedFolderPath_ThenQueryWhereRestrictionsShouldUseDirectoryString(string path, string expectedString) { // Given var queryConstructor = new QueryConstructor(new Settings()); // When var folderPath = path; var result = queryConstructor.QueryWhereRestrictionsForTopLevelDirectorySearch(folderPath); // Then Assert.IsTrue(result == expectedString, $"Expected QueryWhereRestrictions string: {expectedString}{Environment.NewLine} " + $"Actual: {result}{Environment.NewLine}"); }
public void GivenWindowsIndexSearch_WhenSearchAllFoldersAndFiles_ThenQueryShouldUseExpectedString( string userSearchString, string expectedString) { // Given var queryConstructor = new QueryConstructor(new Settings()); //When var resultString = queryConstructor.QueryForAllFilesAndFolders(userSearchString); // Then Assert.IsTrue(resultString == expectedString, $"Expected query string: {expectedString}{Environment.NewLine} " + $"Actual string was: {resultString}{Environment.NewLine}"); }
private List <Result> WindowsIndexFileContentSearch(Query query, string querySearchString) { var queryConstructor = new QueryConstructor(settings); if (string.IsNullOrEmpty(querySearchString)) { return(new List <Result>()); } return(indexSearch.WindowsIndexSearch(querySearchString, queryConstructor.CreateQueryHelper().ConnectionString, queryConstructor.QueryForFileContentSearch, query)); }
public void GivenWindowsIndexSearch_WhenQueryWhereRestrictionsIsForFileContentSearch_ThenShouldReturnFreeTextString( string querySearchString, string expectedString) { // Given var queryConstructor = new QueryConstructor(new Settings()); //When var resultString = queryConstructor.QueryWhereRestrictionsForFileContentSearch(querySearchString); // Then Assert.IsTrue(resultString == expectedString, $"Expected QueryWhereRestrictions string: {expectedString}{Environment.NewLine} " + $"Actual string was: {resultString}{Environment.NewLine}"); }
public void TestQueryConstructor() { /* QueryConstructor qc = new QueryConstructor( * "Article", * "Content", * "Excursion", * "File", * "Region", * "Review", * "Sight", * "Timetable", * "User" * ); * * var root = qc.GetAttributes("User"); * * root.Children[1].Criterium = "*****@*****.**"; * * var query = qc.Query(Container.UserSet, root).ToArray(); */ try { Register("b", "b", "tema", UserStatus.Administrator); Register("a", "a", "tema"); Register("artem", "1234", "tema"); Register("arixhan", "1234", "jeembo"); Register("nobu", "1234", "drake"); Register("max", "1234", "future"); Register("ilya", "1234", "the weeknd"); Register("adrax", "1234", "the weeknd"); Register("shitajimado", "1234", "future"); } catch (Exception e) { } var qc = new QueryConstructor( "User", typeof(User) ); var node = qc.GetNode("Nickname"); node.Criterium = "future"; node.ComparisonOperator = BooleanOperator.NotEqual; var users = qc.Query(Container.UserSet).ToArray(); }
private void EntitiesComboBox_SelectedIndexChanged(object sender, EventArgs e) { var typename = (string)EntitiesComboBox.SelectedItem; var type = QueryConstructor.GetThisAssemblyType( typename ); mConstructor = new QueryConstructor(typename, type); QueryFlowLayout.Controls.Clear(); int y = 0; ConstructQuery(mConstructor.Root, 0, ref y); QueryButton.Enabled = true; }
public void GivenWindowsIndexSearch_WhenSearchAllFoldersAndFiles_ThenQueryShouldUseExpectedString( string userSearchString, string expectedString) { // Given var queryConstructor = new QueryConstructor(new Settings()); var baseQuery = queryConstructor.CreateBaseQuery(); // system running this test could have different locale than the hard-coded 1033 LCID en-US. var queryKeywordLocale = baseQuery.QueryKeywordLocale; expectedString = expectedString.Replace("1033", queryKeywordLocale.ToString()); //When var resultString = queryConstructor.QueryForAllFilesAndFolders(userSearchString); // Then Assert.IsTrue(resultString == expectedString, $"Expected query string: {expectedString}{Environment.NewLine} " + $"Actual string was: {resultString}{Environment.NewLine}"); }