Beispiel #1
0
        /// <summary>
        /// First checks if the file is in a potentially synced directory,
        /// then if it is, checks if the sync program is active.
        /// </summary>
        /// <param name="pathParts"></param>
        /// <param name="client"></param>
        /// <returns></returns>
        private static bool IsClientActiveAndSynchingThisPath(string[] pathParts, SyncClient client)
        {
            string dirNameLower;

            switch (client)
            {
            case SyncClient.None:
                return(false);

            case SyncClient.Dropbox:
                dirNameLower = "dropbox";
                break;

            case SyncClient.GoogleDrive:
                dirNameLower = "google drive";
                break;

            case SyncClient.OneDrive:
                dirNameLower = "onedrive";
                break;

            default:
                return(false);
            }

            if (Array.IndexOf(pathParts, dirNameLower) == -1)
            {
                return(false);
            }

            return(ClientIsRunning(client));
        }
        private List<order_item_report_appendix> GetOrderItemReportAppendix(int ServiceProviderId)
        {
            List<order_item_report_appendix> ReturnList = new List<order_item_report_appendix>();
            foreach (OrderItemReportAp OIRA in SyncClient.GetOrderItemReportAp(GetFromDate, DateTimeNow, ServiceProviderId))
            {
                order_item_report_appendix tmp = QueryOrderItemReportAppendix(new Guid(OIRA.Id));
                Boolean NewValue = false;
                if (tmp == null)
                {
                    tmp = new order_item_report_appendix();
                    NewValue = true;
                }
                tmp.Id = new Guid(OIRA.Id);
                tmp.appendix = OIRA.Appendix;
                tmp.order_item_report_id = new Guid(OIRA.OrderItemReportId);
                tmp.createdat = System.DateTime.Parse(OIRA.CreateDat);

                if (NewValue)
                {
                    dbContext.Set<order_item_report_appendix>().Add(tmp);
                }
                dbContext.SaveChanges();
                ReturnList.Add(tmp);
            }
            return ReturnList;
        }
Beispiel #3
0
        /// <summary>
        /// Stops the selected client and remembers it for when Saymore exits
        /// </summary>
        /// <param name="client"></param>
        public static void StopClient(SyncClient client)
        {
            switch (client)
            {
            case SyncClient.Dropbox:
                if (!_stoppedDropbox)
                {
                    KillProcess(kDropboxProcess);
                    _stoppedDropbox = true;
                }
                break;

            case SyncClient.GoogleDrive:
                if (!_stoppedGoogleDrive)
                {
                    KillProcess(kGoogleDriveProcess);
                    _stoppedGoogleDrive = true;
                }
                break;

            case SyncClient.OneDrive:
                if (!_stoppedOneDrive)
                {
                    StartStopOneDrive(true);
                }
                break;
            }
        }
        private void bandevent()
        {
            SyncClient client = new SyncClient();
            //client.SyncInfoList();
            //创建后台同步的线程
            Thread syncThread    = new Thread(new ThreadStart(client.SyncMethod));
            Thread TipFormThread = new Thread(new ThreadStart(ShowTipFormThread));
            //  Thread testtipThread = new Thread(new ThreadStart(showtesttipThread));
            //syncThread.Start();
            BizBillController bbc        = new BizBillController();
            Thread            billThread = new Thread(new ThreadStart(bbc.RemoteGetBillList));

            //  billThread.Start();

            OpenDefaultTable();

            Utils.utils.MyEvent                     += ShowTip;
            Utils.utils.MessageBoxEvent             += ShowMessageBox;
            Utils.utils.MessageBoxYesNoEvent        += ShowMessageYesNoBox;
            MyEvent.More.MoreEvent.ReplaceEvent     += MyReplaceEvent;
            MyEvent.More.MoreEvent.ShowWaitEvent    += MyShowWaitEvent;
            MyEvent.More.MoreEvent.EndShowWaitEvent += MyEndShowWaitEvent;
            Utils.utils.ShowWaitEvent               += MyShowWaitEvent;
            Utils.utils.EndShowWaitEvent            += MyEndShowWaitEvent;
            Utils.utils.MessageBoxTipsFormListEvent += ShowMessageBoxTipsFormListEvent;
            TipFormThread.Start();
        }
