Exemplo n.º 1
0
        public HydroElementsDataGrid(EntitiesCollections entitiesCollections) : base(entitiesCollections)
        {
            InitializeComponent();

            HydroElementsCollectionViewModel items = ItemsSource as HydroElementsCollectionViewModel;

            if (items.Count == 1)
            {
                HydroElementViewModel item = items[0] as HydroElementViewModel;
                if (item.Name == null)
                {
                    CurrentColumn         = NameColumn;
                    NameColumn.IsReadOnly = false;
                }
            }
        }
Exemplo n.º 2
0
 void ObjectsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         try
         {
             foreach (object item in e.OldItems)
             {
                 HydroElementViewModel UIObject = item as HydroElementViewModel;
                 HydroElementsDataAccess.DeleteObject(UIObject.GetDataObject());
             }
         }
         catch (Exception ex)
         {
             log.Error(ex.StackTrace);
         }
     }
 }
Exemplo n.º 3
0
        void ObjectsItemEndEdit(IEditableObject sender)
        {
            HydroElementViewModel UIObject = sender as HydroElementViewModel;

            try
            {
                if (UIObject.Name != null)
                {
                    int id = HydroElementsDataAccess.UpdateObject(UIObject.GetDataObject());
                    if (id != -1)
                    {
                        UIObject.Id = id;
                    }
                }
            }
            catch
            {
                UIObjects.Remove(UIObject);
                RadWindow.Alert(new DialogParameters
                {
                    Content = MessageUtil.FormatMessage("ERROR.DuplicatedEntryName", UIObject.Name)
                });
            }
        }