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

            try
            {
                CortePeriodoDataAccess.UpdateCortePeriodo(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)
             {
                 CortePeriodoViewModel UIObject = item as CortePeriodoViewModel;
                 CortePeriodoDataAccess.DeleteCortePeriodo(UIObject.GetDataObject());
             }
         }
         catch (Exception ex)
         {
             log.Error(ex.StackTrace);
         }
     }
 }
示例#3
0
        public CortePeriodoCollectionViewModel GetObjects()
        {
            CortePeriodoCollectionViewModel UIObjects = new CortePeriodoCollectionViewModel();

            //   List<CortePeriodo> dataObjects = CortePeriodoDataAccess.GetCortePeriodo();
            List <CortePeriodo> dataObjects = CortePeriodoDataAccess.GetCortePeriodo();

            foreach (CortePeriodo dataObject in dataObjects)
            {
                UIObjects.Add(new CortePeriodoViewModel(dataObject));
            }


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

            return(UIObjects);
        }