Beispiel #5
0
        /// <summary>
        /// 建立长连接
        /// </summary>
        private void ConnectToRoom()
        {
            syncClient = new SyncClient(socketUrl);
            syncClient.StartClient();

            Debug.Log("Start to connect [" + socketUrl + "]");
        }
        private List<service_provider> GetServiceProvider(int ServiceProviderId)
        {
            List<service_provider> ReturnList = new List<service_provider>();
            foreach (ServiceProvider sp in SyncClient.GetServiceProvider(GetFromDate, DateTimeNow, ServiceProviderId))
            {
                service_provider tmp = QueryServiceProvider(sp.Id);
                Boolean NewValue = false;
                if (tmp == null)
                {
                    tmp = new service_provider();
                    NewValue = true;
                }
                tmp.address_1 = sp.Address1;
                tmp.address_2 = sp.Address2;
                tmp.city = sp.City;
                tmp.company_name = sp.CompanyName;
                tmp.country_id = sp.CountryId;
                tmp.createdAt = System.DateTime.Parse(sp.Timestamp);
                tmp.Id = sp.Id;
                tmp.phone_1 = sp.Phone1;
                tmp.phone_2 = sp.Phone2;
                tmp.tax_number = sp.Taxnumber;
                tmp.zip = sp.Zip;
                tmp.zone_id = sp.ZoneId;

                if (NewValue)
                {
                    dbContext.Set<service_provider>().Add(tmp);
                }
                dbContext.SaveChanges();
                ReturnList.Add(tmp);
            }
            return ReturnList;
        }
Beispiel #7
0
 protected ExecutorBase(SyncClient client, DateTime benchTime, ILog logger)
 {
     this.BenchTime = benchTime;
     this.Logger = logger;
     this.MessageList = new List<string>();
     this.Client = client;
 }
        private List<order_header> GetOrderHeader(int ServiceProviderId)
        {
            List<order_header> ReturnList = new List<order_header>();
            foreach (OrderHeader oh in SyncClient.GetOrderHeader(GetFromDate, DateTimeNow, ServiceProviderId))
            {
                order_header tmp = QueryOrderHeader(oh.Id);
                Boolean NewValue = false;
                if (tmp == null)
                {
                    tmp = new order_header();
                    NewValue = true;
                }
                tmp.createdAt = System.DateTime.Parse(oh.CreateDat);
                tmp.currency_code = oh.CurrencyCode;
                tmp.customer_note = oh.CustomerNote;
                tmp.Id = oh.Id;
                tmp.ip_address = oh.IpAddress;
                tmp.orderpayment_type = oh.OrderpaymentType;
                tmp.order_state_id = oh.OrderStateId;
                tmp.sow_user_id = oh.SowUserId;
                tmp.subtotal = oh.Subtotal;
                tmp.subtotal_ex_tax = oh.SubtotalExTax;
                tmp.tax = oh.Tax;
                tmp.total = oh.Total;

                if (NewValue)
                {
                    dbContext.Set<order_header>().Add(tmp);
                }
                dbContext.SaveChanges();

                ReturnList.Add(tmp);
            }
            return ReturnList;
        }
Beispiel #9
0
        /// <summary>
        /// Checks if the selected sync client is currently running
        /// </summary>
        /// <param name="client"></param>
        /// <returns>true id the client is running, false if not</returns>
        public static bool ClientIsRunning(SyncClient client)
        {
            string processNameLower;

            switch (client)
            {
            case SyncClient.None:
                return(false);

            case SyncClient.Dropbox:
                processNameLower = kDropboxProcess;
                break;

            case SyncClient.GoogleDrive:
                processNameLower = kGoogleDriveProcess;
                break;

            case SyncClient.OneDrive:
                processNameLower = kOneDriveProcess;
                break;

            default:
                return(false);
            }

            var processes = Process.GetProcesses();

            return(processes.Any(p => p.ProcessName.ToLower() == processNameLower));
        }
