работает форма добавления и редактирования полностью, пофиксила компонент выбора из списка
This commit is contained in:
parent
9c3a569942
commit
394ecca149
@ -19,9 +19,7 @@ namespace AppShopInternetOption19
|
||||
_orderStatusLogic = orderStatusLogic;
|
||||
InitializeComponent();
|
||||
|
||||
List<string> statuses = new List<string>() { "готов", "не готов" };
|
||||
|
||||
selectComponentOrderStatus.FillList(statuses);
|
||||
selectComponentOrderStatus.FillList(_orderStatusLogic.ReadList(null), "Name");
|
||||
|
||||
textBoxFIO.TextChanged += valueChanged;
|
||||
textBoxGoodDescription.TextChanged += valueChanged;
|
||||
@ -119,8 +117,7 @@ namespace AppShopInternetOption19
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,11 +13,18 @@
|
||||
//comboBox.SelectedIndexChanged += comboBox_SelectedIndexChanged;
|
||||
}
|
||||
|
||||
public void FillList(List<string> list)
|
||||
public void FillList<Y>(List<Y> list, string property) where Y : class
|
||||
{
|
||||
foreach (string item in list)
|
||||
ClearList();
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
comboBox.Items.Add(item);
|
||||
var propName = item.GetType().GetProperty(property);
|
||||
if(propName != null)
|
||||
{
|
||||
var value = propName.GetValue(item)?.ToString();
|
||||
comboBox.Items.Add(value);
|
||||
}
|
||||
}
|
||||
//comboBox.SelectedIndex = rand.Next(list.Count);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user