Esempio n. 1
0
        public List <Action> PullData()
        {
            var from  = DateTime.Now.AddDays(-5);
            var api   = CreateLogin(ClientId);
            var batch = new BatchQuery <Action>(new BatchOptions
            {
                Write = 512,
                Read  = 512
            }, api, new LoadActionsInBatches(from, DateTime.Now), ActionLoad);

            batch.Execute();
            return(Actions);
        }
Esempio n. 2
0
        /// <summary>
        /// Updates the passed-in T
        /// </summary>
        public int Update(IEnumerable <T> items, IDataProvider provider)
        {
            BatchQuery bQuery = new BatchQuery(provider);
            int        result = 0;

            foreach (T item in items)
            {
                var query = item.ToUpdateQuery(provider);
                bQuery.Queue(query);
            }
            result = bQuery.Execute();
            return(result);
        }
Esempio n. 3
0
        public void Batch_Query_Should_Allow_Single_Quotes_In_Query()
        {
            var containsNames = new[] { "Products's One and Only", "Products's Second" };

            Query <Product> products = new Query <Product>(provider);

            var query = from product in products
                        where containsNames.Contains(product.ProductName)
                        select product;

            var result = query.ToList();

            BatchQuery batch = new BatchQuery(provider);

            batch.Queue(query);
            Assert.DoesNotThrow(() => batch.Execute());
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            var clientId = "224";
            var api      = Login("9408065009082", "yase191!", clientId);

            var start = new DateTime(2017, 10, 25, 00, 00, 00);
            var end   = new DateTime(2017, 10, 25, 23, 59, 59);

            var batch = new BatchQuery <Action>(new BatchOptions
            {
                Write = 512,
                Read  = 512
            }, api, new LoadActionsInBatches(start, end), WriteToFile);

            batch.Execute();

            Console.ReadLine();
        }
Esempio n. 5
0
        public static void GetPersonnelInfo(Api api)
        {
            try
            {
                var header = $"FirstName, FullName, Nature, Type, IdentityNumber{Environment.NewLine}";
                var path   = $@"C:\Users\YaseenH\Desktop\Adhoc\personnel.csv";
                File.AppendAllText(path, header);

                var batch = new BatchQuery <Personnel>(new BatchOptions
                {
                    Write = 512,
                    Read  = 512
                }, api, new LoadPersonnelInBatches(), PersonnelLookup);
                batch.Execute();
            }
            catch (Exception e)
            {
                Console.WriteLine($"{e.ToString()}...");
            }
        }
Esempio n. 6
0
        public static void UpdateMsts(string _clientId)
        {
            var api = CreateLogin(_clientId);

            var batch = new BatchQuery <Entity>(new BatchOptions
            {
                Write = 512,
                Read  = 512
            }, api, new LoadEntitiesInBatches(), EntityCallBack);

            batch.Execute();

            var batch2 = new BatchQuery <OLocation>(new BatchOptions
            {
                Write = 512,
                Read  = 512
            }, api, new LoadLocationsInBatches(), DecoLookup);

            batch2.Execute();
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            var filePath    = @"Data\Cori_June_Actions.csv";
            var content     = ReadContent(filePath);
            var csvReader   = new CsvReader();
            var lines       = csvReader.Read(content);
            var actionLines = lines.Where(x => x != null).Select(x => new ActionLine(x)).ToList();

            _actionsLines = actionLines;
            //var superRoute = CreateRoute(RouteName);

            var api = Login("9408065009082", "yase191!", "206");

            var batch = new BatchQuery <DitAddress>(new BatchOptions
            {
                Write = 512,
                Read  = 512
            }, api, new LoadDitAddressesInBatches(), Callback);

            batch.Execute();

            Console.ReadLine();
        }
Esempio n. 8
0
        public void Batch_Query_Should_Allow_Single_Quotes_In_Query()
        {
            var containsNames = new[] { "Products's One and Only", "Products's Second" };

            Query<Product> products = new Query<Product>(provider);

            var query = from product in products
                        where containsNames.Contains(product.ProductName)
                        select product;

            var result = query.ToList();

            BatchQuery batch = new BatchQuery(provider);
            batch.Queue(query);
            Assert.DoesNotThrow(() => batch.Execute());
        }