Windows: Get rid of more warnings

This commit is contained in:
2024-02-29 16:14:13 +01:00
parent 247367d1bf
commit 55c447621b
2 changed files with 10 additions and 10 deletions

View File

@ -52,13 +52,13 @@ namespace Elwig.Windows {
var year = (SeasonList.SelectedItem as Season)?.Year;
foreach (var (modid, _) in _mods.Where(m => m.Value == null)) {
Context.Remove(Context.Modifiers.Find(year, modid));
Context.Remove(Context.Modifiers.Find(year, modid)!);
}
foreach (var (mod, old) in _modIds) {
mod.ModId = old;
}
foreach (var (old, modid) in _mods.Where(m => m.Value != null)) {
Context.Update(Context.Modifiers.Find(year, old));
Context.Update(Context.Modifiers.Find(year, old)!);
}
await Context.SaveChangesAsync();

View File

@ -469,8 +469,8 @@ namespace Elwig.Windows {
var s = date.ToString("yyyy-MM-dd");
filterDate.Add((s, s));
filter.RemoveAt(i--);
if (filterNames.Contains(SeasonInput.Value.ToString()) && SeasonInput.Value == date.Year)
filterNames.Remove(SeasonInput.Value.ToString());
if (filterNames.Contains(SeasonInput.Value.ToString()!) && SeasonInput.Value == date.Year)
filterNames.Remove(SeasonInput.Value.ToString()!);
filterNames.Add(date.ToString("dd.MM.yyyy"));
} else if (Utils.DateFromToRegex.IsMatch(e)) {
var parts = e.Split("-");
@ -482,11 +482,11 @@ namespace Elwig.Windows {
filter.RemoveAt(i--);
var n = string.Join('.', s.Split('-').Reverse());
if (dParts[2] == "") {
filterNames.Remove(SeasonInput.Value.ToString());
filterNames.Remove(SeasonInput.Value.ToString()!);
filterNames.Add(n + SeasonInput.Value.ToString());
} else {
if (SeasonInput.Value.ToString() == dParts[2])
filterNames.Remove(SeasonInput.Value.ToString());
filterNames.Remove(SeasonInput.Value.ToString()!);
filterNames.Add(n);
}
} else if (parts.Length == 2) {
@ -917,17 +917,17 @@ namespace Elwig.Windows {
} else if (IsCreating || InputHasChanged(TimeInput)) {
d.TimeString = (TimeInput.Text != "") ? TimeInput.Text + ":00" : null;
}
d.ZwstId = (BranchInput.SelectedItem as Branch)?.ZwstId;
d.ZwstId = (BranchInput.SelectedItem as Branch)!.ZwstId;
d.LsNr = LsNrInput.Text;
d.MgNr = int.Parse(MgNrInput.Text);
d.Comment = (CommentInput.Text == "") ? null : CommentInput.Text;
p.SortId = (WineVarietyInput.SelectedItem as WineVar)?.SortId;
p.SortId = (WineVarietyInput.SelectedItem as WineVar)!.SortId;
p.AttrId = (AttributeInput.SelectedItem as WineAttr)?.AttrId;
p.CultId = (CultivationInput.SelectedItem as WineCult)?.CultId;
p.Kmw = double.Parse(GradationKmwInput.Text);
p.QualId = (WineQualityLevelInput.SelectedItem as WineQualLevel)?.QualId;
p.HkId = (WineOriginInput.SelectedItem as WineOrigin)?.HkId;
p.QualId = (WineQualityLevelInput.SelectedItem as WineQualLevel)!.QualId;
p.HkId = (WineOriginInput.SelectedItem as WineOrigin)!.HkId;
p.KgNr = (WineKgInput.SelectedItem as AT_Kg)?.KgNr;
p.RdNr = (WineRdInput.SelectedItem as WbRd)?.RdNr;