/// <summary> /// Syncs all tables. /// </summary> /// <returns>The all async.</returns> /// <param name="syncUserSpecific">If set to <c>true</c> sync user specific.</param> public async Task <bool> SyncAllAsync(bool syncUserSpecific) { if (!IsInitialized) { await InitializeAsync(); } var taskList = new List <Task <bool> >(); taskList.Add(CategoryStore.SyncAsync()); taskList.Add(NotificationStore.SyncAsync()); taskList.Add(SpeakerStore.SyncAsync()); taskList.Add(SessionStore.SyncAsync()); taskList.Add(WorkshopStore.SyncAsync()); taskList.Add(SponsorStore.SyncAsync()); taskList.Add(EventStore.SyncAsync()); taskList.Add(ApplicationDataStore.SyncAsync()); if (syncUserSpecific) { taskList.Add(FeedbackStore.SyncAsync()); taskList.Add(FavoriteStore.SyncAsync()); } var successes = await Task.WhenAll(taskList).ConfigureAwait(false); return(successes.Any(x => !x));//if any were a failure. }
public void ClearAndLoad(ApplicationDataStore applicationDataStore) { var mainWindowViewModel = _mainWindow.ViewModel; mainWindowViewModel.ZoomViewModel.Reset(); mainWindowViewModel.SelectedProject = applicationDataStore.Project; mainWindowViewModel.SelectedIteration = applicationDataStore.SelectedIteration; }
public void DoWork() { using (var fileStream = File.Open(_filename, FileMode.Open, FileAccess.Read)) { ApplicationDataStore applicationData = (ApplicationDataStore)_xmlSerializer.ReadObject(fileStream); _viewModelParser.ClearAndLoad(applicationData); OperationStatus?.Invoke(this, new OperationEventArgs("Project loaded!")); } }
private void SaveButtonOnClick(object sender, RoutedEventArgs e) { ReadData(_activeCarrierService); if (_activeCarrierService.Id <= 0) { _activeCarrierService.CreatedByUserId = ApplicationSessionService.GetActiveUserId(); _activeCarrierService.CreatedDateTime = ApplicationSessionService.GetNowDateTime(); } ApplicationDataStore.SendData("CarrierService", _activeCarrierService); WindowService.CloseUserControlDialogWindow(this); }
public ApplicationDataStore ExtractData() { var applicationDataStore = new ApplicationDataStore { Project = _mainWindow.ViewModel.SelectedProject, SelectedIteration = _mainWindow.ViewModel.SelectedIteration, }; CreateFakeData(applicationDataStore); return(applicationDataStore); }
private void ProductAssociatePriceListUserControlOnClickOnEditItem(object sender, RoutedEventArgs e) { if (ProductAssociatePriceGridControl.SelectedItem is ProductAssociatePrice productAssociatePrice) { WindowService.OpenUserControlDialog(new UcProductAssociatePrice(productAssociatePrice)); var dataIsChanged = ApplicationDataStore.GetData <bool>("IsAddedOrChanged"); if (dataIsChanged) { // Do anything? } } }
private void AddEditDeleteListUserControlOnClickOnEditItem(object sender, RoutedEventArgs e) { if (ReorderInformationGridControl.SelectedItem is PartReorderInformation partReorderInformation) { WindowService.OpenUserControlDialog(new UcPartReorderInformation(partReorderInformation)); var dataIsChanged = ApplicationDataStore.GetData <bool>("IsAddedOrChanged"); if (dataIsChanged) { // Do anything? } } }
private void ProductAssociatePriceListUserControlOnClickOnAddItem(object sender, RoutedEventArgs e) { var productAssociatePrice = new ProductAssociatePrice(); WindowService.OpenUserControlDialog(new UcProductAssociatePrice(productAssociatePrice)); var dataIsAdded = ApplicationDataStore.GetData <bool>("IsAddedOrChanged"); if (dataIsAdded) { _activeProduct.ProductAssociatePrices.Add(productAssociatePrice); ProductAssociatePriceGridControl.ItemsSource = new ObservableCollection <ProductAssociatePrice>(_activeProduct.ProductAssociatePrices); } }
private void AddEditDeleteListUserControlOnClickOnAddItem(object sender, RoutedEventArgs e) { var partReorderInformation = new PartReorderInformation(); WindowService.OpenUserControlDialog(new UcPartReorderInformation(partReorderInformation)); var dataIsAdded = ApplicationDataStore.GetData <bool>("IsAddedOrChanged"); if (dataIsAdded) { _activePart.PartReorderInformations.Add(partReorderInformation); ReorderInformationGridControl.ItemsSource = new ObservableCollection <PartReorderInformation>(_activePart.PartReorderInformations); } }
private void AddItemButtonOnClick(object sender, RoutedEventArgs e) { var newCarrierService = new CarrierService(); var newUc = new UcCarrierService(newCarrierService); WindowService.OpenUserControlDialog(newUc); var carrierService = ApplicationDataStore.GetData <CarrierService>("CarrierService"); if (carrierService != null) { _carrierServices.Add(carrierService); } CarrierServiceGridControl.RefreshData(); }
private void EditItemButtonOnClick(object sender, RoutedEventArgs e) { var activeCarrierService = CarrierServiceGridControl.SelectedItem as CarrierService; var editUc = new UcCarrierService(activeCarrierService); WindowService.OpenUserControlDialog(editUc); var carrierService = ApplicationDataStore.GetData <CarrierService>("CarrierService"); if (carrierService != null) { var oldOne = _carrierServices.First(item => item.Id == carrierService.Id); _carrierServices.Remove(oldOne); _carrierServices.Add(carrierService); } CarrierServiceGridControl.RefreshData(); }
/// <summary> /// Drops all tables from the database and updated DB Id /// </summary> /// <returns>The everything async.</returns> public Task DropEverythingAsync() { Settings.UpdateDatabaseId(); CategoryStore.DropTable(); EventStore.DropTable(); NotificationStore.DropTable(); SessionStore.DropTable(); WorkshopStore.DropTable(); SpeakerStore.DropTable(); SponsorStore.DropTable(); FeedbackStore.DropTable(); FavoriteStore.DropTable(); ApplicationDataStore.DropTable(); IsInitialized = false; return(Task.FromResult(true)); }
private void CreateFakeData(ApplicationDataStore applicationDataStore) { var projectViewModel = new ProjectViewModel { Name = "Bell" }; var storycard1 = new StorycardViewModel() { Role = "DEV", Title = "My Storycard", Estimate = 16 }; var storycard2 = new StorycardViewModel() { Role = "DEV", Title = "My Storycard", Estimate = 16 }; projectViewModel.Storycards.Add(storycard1); projectViewModel.Storycards.Add(storycard2); var iterationViewModel = new IterationViewModel() { EndDate = new DateTime(2016, 7, 7), IterationNumber = 4, }; iterationViewModel.Storycards.Add(new PlacedStorycardViewModel(storycard1)); var planningSheetViewModel = new PlanningSheetViewModel { Role = "DEV", Color = Brushes.Green }; planningSheetViewModel.PlannedCards.Add(new PlacedStorycardViewModel(storycard2)); iterationViewModel.PlanningSheets.Add(planningSheetViewModel); projectViewModel.Iterations.Add(iterationViewModel); applicationDataStore.SelectedIteration = iterationViewModel; applicationDataStore.Project = projectViewModel; }
private void SaveButtonOnClick(object sender, RoutedEventArgs e) { if (NewPasswordTextEdit.Text == RepeatNewPasswordTextEdit.Text) { if (_activeUserId > 0) { using (var dbContext = new FarnahadManufacturingDbContext()) { var user = dbContext.Users.Find(_activeUserId); var password = EncryptionUtility.EncryptPassword(CurrentPasswordTextEdit.Text, user.PasswordSalt); if (user.Password == password) { ApplicationDataStore.SendData("CurrentPassword", password); ApplicationDataStore.SendData("CurrentPasswordSalt", user.PasswordSalt); CloseWindow(); } else { MessageBox.Show("رمز عبور اشتباه است."); } } } else { var passwordSalt = Guid.NewGuid().ToString(); var password = EncryptionUtility.EncryptPassword(NewPasswordTextEdit.Text, passwordSalt); ApplicationDataStore.SendData("CurrentPassword", password); ApplicationDataStore.SendData("CurrentPasswordSalt", passwordSalt); } } else { MessageBox.Show("رمز عبور غیر یکسان است."); } }
private void SaveButtonOnClick(object sender, RoutedEventArgs e) { ReadData(_partReorderInformation); ApplicationDataStore.SendData("IsAddedOrChanged", true); WindowService.CloseUserControlDialogWindow(this); }
private void SetPasswordOnClick(object sender, RoutedEventArgs e) { WindowService.OpenUserControlDialog(new UcSetPassword(_activeUser.Id)); _activeUser.Password = ApplicationDataStore.GetData <string>("CurrentPassword"); _activeUser.PasswordSalt = ApplicationDataStore.GetData <string>("CurrentPasswordSalt"); }
private void ClickOnSave(object sender, RoutedEventArgs e) { ReadData(_productSubstitute); ApplicationDataStore.SendData("IsAddedOrChanged", true); WindowService.CloseUserControlDialogWindow(this); }