Beispiel #10
0
 protected override void OnClientConnected(TcpClient client)
 {
     base.OnClientConnected(client);
     SyncClient auth = new SyncClient(client);
     auth.ClientDisconnected += OnClientDisconnected;
     Clients.Add(auth);
 }
        private int SendOrderItem()
        {
            DateTime FromDate = DateTime.Parse(GetFromDate);
            List<order_item> LocalOrderItems = QueryOrderItems(FromDate);
            OrderItem[] SendOrderItems = new OrderItem[LocalOrderItems.Count()];
            for (int i = 0; i < LocalOrderItems.Count(); i++)
            {
                OrderItem tmp = new OrderItem();
                tmp.AddCost = (LocalOrderItems[i].addittional_cost == null) ? 0 : LocalOrderItems[i].addittional_cost.Value;
                tmp.Comment = LocalOrderItems[i].service_provider_comment;
                tmp.CreateDat = LocalOrderItems[i].createdAt.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture);
                tmp.FinalPrice = LocalOrderItems[i].final_price;
                tmp.FinalPriceWithoutTax = LocalOrderItems[i].final_price_without_tax;
                tmp.FinalPriceWithTax = LocalOrderItems[i].final_price_with_tax;
                tmp.Id = LocalOrderItems[i].Id;
                tmp.IsAllIncl = LocalOrderItems[i].is_all_inclusive;
                tmp.IsConfirmed = LocalOrderItems[i].is_confirmed;
                tmp.IsFinished = LocalOrderItems[i].is_finished;
                tmp.OptionPrice = LocalOrderItems[i].option_price;
                tmp.OrderId = LocalOrderItems[i].order_id;
                tmp.PerItemTax = LocalOrderItems[i].per_item_tax;
                tmp.PreferredDatetime = LocalOrderItems[i].preferred_date_time.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture);
                tmp.Price = LocalOrderItems[i].price;
                tmp.Quantity = LocalOrderItems[i].quantity;
                tmp.ServiceId = LocalOrderItems[i].service_id;
                tmp.Tax = LocalOrderItems[i].tax;

                SendOrderItems[i] = tmp;
            }
            int cntChangedItems = SyncClient.PutOrderItem(SendOrderItems, DateTimeNow, false);
            return cntChangedItems;
        }
Beispiel #12
0
        public void TearDown()
        {
            AsyncClient?.Dispose();
#if SYNC_CLIENT
            SyncClient?.Dispose();
#endif
        }
