public static bool Open(BookPlacement dataObject)
        {
            if (dataObject == null)
            {
                throw new ArgumentNullException("dataObject");
            }

            var dialog = new BookPlacementEditorWindow()
            {
                DataContext           = dataObject,
                Owner                 = Registry.Get <MainWindow>(),
                WindowStartupLocation = WindowStartupLocation.CenterOwner,
                Title                 = (dataObject.Id <= 0)
                    ? "Book Manager - New Book Placement"
                    : String.Format("Book Manager - Book Placement Edit {0}", dataObject.Id)
            };

            dialog.ShowDialog();

            return(dialog.DialogResult.GetValueOrDefault());
        }
예제 #2
0
        public static BookPlacement EditBookPlacement(Window owner, GlobalDataObject gdo, object source, bool isNew = false, bool updateColection = true)
        {
            var entity = GetEntityForEditation <BookPlacement>(owner, source, gdo.GetBookPlacement, isNew);

            if (entity == null)
            {
                return(null);
            }

            if (BookPlacementEditorWindow.Open(entity))
            {
                gdo.SaveBookPlacement(entity);

                if (updateColection)
                {
                    UpdateBookPlacementCollection(owner, gdo);
                }
            }

            return(entity);
        }