コード例 #1
0
 void ObjectsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         try
         {
             foreach (object item in e.OldItems)
             {
                 NonConventionalPlantBlockViewModel UIObject = item as NonConventionalPlantBlockViewModel;
                 NonConventionalPlantBlocksDataAccess.DeleteObject(UIObject.GetDataObject());
             }
         }
         catch (Exception ex)
         {
             log.Error(ex.StackTrace);
         }
     }
 }
コード例 #2
0
        public NonConventionalPlantBlocksDataGrid(EntitiesCollections entitiesCollections) : base(entitiesCollections)
        {
            InitializeComponent();

            NonConventionalPlantBlocksCollectionViewModel items = ItemsSource as NonConventionalPlantBlocksCollectionViewModel;

            if (items.Count == 1)
            {
                NonConventionalPlantBlockViewModel item = items[0] as NonConventionalPlantBlockViewModel;
                if (item.Name == null)
                {
                    CurrentColumn              = NameColumn;
                    NameColumn.IsReadOnly      = false;
                    BlockColumn.IsReadOnly     = false;
                    ReductionFactor.IsReadOnly = false;
                    Case.IsReadOnly            = false;
                    Id.IsReadOnly              = false;
                }
            }
        }
コード例 #3
0
        void ObjectsItemEndEdit(IEditableObject sender)
        {
            NonConventionalPlantBlockViewModel UIObject = sender as NonConventionalPlantBlockViewModel;

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