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