示例#1
0
        void ObjectsItemEndEdit(IEditableObject sender)
        {
            RecursoPrecioViewModel UIObject = sender as RecursoPrecioViewModel;

            try
            {
                RecursoPrecioDataAccess.UpdateRecursoPrecio(UIObject.GetDataObject());
            }
            catch (Exception ex)
            {
                log.Error(ex.StackTrace);
            }
        }
示例#2
0
 void ObjectsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         try
         {
             foreach (object item in e.OldItems)
             {
                 RecursoPrecioViewModel UIObject = item as RecursoPrecioViewModel;
                 RecursoPrecioDataAccess.DeleteRecursoPrecio(UIObject.GetDataObject());
             }
         }
         catch (Exception ex)
         {
             log.Error(ex.StackTrace);
         }
     }
 }
示例#3
0
        public RecursoPrecioCollectionViewModel GetObjects()
        {
            RecursoPrecioCollectionViewModel UIObjects = new RecursoPrecioCollectionViewModel();

            //   List<RecursoPrecio> dataObjects = RecursoPrecioDataAccess.GetRecursoPrecio();
            List <RecursoPrecio> dataObjects = RecursoPrecioDataAccess.GetRecursoPrecio();

            foreach (RecursoPrecio dataObject in dataObjects)
            {
                UIObjects.Add(new RecursoPrecioViewModel(dataObject));
            }


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

            return(UIObjects);
        }