コード例 #1
0
        public HydroPlantsDataGrid(EntitiesCollections entitiesCollections) : base(entitiesCollections)
        {
            InitializeComponent();

            HydroPlantsCollectionViewModel items = ItemsSource as HydroPlantsCollectionViewModel;

            if (items.Count == 1)
            {
                HydroPlantViewModel item = items[0] as HydroPlantViewModel;
                if (item.Name == null)
                {
                    CurrentColumn         = NameColumn;
                    NameColumn.IsReadOnly = false;
                    CaseColumn.IsReadOnly = false;
                }
            }
        }
コード例 #2
0
 void ObjectsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         try
         {
             foreach (object item in e.OldItems)
             {
                 HydroPlantViewModel UIObject = item as HydroPlantViewModel;
                 HydroPlantsDataAccess.DeleteObject(UIObject.GetDataObject());
             }
         }
         catch (Exception ex)
         {
             log.Error(ex.StackTrace);
         }
     }
 }
コード例 #3
0
        void ObjectsItemEndEdit(IEditableObject sender)
        {
            HydroPlantViewModel UIObject = sender as HydroPlantViewModel;

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