public MembershipOptionBoxReasonsView(MembershipOptionBox membershipOptionBox) { InitializeComponent(); _viewModel = new MembershipOptionBoxReasonsViewModel(membershipOptionBox); DataContext = _viewModel; _viewModel.PropertyChanged += ViewModelOnPropertyChanged; Loaded += OnViewLoaded; }
public MembershipOptionBoxReasonsViewModel(MembershipOptionBox membershipOptionBox) { MembershipOptionBox = membershipOptionBox; var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>(); _adminDataUnit = dataUnitLocator.ResolveDataUnit<IAdminDataUnit>(); AddNewMembershipOptionBoxReasonCommand = new RelayCommand(AddNewMembershipOptionBoxReasonCommandExecuted, AddNewMembershipOptionBoxReasonCommandCanExecute); DeleteMembershipOptionBoxReasonCommand = new RelayCommand<MembershipOptionBoxReason>(DeleteMembershipOptionBoxReasonCommandExecuted); EditMembershipOptionBoxReasonCommand = new RelayCommand<MembershipOptionBoxReason>(EditMembershipOptionBoxReasonCommandExecuted); }
/// <summary> /// Create a new MembershipOptionBox object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="name">Initial value of the Name property.</param> public static MembershipOptionBox CreateMembershipOptionBox(global::System.Guid id, global::System.String name) { MembershipOptionBox membershipOptionBox = new MembershipOptionBox(); membershipOptionBox.ID = id; membershipOptionBox.Name = name; return membershipOptionBox; }
/// <summary> /// Deprecated Method for adding a new object to the MembershipOptionBoxes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToMembershipOptionBoxes(MembershipOptionBox membershipOptionBox) { base.AddObject("MembershipOptionBoxes", membershipOptionBox); }
private void AddMembershipOptionBoxCommandExecuted() { string name = string.Empty; RaisePropertyChanged("DisableParentWindow"); RadWindow.Prompt(new DialogParameters() { Header = "Add Option Box", Closed = (sender, args) => { name = args.PromptResult; } }); RaisePropertyChanged("EnableParentWindow"); if (!string.IsNullOrWhiteSpace(name)) { var membershipOptionBox = new MembershipOptionBox() { ID = Guid.NewGuid(), Name = name }; _adminDataUnit.MembershipOptionBoxesRepository.Add(membershipOptionBox); _adminDataUnit.SaveChanges(); MembershipOptionBoxes.Add(membershipOptionBox); TreeViewItemPath = "Members|Option Boxes"; RaisePropertyChanged("SelectTreeViewItem"); SelectedTreeViewObject = membershipOptionBox; } }