private void SetEditedOperationValues(OperationPattern operationPattern) { if (operationPattern.isExpense) { Expense_RadioButton.IsChecked = true; } else { Income_RadioButton.IsChecked = true; } CostValue.Text = NewOperation.ToCurrencyString(operationPattern.Cost); _acceptedCostValue = NewOperation.ToCurrencyWithoutSymbolString(operationPattern.Cost); NameValue.Text = operationPattern.Title; if (operationPattern is Operation && !string.IsNullOrEmpty(((Operation)operationPattern).Date)) { Operation operation = (Operation)operationPattern; DateValue.Date = DateTime.Parse(operation.Date); HideInStatisticsToggle.IsOn = !operation.VisibleInStatistics; } CategoryValue.SelectedItem = CategoryValue.Items.OfType <ComboBoxItem>().SingleOrDefault(i => i.Tag.ToString() == operationPattern.Category?.GlobalId); SubCategoryValue.SelectedItem = SubCategoryValue.Items.OfType <ComboBoxItem>().SingleOrDefault(item => item.Tag.ToString() == operationPattern.SubCategory?.GlobalId); // PayFormValue.SelectedItem = PayFormValue.Items.OfType<Account>().SingleOrDefault(item => item.Id == operationPattern.MoneyAccountId); if (!string.IsNullOrEmpty(operationPattern.MoreInfo)) { MoreInfoValue.Text = operationPattern.MoreInfo; } _isLoaded = true; }
private static void UpdateSyncOperation(OperationPattern operation) { using (var db = DbConnection) { db.TraceListener = new DebugTraceListener(); db.Update(operation); } }
/* * public static void UpdateCategory(Category category) { * using (var db = DbConnection) { * db.TraceListener = new DebugTraceListener(); * * category.LastModifed = DateTimeHelper.DateTimeUtcNowString; * * db.Update(category); * } * } * * public static void AddCategory(Category category) { * using (var db = DbConnection) { * db.TraceListener = new DebugTraceListener(); * * category.LastModifed = DateTimeHelper.DateTimeUtcNowString; * * //int id = db.ExecuteScalar<int>("SELECT seq FROM sqlite_sequence WHERE name = 'Category'") + 1; * category.GlobalId = ( GetMaxRowId(typeof(Category)) + 1 ).NewGlobalIdFromLocal();//$"{Informations.DeviceId}_{id}"; * db.Insert(category); * } * } * * public static void UpdateSubCategory(SubCategory subCategory) { * using (var db = DbConnection) { * db.TraceListener = new DebugTraceListener(); * * subCategory.LastModifed = DateTimeHelper.DateTimeUtcNowString; * * db.Update(subCategory); * } * } * * public static void AddSubCategory(SubCategory subCategory) { * using (var db = new SQLiteConnection(new SQLitePlatformWinRT(), DbPath)) { * db.TraceListener = new DebugTraceListener(); * * subCategory.LastModifed = DateTimeHelper.DateTimeUtcNowString; * * //int id = db.ExecuteScalar<int>("SELECT seq FROM sqlite_sequence WHERE name = 'SubCategory'") + 1; * subCategory.GlobalId = (GetMaxRowId(typeof(SubCategory)) + 1).NewGlobalIdFromLocal();// id.NewGlobalIdFromLocal();//$"{Informations.DeviceId}_{id}"; * db.Insert(subCategory); * * //TODO Insert jak nie ma takiego GlobalId, Update jak jest * //TODO nie czekaj... no jest kłopot... tak nie mozna * } * } */ /* DELETE */ public static void DeletePattern(OperationPattern operationPattern) { using (var db = DbConnection) { db.TraceListener = new DebugTraceListener(); db.Execute("UPDATE OperationPattern " + "SET IsDeleted = 1, LastModifed = ? " + "WHERE Id = ?", DateTimeHelper.DateTimeUtcNowString, operationPattern.Id); } }
public EditOperationContentDialog(OperationPattern operationPatternToEdit) { InitializeComponent(); _operationPatternToEdit = operationPatternToEdit; DateValue.Visibility = Visibility.Collapsed; _originalOperationPattern = operationPatternToEdit.ToOperation(); SetEditedOperationValues(operationPatternToEdit); }
public EditOperationContentDialog(Operation operationToEdit) { InitializeComponent(); _operationToEdit = operationToEdit; DateValue.MaxDate = Settings.MaxDate; _originalOperationPattern = operationToEdit.ToOperation(); // setMoneyAccountComboBoxItems(); SetEditedOperationValues(operationToEdit); }
private async void ShowDeleteContentDialog(OperationPattern operationPattern) { var contentDialogItem = new AcceptContentDialog("Czy chcesz usunąć szablon?"); var result = await contentDialogItem.ShowAsync(); if (result != ContentDialogResult.Primary) { return; } RemoveOperationPatternFromList(operationPattern); Dal.DeletePattern(operationPattern); }
private async void ShowDetailsContentDialog(OperationPattern operationPattern) { var contentDialogItem = new OperationDetailsContentDialog(operationPattern, "pattern", Settings.Theme); var result = await contentDialogItem.ShowAsync(); if (result == ContentDialogResult.Primary) { ShowEditContentDialog(operationPattern); } else if (result == ContentDialogResult.Secondary) { ShowDeleteContentDialog(operationPattern); } }
private async void ShowEditContentDialog(OperationPattern operationPattern) { var contentDialogItem = new EditOperationContentDialog(operationPattern); var result = await contentDialogItem.ShowAsync(); if (result != ContentDialogResult.Primary) { return; } OperationPattern newOperationPattern = contentDialogItem.EditedOperationPattern(); _operationPatterns[_operationPatterns.IndexOf(operationPattern)] = newOperationPattern; }
public static void SaveOperationPattern(OperationPattern operationPattern) { using (var db = DbConnection) { db.TraceListener = new DebugTraceListener(); operationPattern.LastModifed = DateTimeHelper.DateTimeUtcNowString; if (operationPattern.Id == 0) { //int id = db.ExecuteScalar<int>("SELECT seq FROM sqlite_sequence WHERE name = 'OperationPattern'") + 1; operationPattern.GlobalId = (GetMaxRowId(typeof(OperationPattern)) + 1).NewGlobalIdFromLocal(); //$"{Informations.DeviceId}_{id}"; db.Insert(operationPattern); } else { db.Update(operationPattern); } } }
public CtrlToolPattern() { InitializeComponent(); var roi = Program.FrmMain.ROI; Operation = new OperationPattern(roi.IsEmpty ? Program.SlicerFile.LayerManager.BoundingRectangle : roi, Program.FrmMain.ActualLayerImage.Size); SetOperation(Operation); if (Operation.MaxRows < 2 && Operation.MaxCols < 2) { GUIExtensions.MessageBoxInformation("Unable to pattern", "The available free volume is not enough to pattern this object.\n" + "To run this tool the free space must allow at least 1 copy."); CanRun = false; return; } ExtraActionCall(this); }
public OperationDetailsContentDialog(OperationPattern editedOperation, string whichOption, ApplicationTheme theme) { // RequestedTheme = theme == ApplicationTheme.Light ? ElementTheme.Light : ElementTheme.Dark; InitializeComponent(); if (whichOption == "pattern") { Title = new Windows.ApplicationModel.Resources.ResourceLoader().GetString("patternDetails"); } if (editedOperation.isExpense) { CostValue.Text = (-editedOperation.Cost).ToString("C", Settings.ActualCultureInfo); CostValue.Foreground = (SolidColorBrush)Application.Current.Resources["RedColorStyle"]; } else { CostValue.Text = editedOperation.Cost.ToString("C", Settings.ActualCultureInfo); CostValue.Foreground = (SolidColorBrush)Application.Current.Resources["GreenColorStyle"]; } NameValue.Visibility = Visibility.Collapsed; if (!string.IsNullOrEmpty(editedOperation.Title)) { NameValue.Text = editedOperation.Title; NameValue.Visibility = Visibility.Visible; } DateValuePanel.Visibility = Visibility.Collapsed; if (!string.IsNullOrEmpty((editedOperation as Operation)?.Date)) { DateValue.Text = string.Format("{0:dddd, dd MMMM yyyy}", Convert.ToDateTime(((Operation)editedOperation).Date)); DateValuePanel.Visibility = Visibility.Visible; } Category cat = editedOperation.Category; SubCategory subCat = editedOperation.SubCategory; MAccount account = editedOperation.Account; /* KATEGORIA */ CategoryValuePanel.Visibility = Visibility.Collapsed; if (cat != null) { CategoryValue.Text = cat.Name; CategoryValuePanel.Visibility = Visibility.Visible; } /* PODKATEGORIA */ SubCategoryValuePanel.Visibility = Visibility.Collapsed; if (subCat != null) { SubCategoryValue.Text = subCat.Name; SubCategoryValuePanel.Visibility = Visibility.Visible; } /* FORMA PŁATNOŚCI */ PayFormPanel.Visibility = Visibility.Collapsed; if (account != null) { PayForm.Text = account.Name; PayFormPanel.Visibility = Visibility.Visible; if (account is SubMAccount) { PayFormIcon.Glyph = ""; } else { PayFormIcon.Glyph = ""; } } /* WIĘCEJ INFORMACJI */ if (!string.IsNullOrEmpty(editedOperation.MoreInfo)) { MoreInfo.Text = editedOperation.MoreInfo; } else { MoreInfoPanel.Visibility = Visibility.Collapsed; } }
private bool Match(string expression, out Match match) => (match = _additionFirst ? !(match = AddOperationPattern.Match(expression)).Success ? OperationPattern.Match(expression) : match : OperationPattern.Match(expression)).Success;
private void SzablonyListView_ItemClick(object sender, ItemClickEventArgs e) { OperationPattern thisPattern = (OperationPattern)e.ClickedItem; ShowDetailsContentDialog(thisPattern); }
public void AddOperationPatternToList(OperationPattern operationPattern) => _operationPatterns.Insert(0, operationPattern);
public void RemoveOperationPatternFromList(OperationPattern operationPattern) => _operationPatterns.Remove(operationPattern);