public TResult Execute <TResult>(Expression expression) { var itemType = TypeHelper.GetElementType(expression.Type); var translator = new ExpressionToFTSRequestTranslator(); var queryString = translator.Translate(expression); return((TResult)(e3sClient.SearchFTS(itemType, queryString))); }
static void Main(string[] args) { var user = ConfigurationManager.AppSettings["user"]; var password = ConfigurationManager.AppSettings["password"]; var client = new E3SQueryClient(user, password); var res = client.SearchFTS <EmployeeEntity>("workstation:(EPRUIZHW0249)", 0, 1); Console.OutputEncoding = Encoding.UTF8; foreach (var emp in res) { Console.WriteLine("{0} {1}", emp.nativename, emp.shortstartworkdate); } var res1 = client.SearchFTS(typeof(EmployeeEntity), "workstation:(EPRUIZHW0249)", 0, 10); foreach (var emp in res1.OfType <EmployeeEntity>()) { Console.WriteLine("{0} {1}", emp.nativename, emp.shortstartworkdate); } var employees = new E3SEntitySet <EmployeeEntity>(user, password); foreach (var emp in employees.Where(e => e.workstation == "EPRUIZHW0249")) { Console.WriteLine("{0} {1}", emp.nativename, emp.shortstartworkdate); } foreach (var emp in employees.Where(e => "EPRUIZHW0249" == e.workstation)) { Console.WriteLine("{0} {1}", emp.nativename, emp.shortstartworkdate); } foreach (var emp in employees.Where(e => e.workstation.StartsWith("EPRUIZHW"))) { Console.WriteLine("{0} {1}", emp.nativename, emp.shortstartworkdate); } foreach (var emp in employees.Where(e => e.workstation.EndsWith("RUIZHW0249"))) { Console.WriteLine("{0} {1}", emp.nativename, emp.shortstartworkdate); } foreach (var emp in employees.Where(e => e.workstation.Contains("IZHW024"))) { Console.WriteLine("{0} {1}", emp.nativename, emp.shortstartworkdate); } foreach (var emp in employees.Where(e => e.workstation.Contains("IZHW024") && e.nativename == "Михаил Романов" && e.manager == "Alexander Orestov")) { Console.WriteLine("{0} {1}", emp.nativename, emp.shortstartworkdate); } Console.ReadKey(); }
public LinqProviderTest() { _client = A.Fake <E3SQueryClient>(); _employees = new E3SEntitySet <EmployeeEntity>(_client); A.CallTo(() => _client.SearchFTS(A <Type> ._, A <IEnumerable <string> > ._, A <int> ._, A <int> ._)).Returns(Enumerable.Empty <EmployeeEntity>()); }
public void WithoutProviderNonGeneric() { var client = new E3SQueryClient(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]); var res = client.SearchFTS(typeof(EmployeeEntity), "workstation:(EPRUIZHW0249)", 0, 10); foreach (var emp in res.OfType <EmployeeEntity>()) { Console.WriteLine("{0} {1}", emp.nativename, emp.shortStartWorkDate); } }
public void WithoutProviderNonGeneric() { var client = new E3SQueryClient(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]); var res = client.SearchFTS(typeof(EmployeeEntity), "workstation:(EPBYMINW3594)", 0, 10); foreach (var emp in res.OfType<EmployeeEntity>()) { _outputHelper.WriteLine("{0} {1}", emp.nativename, emp.startworkdate); } }
public void WithoutProvider() { var client = new E3SQueryClient(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]); var res = client.SearchFTS <EmployeeEntity>("workstation:(EPRUIZHW0249)", 0, 1); foreach (var emp in res) { Console.WriteLine("{0} {1}", emp.nativename, emp.startworkdate); } }
public TResult Execute <TResult>(Expression expression) { var itemType = TypeHelper.GetElementType(expression.Type); var translator = new ExpressionToFtsRequestTranslator(); var queryString = translator.Translate(expression); var queries = queryString.Split(new [] { Constants.QUERY_AND_DELIMITER }, StringSplitOptions.None); return((TResult)_e3SClient.SearchFTS(itemType, query: queries)); }
public void WithoutProviderNonGeneric() { var client = new E3SQueryClient(User, Password); var res = client.SearchFTS(typeof(EmployeeEntity), 0, 10, "workstation:(EPBYBREW0165)"); foreach (var emp in res.OfType <EmployeeEntity>()) { Console.WriteLine($"{emp.nativeName} {emp.shortStartWorkDate}"); } }
public void WithoutProvider_NonGeneric() { var settingsProvider = new SettingsProvider(); var client = new E3SQueryClient(settingsProvider.GetSetting("user"), settingsProvider.GetSetting("password"), settingsProvider.GetSetting("apiUrl")); var res = client.SearchFTS(typeof(EmployeeEntity), "workStation:(EPBYMINW6641)", 0, 10); foreach (var emp in res.OfType <EmployeeEntity>()) { Console.WriteLine("{0} {1}", emp.NativeName, emp.StartWorkDate); } }
public void WithoutProviderNonGeneric() { var client = new E3SQueryClient(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]); var res = client.SearchFTS(typeof(EmployeeEntity), new List<Statement>() { new Statement { Query = "workstation:(EPRUIZHW0060)" } }, 0, 10); foreach (var emp in res.OfType<EmployeeEntity>()) { Console.WriteLine("{0} {1}", emp.nativename, emp.startworkdate); } }
public void Where_Equals_RightOrderOfParams_Test() { var expectedQueryString = "workstation:(EPRUIZHW006)"; var expectedRequestQueries = new string[] { expectedQueryString }; var filteredEmployees = _employees.Where(e => e.workstation == "EPRUIZHW006").ToList(); A.CallTo(() => _client.SearchFTS(A <Type> ._, A <IEnumerable <string> > .That.Matches(array => array.SequenceEqual(expectedRequestQueries)), A <int> ._, A <int> ._)) .MustHaveHappened(); }