public MecanismosViewModel() { Mecanismos = new Mecanismos(); Maquina = new Maquina(); FAMA.AP.DataLayer.DbMecanismos au = new FAMA.AP.DataLayer.DbMecanismos(); FAMA.AP.DataLayer.DbMaquina aum = new FAMA.AP.DataLayer.DbMaquina(); List <FAMA.AP.Model.Mecanismos> MecanismosLst = au.Selectalldata(); List <FAMA.AP.Model.Maquina> MaquinaLst = aum.Selectalldata(); Mecanismoss = new ObservableCollection <Mecanismos>(); foreach (var item in MecanismosLst) { Mecanismoss.Add(item); } Mecanismoss.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Mecanismos_CollectionChanged); MaquinaList = new ObservableCollection <Maquina>(); foreach (var item in MaquinaLst) { MaquinaList.Add(item); } //MaquinaList.Add(new Maquina() { MaquinaList.idMachineType, MaquinaList.vcName }); //MaquinaList.Add(new Maquina() { idMachineType = 2, vcName = "There" }); MaquinaList.Insert(0, SelectedcbDefaultLocationListItem); SelectedMaquinaID = SelectedcbDefaultLocationListItem.idMachineType; }
private void Add() { FAMA.AP.DataLayer.DbMecanismos au = new FAMA.AP.DataLayer.DbMecanismos(); au.InsertData(Mecanismos); List <FAMA.AP.Model.Mecanismos> MecanismosLst = au.Selectalldata(); Mecanismoss = new ObservableCollection <Mecanismos>(); foreach (var item in MecanismosLst) { Mecanismoss.Add(item); } }