Exemple #1
0
        void ObjectsItemEndEdit(IEditableObject sender)
        {
            PeriodicBarraViewModel UIObject = sender as PeriodicBarraViewModel;

            try
            {
                PeriodicBarraDataAccess.UpdatePeriodicBarra(UIObject.GetDataObject());
            }
            catch (Exception ex)
            {
                log.Error(ex.StackTrace);
            }
        }
Exemple #2
0
 void ObjectsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         try
         {
             foreach (object item in e.OldItems)
             {
                 PeriodicBarraViewModel UIObject = item as PeriodicBarraViewModel;
                 PeriodicBarraDataAccess.DeletePeriodicBarra(UIObject.GetDataObject());
             }
         }
         catch (Exception ex)
         {
             log.Error(ex.StackTrace);
         }
     }
 }
Exemple #3
0
        public PeriodicBarraCollectionViewModel GetObjects()
        {
            PeriodicBarraCollectionViewModel UIObjects = new PeriodicBarraCollectionViewModel();

            //   List<PeriodicBarra> dataObjects = PeriodicBarraDataAccess.GetPeriodicBarra();
            List <PeriodicBarra> dataObjects = PeriodicBarraDataAccess.GetPeriodicBarra();

            foreach (PeriodicBarra dataObject in dataObjects)
            {
                UIObjects.Add(new PeriodicBarraViewModel(dataObject));
            }


            UIObjects.ItemEndEdit       += new ItemEndEditEventHandler(ObjectsItemEndEdit);
            UIObjects.CollectionChanged += new NotifyCollectionChangedEventHandler(ObjectsCollectionChanged);

            return(UIObjects);
        }