public ImportOperationsView() { InitializeComponent(); ViewsMemory.AddedGroup += AddedGroupEvent; ViewsMemory.AddedParameter += AddedParameterEvent; Background = Brushes.Azure; LoadAttributes(); LoadOperationsGroup(); SetStandardEditableControls(); SetCloneEditableControls(); SetCloneOptionsVisibility(Visibility.Hidden); SetRelatedControlsAttributesVisibility(Visibility.Hidden); SetUserStandardEditableControlsVisibility(Visibility.Hidden); SetNavigateButtonVisibility(Visibility.Hidden); ViewsMemory.AddImportingOperations(Service.Import()); if (ViewsMemory.CurrentOperation() == null) { return; } SetNavigateButtonVisibility(Visibility.Visible); Show(ViewsMemory.CurrentOperation()); }
private void BtnImportAccept_Click(object sender, RoutedEventArgs e) { var operation = ViewsMemory.CurrentOperation(); var tmp = _tbDescription.Text; operation.SetParent(_cbRelated.SelectedItem as OperationsGroup); operation.SetDescription(_tbNewDescription.Text); operation.SetShortDescription(_tbNewDescription.Text); if (operation.Parent != null) { operation.SetImportance(operation.Parent.Importance); operation.SetFrequency(operation.Parent.Frequency); operation.RemoveAllTags(); foreach (var item in operation.Parent.Tags) { operation.AddTag(item.Tag); } } else { operation.SetImportance(_cbImportance.SelectedItem as Importance); operation.SetFrequency(_cbFrequent.SelectedItem as Frequency); operation.RemoveAllTags(); foreach (var item in _selectedTags) { operation.AddTag(item); } } try { Service.UpdateOperationComplex(operation); ViewsMemory.RemoveImportingOperation(operation); } catch (Exception ex) { var dialog = new MessageBox(Properties.strings.messageBoxStatement, ex.Message); operation.SetDescription(tmp); dialog.ShowDialog(); } Show(ViewsMemory.CurrentOperation()); }
private void BtnImportCloneAccept_Click(object sender, RoutedEventArgs e) { var currentOperation = ViewsMemory.CurrentOperation(); SetCloneOptionsVisibility(Visibility.Hidden); if (_upDownClone.Value.HasValue && _upDownClone.Value.Value >= decimal.Zero) { var difference = currentOperation.Amount - _upDownClone.Value.Value; currentOperation.SetAmount(_upDownClone.Value.Value); _labAmount.Content = currentOperation.Amount.ToString(CultureInfo.CurrentCulture); var operation = new Operation(null, null, Service.User, "", 0M, null, null, null, null, DateTime.Now, ""); operation.SetDescription(currentOperation.Description); operation.SetShortDescription(currentOperation.ShortDescription); operation.SetTransaction(currentOperation.TransactionType); operation.SetTransfer(currentOperation.TransferType); operation.SetDate(currentOperation.Date); operation.SetFrequency(currentOperation.Frequency); operation.SetImportance(currentOperation.Importance); operation.SetTags(currentOperation.Tags); operation.SetTransfer(currentOperation.TransferType); if (difference >= decimal.Zero) { operation.SetAmount(difference); operation.SetTransaction(currentOperation.TransactionType); } else { operation.SetAmount(-1 * difference); var anotherTransaction = currentOperation.TransactionType.Text == Service.TransactionTypes[0].Text ? Service.TransactionTypes[1] : Service.TransactionTypes[0]; operation.SetTransaction(anotherTransaction); } ViewsMemory.InsertOperation(currentOperation, operation); } }
private void BtnImportIgnore_Click(object sender, RoutedEventArgs e) { ViewsMemory.RemoveImportingOperation(ViewsMemory.CurrentOperation()); Show(ViewsMemory.CurrentOperation()); }