Compare commits
5 Commits
v1.0.0.1
...
181199039e
Author | SHA1 | Date | |
---|---|---|---|
181199039e | |||
53b1dedcf2 | |||
4790f8e304 | |||
8ff576257b | |||
6eaa928147 |
@@ -30,13 +30,13 @@
|
||||
|
||||
<DataTemplate x:Key="WineVarietyTemplateCollapsed">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
<TextBlock Text="{Binding Name}" Foreground="{Binding Color}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="WineVarietyTemplateExpanded">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding SortId}" MinWidth="36" Margin="0,0,10,0"/>
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
<TextBlock Text="{Binding SortId}" Foreground="{Binding Color}" MinWidth="36" Margin="0,0,10,0"/>
|
||||
<TextBlock Text="{Binding Name}" Foreground="{Binding Color}"/>
|
||||
<TextBlock Text="{Binding CommentFormat}" FontSize="10" VerticalAlignment="Bottom" Margin="0,0,0,2"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Elwig.Helpers.Billing {
|
||||
public class GraphEntry {
|
||||
@@ -40,6 +41,7 @@ namespace Elwig.Helpers.Billing {
|
||||
public string VaributeStringSimple => (Abgewertet ? "Abgew.: " : "") + (Vaributes.Count != 0 ? (Vaributes.Count >= 25 ? "Restliche Sorten" : string.Join(", ", Vaributes.Select(c => c.Listing))) : "-");
|
||||
public string VaributeString => Vaributes.Count != 0 ? string.Join("\n", Vaributes.Select(c => c.FullName)) : "-";
|
||||
public string VaributeStringChange => (Abgewertet ? "A." : "") + string.Join(",", Vaributes.Select(c => c.Listing));
|
||||
public Brush? Color => Vaributes.Select(v => v.Variety?.Color).Distinct().SingleOrDefault();
|
||||
private readonly int Precision;
|
||||
|
||||
public GraphEntry(int id, int precision, BillingData.CurveMode mode) {
|
||||
|
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using IndexAttribute = Microsoft.EntityFrameworkCore.IndexAttribute;
|
||||
|
||||
namespace Elwig.Models.Entities {
|
||||
@@ -118,6 +119,9 @@ namespace Elwig.Models.Entities {
|
||||
public string SortIdString => string.Join(", ", SortIds);
|
||||
public string FilteredSortIdString => string.Join(", ", FilteredSortIds);
|
||||
|
||||
public Brush? Color => Parts.Select(p => p.Variety.Color).Distinct().SingleOrDefault();
|
||||
public Brush? FilteredColor => FilteredParts.Select(p => p.Variety.Color).Distinct().SingleOrDefault();
|
||||
|
||||
public IEnumerable<string> Modifiers => Parts
|
||||
.SelectMany(p => p.Modifiers)
|
||||
.Select(m => m.Name)
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Elwig.Models.Entities {
|
||||
[Table("wine_variety"), PrimaryKey("SortId")]
|
||||
@@ -20,6 +21,7 @@ namespace Elwig.Models.Entities {
|
||||
|
||||
public bool IsRed => Type == "R";
|
||||
public bool IsWhite => Type == "W";
|
||||
public Brush? Color => IsWhite ? Brushes.DarkGreen : IsRed ? Brushes.DarkRed : null;
|
||||
|
||||
public WineVar() { }
|
||||
|
||||
|
@@ -1074,7 +1074,7 @@ namespace Elwig.Services {
|
||||
wGrid.ColumnDefinitions.Add(new() { Width = new(50) });
|
||||
int rowNum = 0;
|
||||
foreach (var row in weightData) {
|
||||
if (rowNum == 1 || (rowNum != 0 && row.Item1 != null)) rowNum++;
|
||||
if (rowNum != 0 && row.Item2 == null) rowNum++;
|
||||
AddWeightToolTipRow(wGrid, rowNum++, row.Item1, row.Item2, row.Item3, row.Item4, row.Item5);
|
||||
}
|
||||
|
||||
@@ -1089,7 +1089,7 @@ namespace Elwig.Services {
|
||||
AddToolTipCell(gGrid, "Max.", 0, 4, 1, false, false, true);
|
||||
rowNum = 1;
|
||||
foreach (var row in gradationData) {
|
||||
if (rowNum == 2 || (rowNum != 1 && row.Item1 != null)) rowNum++;
|
||||
if (rowNum != 1 && row.Item2 == null) rowNum++;
|
||||
AddGradationToolTipRow(gGrid, rowNum++, row.Item1, row.Item2, row.Item3, row.Item4, row.Item5);
|
||||
}
|
||||
|
||||
|
@@ -75,8 +75,8 @@
|
||||
<ctrl:CheckComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Variety.Name}" Width="150"/>
|
||||
<TextBlock Text="{Binding Variety.Type}" Width="30"/>
|
||||
<TextBlock Text="{Binding Variety.Name}" Foreground="{Binding Variety.Color}" Width="150"/>
|
||||
<TextBlock Text="{Binding Variety.Type}" Foreground="{Binding Variety.Color}" Width="30"/>
|
||||
<TextBlock Text="{Binding Attribute.Name}" Width="80"/>
|
||||
<TextBlock Text="{Binding Cultivation.Name}" Width="80"/>
|
||||
<TextBlock Text="{Binding AssignedGraphId}" Width="30"/>
|
||||
@@ -94,8 +94,8 @@
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Id}" Width="30"/>
|
||||
<TextBlock Text="{Binding VaributeStringSimple}" ToolTip="{Binding VaributeString}"/>
|
||||
<TextBlock Text="{Binding Id}" Foreground="{Binding Color}" Width="30"/>
|
||||
<TextBlock Text="{Binding VaributeStringSimple}" Foreground="{Binding Color}" ToolTip="{Binding VaributeString}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
@@ -268,6 +268,7 @@
|
||||
<DataGridTextColumn Header="Sorte" Binding="{Binding FilteredSortIdString}" Width="50">
|
||||
<DataGridTextColumn.CellStyle>
|
||||
<Style>
|
||||
<Setter Property="TextBlock.Foreground" Value="{Binding FilteredColor}"/>
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.CellStyle>
|
||||
@@ -438,7 +439,7 @@
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding DPNr}" Width="13" TextAlignment="Right" Margin="0,0,7,0"/>
|
||||
<TextBlock Text="{Binding SortId}" Width="30"/>
|
||||
<TextBlock Text="{Binding SortId}" Foreground="{Binding Variety.Color}" TextAlignment="Center" Width="30"/>
|
||||
<TextBlock Text="{Binding Kmw, StringFormat='{}{0:N1}°'}" Width="40" TextAlignment="Right" Padding="0,0,10,0"/>
|
||||
<TextBlock Text="{Binding QualId}" Width="30"/>
|
||||
<TextBlock Text="{Binding Weight, StringFormat='{}{0:N0} kg'}" Width="60" TextAlignment="Right" Padding="0,0,10,0"/>
|
||||
@@ -460,7 +461,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Content="Sorte:" Margin="10,10,0,0" Grid.Column="0"/>
|
||||
<TextBox x:Name="SortIdInput" Text="{Binding SortId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
<TextBox x:Name="SortIdInput" Text="{Binding SortId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="{Binding WineVar.Color}"
|
||||
Width="36" Grid.Row="1" Grid.Column="1" Margin="0,10,0,0" HorizontalAlignment="Left"
|
||||
TextChanged="SortIdInput_TextChanged" LostFocus="SortIdInput_LostFocus" KeyUp="Input_KeyUp"/>
|
||||
<ComboBox x:Name="WineVarietyInput" SelectedItem="{Binding WineVar, Mode=TwoWay}" ItemsSource="{Binding WineVarSource, Mode=TwoWay}"
|
||||
|
@@ -187,6 +187,7 @@
|
||||
<DataGridTextColumn Header="Sorte" Binding="{Binding SortId}" Width="50">
|
||||
<DataGridTextColumn.CellStyle>
|
||||
<Style>
|
||||
<Setter Property="TextBlock.Foreground" Value="{Binding Variety.Color}"/>
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
|
||||
</Style>
|
||||
</DataGridTextColumn.CellStyle>
|
||||
@@ -198,7 +199,7 @@
|
||||
</Style>
|
||||
</DataGridTextColumn.CellStyle>
|
||||
</DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Angemeldet" Binding="{Binding CreatedTimestamp, StringFormat='{}{0:HH:mm, dd.MM.}'}" Width="100">
|
||||
<DataGridTextColumn Header="Angemeldet" Binding="{Binding CreatedAt, StringFormat='{}{0:HH:mm, dd.MM.}'}" Width="100">
|
||||
<DataGridTextColumn.CellStyle>
|
||||
<Style>
|
||||
<Setter Property="TextBlock.TextAlignment" Value="Center"/>
|
||||
@@ -316,7 +317,7 @@
|
||||
</ComboBox>
|
||||
|
||||
<Label Content="Sorte:" Margin="10,40,0,0" Grid.Column="0"/>
|
||||
<TextBox x:Name="SortIdInput" Text="{Binding SortId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
<TextBox x:Name="SortIdInput" Text="{Binding SortId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="{Binding WineVariety.Color}"
|
||||
Width="36" Grid.Row="1" Grid.Column="1" Margin="0,40,0,0" HorizontalAlignment="Left"
|
||||
TextChanged="SortIdInput_TextChanged" LostFocus="SortIdInput_LostFocus" KeyUp="Input_KeyUp"/>
|
||||
<ComboBox x:Name="WineVarietyInput" SelectedItem="{Binding WineVariety, Mode=TwoWay}" ItemsSource="{Binding WineVarietySource, Mode=TwoWay}"
|
||||
|
@@ -103,6 +103,7 @@ namespace Elwig.Windows {
|
||||
var deliveryAncmts = await deliveryAncmtQuery
|
||||
.Include(a => a.Member.BillingAddress)
|
||||
.Include(a => a.Schedule)
|
||||
.Include(a => a.Variety)
|
||||
.AsSplitQuery()
|
||||
.ToListAsync();
|
||||
|
||||
|
@@ -602,7 +602,7 @@ namespace Elwig.Windows {
|
||||
PreviewButton.IsEnabled = false;
|
||||
PrintButton.IsEnabled = false;
|
||||
EmailButton.IsEnabled = false;
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
GenerateButton.IsEnabled = false;
|
||||
|
||||
DisposeDocs();
|
||||
@@ -828,25 +828,27 @@ namespace Elwig.Windows {
|
||||
EmailButton.IsEnabled = EmailDocuments != null && App.Config.Smtp != null;
|
||||
}
|
||||
|
||||
private void PreviewButton_Click(object sender, RoutedEventArgs evt) {
|
||||
private async void PreviewButton_Click(object sender, RoutedEventArgs evt) {
|
||||
var d = new OpenFolderDialog() {
|
||||
Title = "Ordner auswählen - Elwig",
|
||||
};
|
||||
if (d.ShowDialog() == true) {
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
PrintDocument?.SaveTo($"{d.FolderName}/Print.pdf");
|
||||
if (EmailDocuments != null) {
|
||||
foreach (var (m, docs) in EmailDocuments) {
|
||||
var folder = $"{d.FolderName}/E-Mail/{m.AdministrativeName.Trim()}";
|
||||
Directory.CreateDirectory(folder);
|
||||
foreach (var item in docs.Select((d, i) => new { Index = i, Doc = d })) {
|
||||
var doc = item.Doc;
|
||||
var name = Utils.NormalizeFileName(doc.Title);
|
||||
doc.SaveTo($"{folder}/{item.Index + 1:00}.{name}.pdf");
|
||||
}
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
await Task.Run(() => {
|
||||
PrintDocument?.SaveTo($"{d.FolderName}/Print.pdf");
|
||||
if (EmailDocuments != null) {
|
||||
foreach (var (m, docs) in EmailDocuments) {
|
||||
var folder = $"{d.FolderName}/E-Mail/{m.AdministrativeName.Trim()}";
|
||||
Directory.CreateDirectory(folder);
|
||||
foreach (var item in docs.Select((d, i) => new { Index = i, Doc = d })) {
|
||||
var doc = item.Doc;
|
||||
var name = Utils.NormalizeFileName(doc.Title);
|
||||
doc.SaveTo($"{folder}/{item.Index + 1:00}.{name}.pdf");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Mouse.OverrideCursor = null;
|
||||
Process.Start("explorer.exe", d.FolderName);
|
||||
}
|
||||
@@ -862,20 +864,22 @@ namespace Elwig.Windows {
|
||||
var res = MessageBox.Show($"Sollen {PrintDocument.Pages} Blätter ({PrintDocument.TotalPages} Seiten) gedruckt werden?",
|
||||
"Rundschreiben drucken", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No);
|
||||
if (res == MessageBoxResult.Yes) {
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
if (App.Config.Debug) {
|
||||
PrintDocument.Show();
|
||||
} else {
|
||||
await PrintDocument.Print();
|
||||
await Utils.AddSentMails(
|
||||
PrintMemberDocuments.Select(d => (
|
||||
"postal", d.Key.MgNr, d.Key.AdministrativeName,
|
||||
new string[] { d.Value.Select(d => (d as BusinessDocument)?.Address).FirstOrDefault(a => a != null) ?? d.Key.FullAddress },
|
||||
d.Value.Select(d => d.Title).FirstOrDefault("Briefkopf"),
|
||||
d.Value.Select(d => d.Title).ToArray()
|
||||
))
|
||||
);
|
||||
}
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
await Task.Run(async () => {
|
||||
if (App.Config.Debug) {
|
||||
PrintDocument.Show();
|
||||
} else {
|
||||
await PrintDocument.Print();
|
||||
await Utils.AddSentMails(
|
||||
PrintMemberDocuments.Select(d => (
|
||||
"postal", d.Key.MgNr, d.Key.AdministrativeName,
|
||||
new string[] { d.Value.Select(d => (d as BusinessDocument)?.Address).FirstOrDefault(a => a != null) ?? d.Key.FullAddress },
|
||||
d.Value.Select(d => d.Title).FirstOrDefault("Briefkopf"),
|
||||
d.Value.Select(d => d.Title).ToArray()
|
||||
))
|
||||
);
|
||||
}
|
||||
});
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
|
||||
@@ -893,8 +897,8 @@ namespace Elwig.Windows {
|
||||
|
||||
SmtpClient? client = null;
|
||||
try {
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
client = await Utils.GetSmtpClient();
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
client = await Task.Run(Utils.GetSmtpClient);
|
||||
Mouse.OverrideCursor = null;
|
||||
|
||||
var res = MessageBox.Show($"Sollen {EmailDocuments.Count:N0} E-Mails verschickt werden?",
|
||||
@@ -903,31 +907,33 @@ namespace Elwig.Windows {
|
||||
return;
|
||||
}
|
||||
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
var subject = EmailSubjectInput.Text;
|
||||
var text = EmailBodyInput.Text;
|
||||
await Utils.AddSentMailBody(subject, text, EmailDocuments.Count);
|
||||
foreach (var (m, docs) in EmailDocuments) {
|
||||
using var msg = new MimeMessage();
|
||||
msg.From.Add(new MailboxAddress(App.Client.NameFull, App.Config.Smtp.Value.From));
|
||||
msg.To.AddRange(m.EmailAddresses.OrderBy(a => a.Nr).Select(a => new MailboxAddress(m.AdministrativeName, a.Address)));
|
||||
msg.Subject = subject;
|
||||
var body = new Multipart("mixed") {
|
||||
new TextPart("plain") { Text = text }
|
||||
};
|
||||
foreach (var doc in docs) {
|
||||
var name = Utils.NormalizeFileName(doc.Title);
|
||||
body.Add(doc.AsEmailAttachment($"{name}.pdf"));
|
||||
await Task.Run(async () => {
|
||||
await Utils.AddSentMailBody(subject, text, EmailDocuments.Count);
|
||||
foreach (var (m, docs) in EmailDocuments) {
|
||||
using var msg = new MimeMessage();
|
||||
msg.From.Add(new MailboxAddress(App.Client.NameFull, App.Config.Smtp.Value.From));
|
||||
msg.To.AddRange(m.EmailAddresses.OrderBy(a => a.Nr).Select(a => new MailboxAddress(m.AdministrativeName, a.Address)));
|
||||
msg.Subject = subject;
|
||||
var body = new Multipart("mixed") {
|
||||
new TextPart("plain") { Text = text }
|
||||
};
|
||||
foreach (var doc in docs) {
|
||||
var name = Utils.NormalizeFileName(doc.Title);
|
||||
body.Add(doc.AsEmailAttachment($"{name}.pdf"));
|
||||
}
|
||||
msg.Body = body;
|
||||
await client!.SendAsync(msg);
|
||||
await Utils.AddSentMails([(
|
||||
"email", m.MgNr, m.AdministrativeName,
|
||||
m.EmailAddresses.OrderBy(a => a.Nr).Select(a => a.Address).ToArray(),
|
||||
subject,
|
||||
docs.Select(d => d.Title).ToArray()
|
||||
)]);
|
||||
}
|
||||
msg.Body = body;
|
||||
await client!.SendAsync(msg);
|
||||
await Utils.AddSentMails([(
|
||||
"email", m.MgNr, m.AdministrativeName,
|
||||
m.EmailAddresses.OrderBy(a => a.Nr).Select(a => a.Address).ToArray(),
|
||||
subject,
|
||||
docs.Select(d => d.Title).ToArray()
|
||||
)]);
|
||||
}
|
||||
});
|
||||
|
||||
MessageBox.Show("Erfolgreich alle E-Mails verschickt!", "Rundschreiben verschicken", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
} catch (Exception exc) {
|
||||
|
@@ -156,7 +156,7 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async void AutoAdjustBsButton_Click(object sender, RoutedEventArgs evt) {
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
try {
|
||||
int? kg = AllowanceKgInput.Text == "" ? null : int.Parse(AllowanceKgInput.Text);
|
||||
double? bs = AllowanceBsInput.Text == "" ? null : double.Parse(AllowanceBsInput.Text);
|
||||
@@ -169,10 +169,12 @@ namespace Elwig.Windows {
|
||||
App.Client.AutoAdjustBs.AllowanceKgPerBs = kgPerBs;
|
||||
App.Client.AutoAdjustBs.AllowancePercent = percent;
|
||||
App.Client.AutoAdjustBs.MinBs = minBs;
|
||||
await App.Client.UpdateValues();
|
||||
|
||||
var b = new Billing(Year);
|
||||
await b.AutoAdjustBusinessShares(new DateOnly(Year, 11, 30), kg ?? default, bs ?? default, kgPerBs ?? default, percent / 100.0 ?? default, minBs ?? default);
|
||||
await Task.Run(async () => {
|
||||
await App.Client.UpdateValues();
|
||||
var b = new Billing(Year);
|
||||
await b.AutoAdjustBusinessShares(new DateOnly(Year, 11, 30), kg ?? default, bs ?? default, kgPerBs ?? default, percent / 100.0 ?? default, minBs ?? default);
|
||||
});
|
||||
App.HintContextChange();
|
||||
} catch (Exception exc) {
|
||||
var str = "Der Eintrag konnte nicht in der Datenbank aktualisiert werden!\n\n" + exc.Message;
|
||||
@@ -183,10 +185,12 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
private async void UnAdjustBsButton_Click(object sender, RoutedEventArgs evt) {
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
try {
|
||||
var b = new Billing(Year);
|
||||
await b.UnAdjustBusinessShares();
|
||||
await Task.Run(async () => {
|
||||
var b = new Billing(Year);
|
||||
await b.UnAdjustBusinessShares();
|
||||
});
|
||||
App.HintContextChange();
|
||||
} catch (Exception exc) {
|
||||
var str = "Der Eintrag konnte nicht in der Datenbank aktualisiert werden!\n\n" + exc.Message;
|
||||
@@ -281,29 +285,31 @@ namespace Elwig.Windows {
|
||||
|
||||
private async void CustomButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (MemberInput.SelectedItem is not Member m) return;
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
Mouse.OverrideCursor = Cursors.Wait;
|
||||
try {
|
||||
using var ctx = new AppDbContext();
|
||||
if (CustomPayments?.TryGetValue(m.MgNr, out var p) == true) {
|
||||
ctx.Remove(p);
|
||||
}
|
||||
if (sender == SaveCustomButton) {
|
||||
var modAbs = decimal.TryParse(CustomModAbsInput.Text, out var n1) ? (decimal?)n1 : null;
|
||||
var modRel = decimal.TryParse(CustomModRelInput.Text, out var n2) ? (decimal?)n2 / 100 : null;
|
||||
var amount = decimal.TryParse(CustomAmountInput.Text, out var n3) ? (decimal?)n3 : null;
|
||||
var modText = CustomModCommentInput.Text.Trim();
|
||||
var text = CustomCommentInput.Text.Trim();
|
||||
ctx.Add(new PaymentCustom {
|
||||
MgNr = m.MgNr,
|
||||
Year = Year,
|
||||
ModAbs = modAbs,
|
||||
ModRel = modRel,
|
||||
ModComment = modText == "" ? null : modText,
|
||||
Amount = amount,
|
||||
Comment = text == "" ? null : text,
|
||||
});
|
||||
}
|
||||
await ctx.SaveChangesAsync();
|
||||
await Task.Run(async () => {
|
||||
using var ctx = new AppDbContext();
|
||||
if (CustomPayments?.TryGetValue(m.MgNr, out var p) == true) {
|
||||
ctx.Remove(p);
|
||||
}
|
||||
if (sender == SaveCustomButton) {
|
||||
var modAbs = decimal.TryParse(CustomModAbsInput.Text, out var n1) ? (decimal?)n1 : null;
|
||||
var modRel = decimal.TryParse(CustomModRelInput.Text, out var n2) ? (decimal?)n2 / 100 : null;
|
||||
var amount = decimal.TryParse(CustomAmountInput.Text, out var n3) ? (decimal?)n3 : null;
|
||||
var modText = CustomModCommentInput.Text.Trim();
|
||||
var text = CustomCommentInput.Text.Trim();
|
||||
ctx.Add(new PaymentCustom {
|
||||
MgNr = m.MgNr,
|
||||
Year = Year,
|
||||
ModAbs = modAbs,
|
||||
ModRel = modRel,
|
||||
ModComment = modText == "" ? null : modText,
|
||||
Amount = amount,
|
||||
Comment = text == "" ? null : text,
|
||||
});
|
||||
}
|
||||
await ctx.SaveChangesAsync();
|
||||
});
|
||||
} catch (Exception exc) {
|
||||
var str = "Der Eintrag konnte nicht in der Datenbank aktualisiert werden!\n\n" + exc.Message;
|
||||
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;
|
||||
|
@@ -128,7 +128,8 @@
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right" Width="25" Height="25" Margin="5,60,5,0" Grid.RowSpan="2"
|
||||
Click="DeleteButton_Click"/>
|
||||
|
||||
<TextBox x:Name="DataInput" Margin="10,200,35,10" IsReadOnly="{Binding DataIsReadOnly}"
|
||||
<TextBox x:Name="DataInput" Text="{Binding Data, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="{Binding DataIsReadOnly}"
|
||||
Margin="10,200,35,10"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="auto"
|
||||
AcceptsReturn="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto"
|
||||
FontFamily="Cascadia Code Light" FontSize="13"
|
||||
|
Reference in New Issue
Block a user