private void FrmAddEditAccount_Load(object sender, EventArgs e) { reciever = new ExpencesReciever(); // Fill Combo box Helpers.DataHelper helper = new Helpers.DataHelper(); _accountTypes = _accountTypes.GroupBy(x => x.Option_Name).Select(x => x.FirstOrDefault()); var dataList = _accountTypes.Select(x => new DropDown() { Name = x.Option_Type, Value = x.Option_Name.ToString() }).ToList(); dataList.Insert(0, new DropDown() { Name = "-- Select --", Value = (0).ToString() }); helper.FillCombo(cmbMainAccount, dataList); if (_model != null) { cmbMainAccount.SelectedIndex = dataList.Select((obj, index) => new { obj, index }).Where(x => x.obj.Value == _model.Option_Name.ToString()).Select(x => x.index).FirstOrDefault(); txtAccountType.Text = _model.Expences_Name; toggleActive.Checked = _model.IsActive; } else { _model = new ExpencesModel(); } }
public FrmAccountDetail() { reciever = new ExpencesReciever(); helper = new DataHelper(); InitializeComponent(); Configuration(); RefreshList(); }