/// <summary> /// Creates an instance of the object. /// </summary> public YYTDataProvider() { _commandManager = new YYTDataProviderCommandManager(this); _factoryParameters = new ObservableCollection <object>(); _factoryParameters.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(_factoryParameters_CollectionChanged); }
private static void CanExecuteUndo(object target, CanExecuteRoutedEventArgs e) { bool result = false; YYTDataProviderCommandManager ctl = target as YYTDataProviderCommandManager; if (ctl != null && ctl.Provider != null) { if (ctl.Provider.Data != null) { YYT.Core.IEditableBusinessObject ibiz = ctl.Provider.Data as YYT.Core.IEditableBusinessObject; if (ibiz != null) { result = ibiz.IsDirty; } else { YYT.Core.IEditableCollection icol = ctl.Provider.Data as YYT.Core.IEditableCollection; if (icol != null) { result = icol.IsDirty; } } } } e.CanExecute = result; }
private static void CanExecuteRemove(object target, CanExecuteRoutedEventArgs e) { bool result = false; YYTDataProviderCommandManager ctl = target as YYTDataProviderCommandManager; if (ctl != null && ctl.Provider != null) { if (ctl.Provider.Data != null) { YYT.Core.BusinessBase bb = e.Parameter as YYT.Core.BusinessBase; IBindingList list; if (bb != null) { list = bb.Parent as IBindingList; } else { list = ctl.Provider.Data as IBindingList; } if (list != null) { result = list.AllowRemove; if (result && !YYT.Security.AuthorizationRules.CanEditObject(ctl.Provider.Data.GetType())) { result = false; } } } } e.CanExecute = result; }
private static void SaveCommand(object target, ExecutedRoutedEventArgs e) { YYTDataProviderCommandManager ctl = target as YYTDataProviderCommandManager; if (ctl != null && ctl.Provider != null) { ctl.Provider.Save(); } }
private static void RemoveCommand(object target, ExecutedRoutedEventArgs e) { YYTDataProviderCommandManager ctl = target as YYTDataProviderCommandManager; if (ctl != null && ctl.Provider != null) { ctl.Provider.RemoveItem(e.Parameter); } }
private static void CanExecuteNew(object target, CanExecuteRoutedEventArgs e) { bool result = false; YYTDataProviderCommandManager ctl = target as YYTDataProviderCommandManager; if (ctl != null && ctl.Provider != null) { if (ctl.Provider.Data != null) { IBindingList list = ctl.Provider.Data as IBindingList; if (list != null) { result = list.AllowNew; if (result && !YYT.Security.AuthorizationRules.CanEditObject(ctl.Provider.Data.GetType())) { result = false; } } } } e.CanExecute = result; }