Beispiel #13
0
        static void Main(string[] args)
        {
            try
            {
                if (!File.Exists(FileName))
                {
                    var newRegistry = ProjectGenerator.GenRegistry(3, 10);
                    newRegistry.Save(FileName);
                }

                var registry = XmlRegistry.Load(FileName);

                // Валидация реестра - урлы в проектах и словах
                XmlRegistry.ValidateRegistry(registry);

                //------

                var apiKey = ConfigurationManager.AppSettings["apikey"];
                if (string.IsNullOrEmpty(apiKey))
                {
                    throw new InvalidOperationException(
                        "Invalid 'apikey' setting in application config.");
                }

                var config = new ClientConfig(apiKey);
                var client = new ApiClient(config);

                var syncClient = new SyncClient(client);

                Console.Write("Project's data loading...");
                syncClient.LoadSyncObjects();

                Console.WriteLine();
                Console.Write("Project's synchronization...");
                syncClient.SyncProjects(registry.Projects);

                Console.WriteLine();
                Console.Write("Groups's synchronization...");
                syncClient.SyncGroups(registry.Projects);

                Console.WriteLine();
                Console.Write("Keywords's synchronization...");
                syncClient.SyncKeywords(registry.Projects);

                Console.WriteLine();
                Console.Write("Synchronization completed, press any key...");
                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine();
                Console.WriteLine("Error:");
                Console.WriteLine(ex.ToString());
                Console.ResetColor();

                Console.Write("Press any key...");
                Console.ReadKey();
            }
        }
        protected override async Task OnExecuteAsync(CommandLineApplication app)
        {
            if (String.IsNullOrEmpty(GroupName))
            {
                Console.WriteLine("Missing groupName parameter");
                return;
            }
            var cli    = new SyncClient(this.TransportHubUrl);
            var tcs    = new TaskCompletionSource <object>();
            var userId = GenRandomName(8);
            var secondNotificationHub = await cli.ConnectToHub(false, GroupName, userId, tcs);

            await tcs.Task; // waiting until it gets the target URL and access token. TODO: a time out is required.
            var info = cli.InfoToTransportHub;
            var secondTransportHubConnection = await cli.DirectConnectToTransportHub(info);

            Console.WriteLine("Press Ctrl+C to stop");
            await WaitUntilCancel();

            await SyncClient.LeaveNegotiationGroupAsync(secondNotificationHub, GroupName);

            await secondNotificationHub.StopAsync();

            await secondTransportHubConnection.StopAsync();
        }
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            SyncClient client = new SyncClient();
            await client.SignIn(null, null);

            IEnumerable <Bookmark> bookmarks = await client.GetBookmarks();
        }
        private async void loginButton_Click(object sender, RoutedEventArgs e)
        {
            SyncClient client = new SyncClient();
            await client.SignIn(emailTextBox.Text, passwordTextBox.Password);

            IEnumerable <Bookmark> bookmarks = await client.GetBookmarks();
        }
 private List<order_item_report> GetOrderItemReport(int ServiceProviderId)
 {
     List<order_item_report> ReturnList = new List<order_item_report>();
     foreach (OrderItemReport OIR in SyncClient.GetOrderItemReport(GetFromDate, DateTimeNow, ServiceProviderId))
     {
         order_item_report tmp = QueryOrderItemReport(new Guid(OIR.Id));
         Boolean NewValue = false;
         if (tmp == null)
         {
             tmp = new order_item_report();
             NewValue = true;
         }
         tmp.Id = new Guid(OIR.Id);
         tmp.comment = OIR.ReportComment;
         tmp.createdat = System.DateTime.Parse(OIR.CreateDat);
         tmp.order_item_id = OIR.OrderItemId;
         if (NewValue)
         {
             dbContext.Set<order_item_report>().Add(tmp);
         }
         dbContext.SaveChanges();
         ReturnList.Add(tmp);
     }
     return ReturnList;
 }
        private List<sow_user> GetSowUser(int ServiceProviderId)
        {
            List<sow_user> ReturnList = new List<sow_user>();
            foreach (SowUser su in SyncClient.GetSowUser(GetFromDate, DateTimeNow, ServiceProviderId))
            {
                sow_user tmp = QuerySowUser(su.Id);
                Boolean NewValue = false;
                if (tmp == null)
                {
                    tmp = new sow_user();
                    NewValue = true;
                }
                tmp.email = su.Email;
                tmp.Id = su.Id;
                tmp.name = su.Name;
                tmp.registeredAt = System.DateTime.Parse(su.RegisteredDat);
                tmp.username = su.Username;
                if (NewValue)
                {
                    dbContext.Set<sow_user>().Add(tmp);
                }
                dbContext.SaveChanges();

                ReturnList.Add(tmp);
            }
            return ReturnList;
        }
Beispiel #19
0
 public void SendSyncMessage(CommunicationObject communicationObject)
 {
     using (_syncClient = new SyncClient())
     {
         _syncClient.Connect();
         _syncClient.SendMessage(communicationObject);
     }
 }
Beispiel #20
0
 public UserForm(SyncClient client)
 {
     this.Client    = client;
     this.Messages  = new List <MessageEntry>();
     this.CheckLock = new object();
     this.InitializeComponent();
     this.InitializeEvents();
 }
Beispiel #21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="col"></param>
        /// <param name="nodeCount"></param>
        /// <param name="maxBytesToSend"></param>
        public static void CalculateSendSize(Collection col, out uint nodeCount, out ulong maxBytesToSend)
        {
            Log.log.Debug("starting to calculate size to send to master for collection {0}", col.Name);

            maxBytesToSend = 0;
            nodeCount      = 0;
            SyncClient.GetCountToSync(col.ID, out nodeCount);
        }
Beispiel #22
0
 public MainForm()
 {
     InitializeComponent();
     BuildUI();
     _sync = new SyncClient(FileUtils.VocabulariesFolder, "*.lsv");
     this.Load += new EventHandler(MainForm_Load);
     this.Closing += new CancelEventHandler(MainForm_Closing);
 }
Beispiel #23
0
        public virtual void TearDown()
        {
            AsyncClient?.Dispose();
#if SYNC_CLIENT
            SyncClient?.Dispose();
#endif
            CleanupEnvironmentVariables();
        }
Beispiel #24
0
        public override void OnLoaded()
        {
            var sv = ReadSave("[]");

            Tracking             = Program.Deserialise <List <TorrentInfo> >(sv, new BotUserConverter());
            Sync                 = Client.GetSyncClient().Result;
            Sync.TorrentUpdated += Sync_TorrentUpdated;
            Sync.TorrentRemoved += Sync_TorrentRemoved;
            Sync.StartSync();
        }
