예제 #1
0
        private void DoEditCmd(object parameter)
        {
            if (parameter != null)
            {
                Cottager cottager = (Cottager)parameter;
                Garden   garden   = cottager.Garden;


                EditCottagerView      editView      = new EditCottagerView();
                EditCottagerViewModel editViewModel = new EditCottagerViewModel(cottager, editView);
                editView.DataContext = editViewModel;

                editView.ShowDialog();

                if (editView.DialogResult.HasValue && editView.DialogResult.Value)
                {
                    _PumpStationBL.EditCottager(cottager);

                    _UnitOfWork.Commit();

                    SelectedCottager = cottager;
                    RefreshList(_selectedMonthId);
                }
                else
                {
                    _UnitOfWork.GardenDAO.UndoChange(garden);
                    _UnitOfWork.CottagerDAO.UndoChange(cottager);
                    SelectedCottager = cottager;
                    RefreshList(_selectedMonthId);
                }
            }
        }
예제 #2
0
        private void DoAddCmd()
        {
            Cottager cottager  = new Cottager();
            Garden   newGarden = new Garden();

            cottager.Garden = newGarden;

            EditCottagerView      editView      = new EditCottagerView();
            EditCottagerViewModel editViewModel = new EditCottagerViewModel(cottager, editView);

            editView.DataContext = editViewModel;

            editView.ShowDialog();

            if (editView.DialogResult.HasValue && editView.DialogResult.Value)
            {
                cottager.MonthId = _selectedMonthId;
                _PumpStationBL.CreateCottager(cottager, newGarden);
                _UnitOfWork.Commit();

                RefreshList(_selectedMonthId);
            }
        }
예제 #3
0
 public EditCottagerViewModel(Cottager Cottager, EditCottagerView frame)
 {
     _Cottager       = Cottager;
     _instanceWindow = frame;
 }