public PropertyEditViewModel(IDataContext dc, object parameter) { this.dc = dc as HVCCDataContext; this.Host = HVCC.Shell.Host.Instance; // The invocation of this VM can come from PropertyDetails or OwnerEdit. The Detail view(s) // are bound to database views, whereas Edit view(s) are bound to the database table. Therefore, // we have to check the type of the 'parameter' being passed in. if (parameter is Property) { Property p = parameter as Property; SelectedProperty = GetProperty(p.PropertyID); } else { v_PropertyDetail p = parameter as v_PropertyDetail; SelectedProperty = GetProperty(p.PropertyID); } Owner = SelectedProperty.Owner; // The View is bound to this element ApplPermissions = this.Host.AppPermissions as ApplicationPermission; ApplDefault = this.Host.AppDefault as ApplicationDefault; CanSaveExecute = true; this.RegisterCommands(); NotesHeader = string.Format("HVCC Notes [{0}]", NoteCount); SelectedProperty.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.Property_PropertyChanged); }
public ChangeOwnerViewModel(IDataContext dc, object parameter) { this.dc = dc as HVCCDataContext; this.Host = HVCC.Shell.Host.Instance; // parameter is set by the invocation: PropertyEditViewModel or ChangeOwnerViewModel v_PropertyDetail p = parameter as v_PropertyDetail; if (null != p) { // Set the SelectedProperty, and make a clone copy of it for later reference. SelectedProperty = GetProperty(p.PropertyID); PreviousOwner.OwnerID = SelectedProperty.OwnerID; } else { } ApplPermissions = this.Host.AppPermissions as ApplicationPermission; ApplDefault = this.Host.AppDefault as ApplicationDefault; CanSaveExecute = false; this.RegisterCommands(); HeaderText = string.Format("Owner Information For Lot#: {0}", SelectedProperty.Customer); NewOwner.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.Property_PropertyChanged); }