Beispiel #25
0
        private static void OnLoginConnectionAccepted(Socket sock)
        {
            IPEndPoint remoteEndPoint = sock.RemoteEndPoint as IPEndPoint;

            ConsoleManager.Logger.Info(string.Format("Client connected on Login Server ({0}:{1})", (object)remoteEndPoint.Address, (object)remoteEndPoint.Port));
            SyncClient syncClient = new SyncClient();

            syncClient.SyncStopped += new EventHandler <SyncClient.SyncStoppedEventArgs>(ServersManager.OnSyncClientStopped);
            ServersManager.ActiveClients.Add(syncClient);
            syncClient.StartSync(sock, false);
        }
Beispiel #26
0
        public CommunicationObject RecieveSyncMessage()
        {
            CommunicationObject result;

            using (_syncClient = new SyncClient())
            {
                _syncClient.Connect();
                result = _syncClient.WaitForRecieveMessage();
            }

            return(result);
        }
        protected override async Task OnExecuteAsync(CommandLineApplication app)
        {
            var groupName = GenRandomName(this.GroupNameLength);
            var cli       = new SyncClient(this.TransportHubUrl);
            var firstHub  = await cli.ConnectToHub(true, groupName, null, null);

            Console.WriteLine($"Group for sync: {groupName}");
            Console.WriteLine("Press Ctrl+C to stop");
            await WaitUntilCancel();

            // stop all connections.
            await SyncClient.LeaveNegotiationGroupAsync(firstHub, groupName);

            await firstHub.StopAsync();
        }
Beispiel #28
0
        public MainForm()
        {
            InitializeComponent();

            SyncClient client = new SyncClient();
            //client.SyncInfoList();
            //创建后台同步的线程
            Thread syncThread    = new Thread(new ThreadStart(client.SyncMethod));
            Thread TipFormThread = new Thread(new ThreadStart(ShowTipFormThread));
            //  Thread testtipThread = new Thread(new ThreadStart(showtesttipThread));
            //syncThread.Start();
            BizBillController bbc        = new BizBillController();
            Thread            billThread = new Thread(new ThreadStart(bbc.RemoteGetBillList));
            //  billThread.Start();

            BIZFoodController bfc = new BIZFoodController();

            //  var tmp = bfc.GetFoodList(0);

            comboBoxEx1.Items.AddRange(new object[] { eStyle.Office2013, eStyle.OfficeMobile2014, eStyle.Office2010Blue,
                                                      eStyle.Office2010Silver, eStyle.Office2010Black, eStyle.VisualStudio2010Blue, eStyle.VisualStudio2012Light,
                                                      eStyle.VisualStudio2012Dark, eStyle.Office2007Blue, eStyle.Office2007Silver, eStyle.Office2007Black });
            comboBoxEx1.SelectedIndex = 0;
            foreach (DevExpress.Skins.SkinContainer skin in DevExpress.Skins.SkinManager.Default.Skins)
            {
                comboBoxEdit1.Properties.Items.Add(skin.SkinName);
            }
            this.WindowState = FormWindowState.Maximized;

            //默认打开桌位
            OpenDefaultTable();

            Utils.utils.MyEvent                     += ShowTip;
            Utils.utils.MessageBoxEvent             += ShowMessageBox;
            Utils.utils.MessageBoxYesNoEvent        += ShowMessageYesNoBox;
            MyEvent.More.MoreEvent.ReplaceEvent     += MyReplaceEvent;
            MyEvent.More.MoreEvent.ShowWaitEvent    += MyShowWaitEvent;
            MyEvent.More.MoreEvent.EndShowWaitEvent += MyEndShowWaitEvent;
            Utils.utils.MessageBoxTipsFormListEvent += ShowMessageBoxTipsFormListEvent;
            TipFormThread.Start();
            //  testtipThread.Start();
            //加载顶部bar
            MyControl.TopBarControl topBar = new MyControl.TopBarControl();
            topBar.Dock = DockStyle.Fill;
            this.tableLayoutPanel1.Controls.Add(topBar, 0, 0);
            topBar.MyEvent += TopBarEvent;
        }
        public async Task NoFilesOnClientOrService()
        {
            var textView = new Mock <ITextView>();

            var directory = DirectoryMock.Mock(
                Enumerable.Empty <DirectoryInfo>(),
                Enumerable.Empty <FileInfo>());

            var fileService = new Mock <IFileServiceApi>();

            var client = new SyncClient(
                textView.Object,
                DirectoryMock.MockFactory(directory).Object,
                FileHasherMock.Mock().Object,
                fileService.Object);

            await client.RunAsync();

            // Verify ITextView
            VerifyTextView(
                textView,
                filesOnClient: Enumerable.Empty <FileSyncFile>(),
                filesOnService: Enumerable.Empty <FileSyncFile>(),
                filesToUpload: Enumerable.Empty <FileSyncFile>(),
                filesToDownload: Enumerable.Empty <FileSyncFile>(),
                conflicts: Enumerable.Empty <Conflict>());

            // Verify IFileStore
            directory.Verify(
                x => x.GetFiles(),
                Times.Once);

            directory.Verify(
                x => x.GetSubdirectories(),
                Times.Once);

            directory.VerifyNoOtherCalls();

            // Verify IFileServiceApi
            fileService.Verify(
                x => x.GetDirectoryListingAsync(It.IsAny <RelativeUri?>()),
                Times.Once);

            fileService.VerifyNoOtherCalls();
        }
