Ejemplo n.º 1
0
        public E3SEntitySet(E3SQueryClient client)
        {
            expression = Expression.Constant(this);

            client   = client ?? throw new ArgumentNullException(nameof(client));
            provider = new E3SLinqProvider(client);
        }
        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>());
        }
Ejemplo n.º 3
0
        public E3SEntitySet(string user, string password, IQueryProvider provider = null)
        {
            expression = Expression.Constant(this);

            var client = new E3SQueryClient(user, password);

            provider = provider ?? new E3SLinqProvider(client);
        }
Ejemplo n.º 4
0
        public E3SEntitySet(string user, string password)
        {
            E3SExpression = Expression.Constant(this);

            var client = new E3SQueryClient(user, password);

            E3SProvider = new E3SLinqProvider(client);
        }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
        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.startworkdate);
            }
        }
Ejemplo n.º 7
0
        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.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);
            }
        }
Ejemplo n.º 9
0
        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}");
            }
        }
Ejemplo n.º 10
0
        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 Where_ConstantEqualsMember_MatchesOriginal()
        {
            var directReply = new E3SQueryClient(ConfigurationFixture.Configuration["user"], ConfigurationFixture.Configuration["password"])
                              .SearchFTS <EmployeeEntity>("workstation:(EPRUIZHW0249)", 0, 1).ToList().Select(e => e.id);

            var providerReply = new E3SEntitySet <EmployeeEntity>(
                ConfigurationFixture.Configuration["user"],
                ConfigurationFixture.Configuration["password"])
                                .Where(e => "EPRUIZHW0249" == e.workStation).ToList().Select(e => e.id);

            Assert.Equal(directReply, providerReply);
        }
Ejemplo n.º 12
0
        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);
            }
        }
Ejemplo n.º 13
0
 public E3SLinqProvider(E3SQueryClient client)
 {
     e3sClient = client;
 }
Ejemplo n.º 14
0
 public E3SLinqProvider(E3SQueryClient client)
 {
     _e3SClient = client;
 }