public ClientEdit(Client client, bool isNew = false) { Client = client; InitializeComponent(); DataContext = this; ReadOnly = App.Rights(Table.CLIENT) != Right.ALL; IsNew = isNew; reservations = Reservations.Content as ReservationsView; reservations.Client = Client; SaveCommand = new RelayCommand(SaveAction, CanSaveOrCancelAction); CancelCommand = new RelayCommand(CancelAction, CanSaveOrCancelAction); DeleteCommand = new RelayCommand(DeleteAction, CanDeleteAction); }
public ShowEdit(Show show, bool isNew = false) { Show = show; InitializeComponent(); DataContext = this; ShowReadOnly = App.Rights(Table.SHOW) != Right.ALL; PriceReadOnly = App.Rights(Table.PRICE) != Right.ALL; IsNew = isNew; if (isNew) { Show.Date = DateTime.Today; } reservations = Reservations.Content as ReservationsView; reservations.Show = Show; HasReservationsTxt = null; Category = null; SaveCommand = new RelayCommand(SaveAction, CanSaveOrCancelAction); CancelCommand = new RelayCommand(CancelAction, CanSaveOrCancelAction); DeleteCommand = new RelayCommand(DeleteAction, CanDeleteAction); DeletePriceCommand = new RelayCommand(DeletePriceAction); LoadImage = new RelayCommand(LoadImageAction); ClearImage = new RelayCommand(ClearImageAction); App.Messenger.Register(App.MSG_REFRESH, () => { if (CanSaveOrCancelAction()) { CancelAction(); } }); }