Beispiel #30
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter your Mozilla sync credentials.");
            Console.Write("Email: ");
            string email = Console.ReadLine();

            Console.Write("Password: "******"Bookmarks:");

            //foreach (Bookmark bookmark in bookmarks)
            //{
            //    Console.WriteLine("Title: " + bookmark.Title);
            //    Console.WriteLine("Uri: " + bookmark.Uri);
            //    Console.WriteLine("------");
            //}

            //Console.WriteLine("Tabs:");

            //foreach (Client client in clients)
            //{
            //    Console.WriteLine("Id: " + client.Id);
            //    Console.WriteLine("Name: " + client.ClientName);
            //    Console.WriteLine("Tabs:");

            //    foreach(Tab tab in client.Tabs)
            //    {
            //        Console.WriteLine("\tTitle: " + tab.Title);
            //        Console.WriteLine("\tLast Used: " + tab.LastUsed);
            //    }

            //    Console.WriteLine("------");
            //}

            Console.WriteLine("Press enter to exit...");
            Console.ReadLine();
        }
        private int SendOrderItemReport()
        {
            DateTime FromDate = DateTime.Parse(GetFromDate);
            List<order_item_report> LocalOrderItemReports = QueryOrderItemReports(FromDate);
            OrderItemReport[] SendOrderItemReports = new OrderItemReport[LocalOrderItemReports.Count()];

            for (int i = 0; i < SendOrderItemReports.Count(); i++)
            {
                OrderItemReport tmp = new OrderItemReport();
                tmp.CreateDat = LocalOrderItemReports[i].createdat.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture);
                tmp.Id = LocalOrderItemReports[i].Id.ToString();
                tmp.OrderItemId = LocalOrderItemReports[i].order_item_id;
                tmp.ReportComment = LocalOrderItemReports[i].comment;

                SendOrderItemReports[i] = tmp;
            }
            return SyncClient.PutOrderItemReport(SendOrderItemReports, DateTimeNow, false);
        }
        private List<order_item> GetOrderItem(int ServiceProviderId)
        {
            List<order_item> ReturnList = new List<order_item>();
            foreach (OrderItem OI in SyncClient.GetOrderItem(GetFromDate, DateTimeNow, ServiceProviderId))
            {
                order_item tmp = QueryOrderItem(OI.Id);
                Boolean NewValue = false;
                if (tmp == null)
                {
                    tmp = new order_item();
                    NewValue = true;
                }

                tmp.Id = OI.Id;
                tmp.addittional_cost = OI.AddCost;
                tmp.createdAt = System.DateTime.Parse(OI.CreateDat);
                tmp.final_price = OI.FinalPrice;
                tmp.final_price_without_tax = OI.FinalPriceWithoutTax;
                tmp.final_price_with_tax = OI.FinalPriceWithTax;
                tmp.is_all_inclusive = OI.IsAllIncl;
                tmp.is_confirmed = OI.IsConfirmed;
                tmp.is_finished = OI.IsFinished;
                tmp.option_price = OI.OptionPrice;
                tmp.order_id = OI.OrderId;
                tmp.per_item_tax = OI.PerItemTax;
                tmp.preferred_date_time = System.DateTime.Parse(OI.PreferredDatetime);
                tmp.price = OI.Price;
                tmp.quantity = OI.Quantity;
                tmp.service_id = OI.ServiceId;
                tmp.service_provider_comment = OI.Comment;
                tmp.tax = OI.Tax;

                if (NewValue)
                {
                    dbContext.Set<order_item>().Add(tmp);
                }
                dbContext.SaveChanges();

                ReturnList.Add(tmp);
            }
            return ReturnList;
        }
