private void priorityButton_Click(object sender, RoutedEventArgs e) { PriorityWindow pw = new PriorityWindow(); pw.Show(); this.Close(); }
private void delCustomPropButton_Click(object sender, RoutedEventArgs e) { myProperties.Remove(customPropNameTextBox.Text); myProperties.TotalValue += 0; using (var db = new LiteDatabase(@"AdatBazis.db")) { var list = db.GetCollection <CustomPropAggregator>("customList"); var results = list.Delete(Query.EQ("Title", customPropNameTextBox.Text)); } propGridCustom.Refresh(); PriorityWindow pw = new PriorityWindow(); pw.tryDelete(customPropNameTextBox.Text); }
public void searchForOverLimit() { List <PropListItem> overLimitItems = new List <PropListItem>(); List <CustomPropAggregator> spikeItems = new List <CustomPropAggregator>(); using (var db = new LiteDatabase(@"AdatBazis.db")) { var fullCol = PriorityWindow.getAllPropsList(false); foreach (var item in fullCol) { if (item.Limit > 0 && item.Name == "TV" && props.media.Television > item.Limit) { overLimitItems.Add(item); } if (item.Limit > 0 && item.Name == "Ruházkodás" && props.household.Clothing > item.Limit) { overLimitItems.Add(item); } if (item.Limit > 0 && item.Name == "Hitelkártya" && props.others.CreditCard > item.Limit) { overLimitItems.Add(item); } if (item.Limit > 0 && item.Name == "Étterem" && props.leisure.eatingOut > item.Limit) { overLimitItems.Add(item); } if (item.Limit > 0 && item.Name == "Káros szenvedélyek" && props.leisure.cigarettesAndAlcohol > item.Limit) { overLimitItems.Add(item); } } var col_custom = db.GetCollection <CustomPropAggregator>("customList"); var listCustom = db.GetCollection <PropListItem>("propListCustom"); var listCol = listCustom.Find(Query.All()); var customCol = col_custom.Find(Query.All("Title")); foreach (var item in listCol) { foreach (var custom in customCol) { if (item.Name == custom.Title) { if (item.Limit > 0 && item.Limit < custom.Spending) { if (!overLimitItems.Contains(item)) { overLimitItems.Add(item); } } } } } var col_warnings = db.GetCollection <PropListItem>("warnings"); col_warnings.Delete(Query.All()); foreach (var item in overLimitItems) { col_warnings.Insert(item); } foreach (var custom in customCol) { foreach (var other in customCol) { if (other.Title == custom.Title && (other.TimeStamp.Month == custom.TimeStamp.Month + 1) && (other.Spending > (custom.Spending * new decimal(1.5)))) { spikeItems.Add(other); } } } var col_spikes = db.GetCollection <CustomPropAggregator>("spikes"); col_spikes.Delete(Query.All()); foreach (var item in spikeItems) { col_spikes.Insert(item); } } }