/// <summary>
        /// This method synchronize qrcodes from remote to local
        /// </summary>
        public void SynchronizeQrCodesFromRemoteToLocalSync(string qrCodeSyncURL)
        {
            List <QrCodeModel> qrcodes = SynchronizerExtension.FetchEntitiesFromRemoteSync <QrCodeModel>(qrCodeSyncURL);

            if (qrcodes.Count > 0)
            {
                qrCodeService.BulkSave(qrcodes);
                SendQrCodesSynchedStatus(qrcodes, qrCodeSyncURL);
            }
        }
Пример #2
0
        /// <summary>
        /// This method will synchronize distributors from remote to local
        /// </summary>
        public void SynchronizeDistributorsFromRemoteToLocalSync(string distributorSyncURL)
        {
            List <DistributorModel> distributors = SynchronizerExtension.FetchEntitiesFromRemoteSync <DistributorModel>(distributorSyncURL);

            //Console.WriteLine(distributors[0].Address);
            if (distributors.Count > 0)
            {
                distributorService.BulkSave(distributors);
                SendDistributorsSynchedStatus(distributors, distributorSyncURL);
            }
        }
Пример #3
0
        /// <summary>
        /// this method synchornize products from remote to local
        /// </summary>
        public void SynchronizeProductsFromRemoteToLocalSync(string productGetURL)
        {
            List <ProductModel> products = SynchronizerExtension.FetchEntitiesFromRemoteSync <ProductModel>(productGetURL);

            if (products.Count != 0)
            {
                productService.BulkSave(products);
                //after synchronizing from remote to local,we have to send the signal to remote that
                //we have synchronized the database.
                SendProductSynchedStatus(products, productGetURL);
            }
        }
Пример #4
0
        public void SendDistributorsSynchedStatus(List <DistributorModel> distributors, string distributorPostURL)
        {
            List <BaseSyncDataUpStream> syncStatues = new List <BaseSyncDataUpStream>();

            foreach (DistributorModel model in distributors)
            {
                BaseSyncDataUpStream syncStatus = new BaseSyncDataUpStream {
                    Id = model.Name, SyncStatus = true
                };
                syncStatues.Add(syncStatus);
            }
            SynchronizerExtension.SendSynchStatusOkayToRemote <BaseSyncDataUpStream>(distributorPostURL, syncStatues);
        }
Пример #5
0
        public void SendProductSynchedStatus(List <ProductModel> products, string productPostURL)
        {
            List <BaseSyncDataUpStream> syncStatues = new List <BaseSyncDataUpStream>();

            foreach (ProductModel model in products)
            {
                BaseSyncDataUpStream syncStatus = new BaseSyncDataUpStream {
                    Id = model.ProductName, SyncStatus = true
                };
                syncStatues.Add(syncStatus);
            }
            SynchronizerExtension.SendSynchStatusOkayToRemote <BaseSyncDataUpStream>(productPostURL, syncStatues);
        }
        public void SendQrCodesSynchedStatus(List <QrCodeModel> qrcodes, string qrCodePostURL)
        {
            List <QrCodeSyncDataUpStream> syncStatues = new List <QrCodeSyncDataUpStream>();

            foreach (QrCodeModel model in qrcodes)
            {
                QrCodeSyncDataUpStream syncStatus = new QrCodeSyncDataUpStream {
                    Id = model.EncodedValue, SyncStatus = true
                };
                syncStatues.Add(syncStatus);
            }
            SynchronizerExtension.SendSynchStatusOkayToRemote <QrCodeSyncDataUpStream>(qrCodePostURL, syncStatues);
        }
        private void SynchronizeBindingInforForQrToServer(string qrCodePostURL)
        {
            List <QrCodeModel>            qrcodes     = qrCodeService.FindAllUnsynchedBindedQrCodes();
            List <QrCodeSyncDataUpStream> syncStatues = new List <QrCodeSyncDataUpStream>();

            foreach (QrCodeModel model in qrcodes)
            {
                QrCodeSyncDataUpStream syncStatus = new QrCodeSyncDataUpStream {
                    Id = model.EncodedValue, ProductId = model.Product.ProductName, DistributorId = model.Distributor.Name, SyncStatus = true
                };
                syncStatues.Add(syncStatus);
            }
            if (SynchronizerExtension.SendSynchStatusOkayToRemote <QrCodeSyncDataUpStream>(qrCodePostURL, syncStatues))
            {
                foreach (QrCodeModel model in qrcodes)
                {
                    model.SyncStatus = true;
                }
                qrCodeService.BulkSave(qrcodes);
            }
        }