Beispiel #33
0
        public void SyncConsistency()
        {
            var xmlRegistry = SyncTestHelper.GetRegistry();

            var apiProjects = SyncTestHelper.GetProjects();
            var apiKeywords = SyncTestHelper.GetKeywords();

            var client = new MockApiClient();

            client.SetProjects(apiProjects);
            client.SetKeywords(apiKeywords);

            var syncClient = new SyncClient(client);

            syncClient.LoadSyncObjects();

            var syncProjectsCount = syncClient.SyncProjects(xmlRegistry.Projects);

            Assert.IsTrue(syncProjectsCount != 0);

            syncProjectsCount = syncClient.SyncProjects(xmlRegistry.Projects);

            Assert.IsTrue(syncProjectsCount == 0);

            var syncGroupsCount = syncClient.SyncGroups(xmlRegistry.Projects);

            Assert.IsTrue(syncGroupsCount != 0);

            syncGroupsCount = syncClient.SyncGroups(xmlRegistry.Projects);

            Assert.IsTrue(syncGroupsCount == 0);

            var syncKeywordsCount = syncClient.SyncKeywords(xmlRegistry.Projects);

            Assert.IsTrue(syncKeywordsCount != 0);

            syncKeywordsCount = syncClient.SyncKeywords(xmlRegistry.Projects);

            Assert.IsTrue(syncKeywordsCount == 0);
        }
        private int SendServiceProvider()
        {
            DateTime FromDate = DateTime.Parse(GetFromDate);
            service_provider LocalServiceProvider = QueryServiceProvider(FromDate);


            if (LocalServiceProvider != null)
            {
                ServiceProvider[] SendServiceProvider = new ServiceProvider[1];

                ServiceProvider tmp = new ServiceProvider();
                tmp.Timestamp = LocalServiceProvider.createdAt.ToString("dd.MM.yyyy HH:mm:ss", CultureInfo.InvariantCulture);
                tmp.Id = LocalServiceProvider.Id;
                tmp.Address1 = LocalServiceProvider.address_1;
                tmp.Address2 = LocalServiceProvider.address_2;
                tmp.City = LocalServiceProvider.city;
                tmp.CompanyName = LocalServiceProvider.company_name;
                tmp.CountryId = LocalServiceProvider.country_id;
                tmp.Phone1 = LocalServiceProvider.phone_1;
                tmp.Phone2 = LocalServiceProvider.phone_2;
                tmp.Taxnumber = LocalServiceProvider.tax_number;
                tmp.Zip = LocalServiceProvider.zip;
                if (LocalServiceProvider.zone_id < 1)
                {
                    tmp.ZoneId = 207;                       //Wenn die ZoneId Null ist, wird sie auf 207 (Wien) geändert. 
                }
                else
                {
                    tmp.ZoneId = LocalServiceProvider.zone_id;
                }

                //tmp.Appendix = LocalOrderItemReportAppendix[i].appendix;      funktioniert im Sync noch nicht

                SendServiceProvider[0] = tmp;

                return SyncClient.PutServiceProvider(SendServiceProvider, DateTimeNow, false);
            }
            return 0;

        }
        public void SyncConsistency()
        {
            var xmlRegistry = SyncTestHelper.GetRegistry();

            var apiProjects = SyncTestHelper.GetProjects();
            var apiKeywords = SyncTestHelper.GetKeywords();

            var client = new MockApiClient();
            client.SetProjects(apiProjects);
            client.SetKeywords(apiKeywords);

            var syncClient = new SyncClient(client);
            syncClient.LoadSyncObjects();

            var syncProjectsCount = syncClient.SyncProjects(xmlRegistry.Projects);

            Assert.IsTrue(syncProjectsCount != 0);

            syncProjectsCount = syncClient.SyncProjects(xmlRegistry.Projects);

            Assert.IsTrue(syncProjectsCount == 0);

            var syncGroupsCount = syncClient.SyncGroups(xmlRegistry.Projects);

            Assert.IsTrue(syncGroupsCount != 0);

            syncGroupsCount = syncClient.SyncGroups(xmlRegistry.Projects);

            Assert.IsTrue(syncGroupsCount == 0);

            var syncKeywordsCount = syncClient.SyncKeywords(xmlRegistry.Projects);

            Assert.IsTrue(syncKeywordsCount != 0);

            syncKeywordsCount = syncClient.SyncKeywords(xmlRegistry.Projects);

            Assert.IsTrue(syncKeywordsCount == 0);
        }
