[#34] First step of not using Bio as Attribute
This commit is contained in:
@ -292,7 +292,7 @@ namespace Elwig.Windows {
|
||||
if (ctrl == MgNrInput || ctrl == MemberInput) {
|
||||
SortIdInput.Focus();
|
||||
SortIdInput.SelectAll();
|
||||
} else if (ctrl == SortIdInput || ctrl == WineVarietyInput || ctrl == AttributeInput) {
|
||||
} else if (ctrl == SortIdInput || ctrl == WineVarietyInput || ctrl == AttributeInput || ctrl == CultivationInput) {
|
||||
GradationOeInput.Focus();
|
||||
GradationOeInput.TextBox.SelectAll();
|
||||
} else if (ctrl == GradationKmwInput || ctrl == GradationOeInput || ctrl == WineQualityLevelInput) {
|
||||
@ -762,6 +762,9 @@ namespace Elwig.Windows {
|
||||
var attrList = await Context.WineAttributes.Where(a => !IsCreating || a.IsActive).OrderBy(a => a.Name).Cast<object>().ToListAsync();
|
||||
attrList.Insert(0, new NullItem(""));
|
||||
ControlUtils.RenewItemsSource(AttributeInput, attrList, i => (i as WineAttr)?.AttrId, null, ControlUtils.RenewSourceDefault.First);
|
||||
var cultList = await Context.WineCultivations.OrderBy(a => a.Name).Cast<object>().ToListAsync();
|
||||
cultList.Insert(0, new NullItem(""));
|
||||
ControlUtils.RenewItemsSource(CultivationInput, cultList, i => (i as WineCult)?.CultId, null, ControlUtils.RenewSourceDefault.First);
|
||||
ControlUtils.RenewItemsSource(WineQualityLevelInput, await Context.WineQualityLevels.ToListAsync(), i => (i as WineQualLevel)?.QualId);
|
||||
ControlUtils.RenewItemsSource(ModifiersInput, await Context.Modifiers.Where(m => m.Year == y).OrderBy(m => m.Ordering).ToListAsync(), i => (i as Modifier)?.ModId);
|
||||
ControlUtils.RenewItemsSource(WineOriginInput, (await Context.WineOrigins.ToListAsync()).OrderByDescending(o => o.SortKey).ThenBy(o => o.HkId), i => (i as WineOrigin)?.HkId);
|
||||
@ -836,14 +839,15 @@ namespace Elwig.Windows {
|
||||
|
||||
SortIdInput.Text = p?.SortId ?? "";
|
||||
ControlUtils.SelectComboBoxItem(AttributeInput, p?.Attribute, i => (i as WineAttr)?.AttrId);
|
||||
ControlUtils.SelectComboBoxItem(CultivationInput, p?.Cultivation, i => (i as WineCult)?.CultId);
|
||||
GradationKmwInput.Text = (p != null) ? $"{p.Kmw:N1}" : "";
|
||||
ControlUtils.SelectComboBoxItem(WineQualityLevelInput, q => (q as WineQualLevel)?.QualId, p?.QualId);
|
||||
ControlUtils.SelectComboBoxItem(WineKgInput, k => (k as AT_Kg)?.KgNr, p?.KgNr);
|
||||
ControlUtils.SelectComboBoxItem(WineRdInput, r => (r as WbRd)?.RdNr, p?.RdNr);
|
||||
ControlUtils.SelectComboBoxItem(WineOriginInput, r => (r as WineOrigin)?.HkId, p?.HkId);
|
||||
WeightInput.Text = (p != null) ? $"{p.Weight:N0}" : "";
|
||||
ManualWeighingInput.IsChecked = p?.ManualWeighing ?? false;
|
||||
GerebeltGewogenInput.IsChecked = p?.IsGerebelt ?? false;
|
||||
ManualWeighingInput.IsChecked = p?.IsManualWeighing ?? false;
|
||||
GerebeltGewogenInput.IsChecked = p?.IsNetWeight ?? false;
|
||||
ControlUtils.SelectCheckComboBoxItems(ModifiersInput, p?.Modifiers, i => (i as Modifier)?.ModId);
|
||||
PartCommentInput.Text = p?.Comment ?? "";
|
||||
TemperatureInput.Text = (p != null && p.Temperature != null) ? $"{p.Temperature:N1}" : "";
|
||||
@ -900,13 +904,14 @@ namespace Elwig.Windows {
|
||||
|
||||
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.KgNr = (WineKgInput.SelectedItem as AT_Kg)?.KgNr;
|
||||
p.RdNr = (WineRdInput.SelectedItem as WbRd)?.RdNr;
|
||||
|
||||
p.IsGerebelt = GerebeltGewogenInput.IsChecked ?? false;
|
||||
p.IsNetWeight = GerebeltGewogenInput.IsChecked ?? false;
|
||||
p.IsHandPicked = HandPickedInput.IsChecked;
|
||||
p.IsLesewagen = LesewagenInput.IsChecked;
|
||||
p.IsGebunden = GebundenInput.IsChecked;
|
||||
@ -915,7 +920,7 @@ namespace Elwig.Windows {
|
||||
p.Comment = (PartCommentInput.Text == "") ? null : PartCommentInput.Text;
|
||||
|
||||
p.Weight = int.Parse(WeightInput.Text.Replace(Utils.GroupSeparator, ""));
|
||||
p.ManualWeighing = ManualWeighingInput.IsChecked ?? false;
|
||||
p.IsManualWeighing = ManualWeighingInput.IsChecked ?? false;
|
||||
p.ScaleId = ScaleId;
|
||||
p.WeighingId = WeighingId;
|
||||
p.WeighingReason = ManualWeighingReason;
|
||||
@ -1563,11 +1568,13 @@ namespace Elwig.Windows {
|
||||
WineVarietyInput.SelectedItem = Context.WineVarieties.Find(text[0..2]);
|
||||
if (text.Length >= 3) {
|
||||
ControlUtils.SelectComboBoxItem(AttributeInput, Context.WineAttributes.Find(text[2..]), a => (a as WineAttr)?.AttrId);
|
||||
ControlUtils.SelectComboBoxItem(CultivationInput, Context.WineCultivations.Find(text[2..]), i => (i as WineCult)?.CultId);
|
||||
SortIdInput.Text = text[0..2];
|
||||
}
|
||||
} else {
|
||||
WineVarietyInput.SelectedItem = null;
|
||||
AttributeInput.SelectedIndex = 0;
|
||||
CultivationInput.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1648,6 +1655,10 @@ namespace Elwig.Windows {
|
||||
|
||||
}
|
||||
|
||||
private void CultivationInput_SelectionChanged(object sender, SelectionChangedEventArgs evt) {
|
||||
|
||||
}
|
||||
|
||||
private void ModifiersInput_SelectionChanged(object sender, ItemSelectionChangedEventArgs evt) {
|
||||
if (!IsEditing && !IsCreating) return;
|
||||
var mod = ModifiersInput.SelectedItems.Cast<Modifier>();
|
||||
|
Reference in New Issue
Block a user