Skip to content

Commit

Permalink
Fixed #213 MultipleChoices newbugged
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Feb 23, 2024
1 parent 2537ba5 commit 6e94b38
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions BulkDataUpdater/AppCode/BDUUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,16 +287,16 @@ private object GetValueFromUI(AttributeMetadata meta)
{
return double.Parse(cmbValue.Text);
}
if (meta is EnumAttributeMetadata)
{
var value = ((OptionMetadataItem)cmbValue.SelectedItem).Metadata.Value;
return new OptionSetValue((int)value);
}
if (meta is MultiSelectPicklistAttributeMetadata)
{
var values = chkMultiSelects.CheckedItems.OfType<OptionMetadataItem>().Select(o => o.Metadata.Value);
return new OptionSetValueCollection(values.Select(v => new OptionSetValue((int)v)).ToList());
};
if (meta is EnumAttributeMetadata)
{
var value = ((OptionMetadataItem)cmbValue.SelectedItem).Metadata.Value;
return new OptionSetValue((int)value);
}
if (meta is DateTimeAttributeMetadata)
{
return DateTime.Parse(cmbValue.Text);
Expand Down
20 changes: 10 additions & 10 deletions BulkDataUpdater/BDU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -587,31 +587,31 @@ private void UpdateValueField()
var calc = rbCalculate.Checked;
if (rbSetValue.Checked && attribute != null)
{
if (attribute.Metadata is EnumAttributeMetadata enummeta)
if (attribute.Metadata is MultiSelectPicklistAttributeMetadata multimeta)
{
var options = enummeta.OptionSet;
chkMultiSelects.Items.Clear();
var options = multimeta.OptionSet;
if (options != null)
{
foreach (var option in options.Options)
{
cmbValue.Items.Add(new OptionMetadataItem(option, true));
chkMultiSelects.Items.Add(new OptionMetadataItem(option, true));
}
}
cmbValue.DropDownStyle = ComboBoxStyle.DropDownList;
value = false;
multisel = true;
}
else if (attribute.Metadata is MultiSelectPicklistAttributeMetadata multimeta)
else if (attribute.Metadata is EnumAttributeMetadata enummeta)
{
chkMultiSelects.Items.Clear();
var options = multimeta.OptionSet;
var options = enummeta.OptionSet;
if (options != null)
{
foreach (var option in options.Options)
{
chkMultiSelects.Items.Add(new OptionMetadataItem(option, true));
cmbValue.Items.Add(new OptionMetadataItem(option, true));
}
}
value = false;
multisel = true;
cmbValue.DropDownStyle = ComboBoxStyle.DropDownList;
}
else if (attribute.Metadata is BooleanAttributeMetadata boolmeta)
{
Expand Down

0 comments on commit 6e94b38

Please sign in to comment.