Beispiel #36
0
 private static void _syncWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     SyncClient syncProxy = new SyncClient();
     List<Identity> updates = syncProxy.GetIdentities(new Request() { LastRequest = _lastUpdated });
     lock (locker)
     {
         foreach (Identity upd in updates)
         {
             Identity id = Identities.FirstOrDefault<Identity>(delegate(Identity Iden) { return Iden.Id == upd.Id; });
             if (id == null)
             {
                 Identities.Add(upd);
             }
             else
             {
                 id.FirstName = upd.FirstName;
                 id.LastName = upd.LastName;
                 id.LastUpdated = upd.LastUpdated;
             }
         }
         _lastUpdated = DateTime.Now;
     }
 }
Beispiel #37
0
		// TODO: Are these needed in the era of ISyncUI? Probably,
		//       but leaving them out is good for testing right now
//		/// <summary>
//		/// Emitted when the state of the synchronization changes
//		/// </summary>
//		public static event SyncStateChangedHandler StateChanged;
//
//		/// <summary>
//		/// Emmitted when a file is uploaded, downloaded, or deleted.
//		/// </summary>
//		public static event NoteSyncHandler NoteSynchronized;
//
//		/// <summary>
//		///
//		/// </summary>
//		public static event NoteConflictHandler NoteConflictDetected;

		static SyncManager ()
		{
			client = new TomboySyncClient ();
			//server = new FileSystemSyncServer ();
		}
 public OrderSyncExecutor(SyncClient client, DateTime benchTime, ILog logger) : base(client, benchTime, logger)
 {
     _beginTime = BeginTime(benchTime);
     _endTime = EndTime();
 }
 public override void Execute(SyncExecutionContext context, SyncClient client)
 {
     if (client == null)
         return;
     client.SendMessage(new SyncPongMessage());
 }
 public override void Execute(SyncExecutionContext context, SyncClient client)
 {
     context.Log("Attempting to sync play file: " + FileName);
     context.AttemptPlayFile(FileName);
 }
 public override void Execute(SyncExecutionContext context, SyncClient client)
 {
     context.SetPlayState(PlayState);
     context.SetPlayPosition(PlayPosition);
     context.Log("Synced player state");
 }
 public abstract void Execute(SyncExecutionContext context, SyncClient client);
Beispiel #43
0
        void Receive_StartSync(XConnection connection, GenericPacket packet)
        {
            // received by server from client

            var client = new SyncClient();
            client.Connection = connection;

            Log("Sync client added");
            SyncClients.Add(client.Connection.GetHashCode(), client);

            // do after state added so new calls get queued to be sent as well
            foreach(var call in XRay.CallMap)
                client.NewCalls.Add(new Tuple<int, int>(call.Source, call.Destination));

            foreach (var init in XRay.InitMap)
                client.Inits.Add(new Tuple<int, int>(init.Source, init.Destination));

            foreach (var flow in XRay.FlowMap)
                client.NewThreads.Add(flow.ThreadID, new Tuple<string, bool>(flow.Name, flow.IsAlive));

            foreach (var node in XRay.Nodes)
                if (node.ThreadIDs != null)
                    foreach (var id in node.ThreadIDs)
                        client.NodeThreads.Add(new Tuple<int, int>(node.ID, id));

            foreach (var call in XRay.CallMap)
                if (call.ThreadIDs != null)
                    foreach (var id in call.ThreadIDs)
                        client.CallThreads.Add(new Tuple<int, int>(call.ID, id));

            // past threadlines will be added automatically when sync packet is sent
        }