private void btnAdd_Click(object sender, RoutedEventArgs e) { try { SupplierView supAdditionOb = new SupplierView { FirstName = textBoxFirstName.Text.ToString(), LastName = textBoxLastName.Text.ToString(), Grs = textBoxGRS.Text.ToString(), Ids = textBoxIDS.Text.ToString(), Email = textBoxEmail.Text.ToString(), Tel1 = textBoxTelephone.Text.ToString(), Mob1 = textBoxMobile.Text.ToString(), LblPrintText = textBoxLabelText.Text.ToString() }; suppliers.Add(supAdditionOb); ((MainWindow)Application.Current.MainWindow).AddTextMsg("Supplier added succesful"); btnClear_Click(null, null); } catch (Exception ex) { ((MainWindow)Application.Current.MainWindow).AddExceptionTextMsg(ex.ToString()); } }
public PageSuppliers() { InitializeComponent(); supRepo = new SupplierRepository(); suppliers = new EcObservableCollection <SupplierView>(); foreach (Supplier c in supRepo.FindAll()) { suppliers.Add(new SupplierView(c)); } suppliers.CollectionChanged += new NotifyCollectionChangedEventHandler(suppliers_CollectionChanged); suppliers.ItemChanged += new EcObservableCollection <SupplierView> .EcObservableCollectionItemChangedEventHandler(suppliers_ItemChanged); dgSuppliers.ItemsSource = suppliers; dgSuppliers.ItemContainerGenerator.ItemsChanged += ItemContainerGenerator_ItemsChanged; }
private EcObservableCollection<TripViewModel> GetObservableTrips(string programCode = null) { var trips = this._tripService.GetPendingTrips(programCode); var observableTrips = new EcObservableCollection<TripViewModel>(); trips.ToList().ForEach(x => observableTrips.Add(x)); return observableTrips; }