/// <summary> /// Add/Edit patient dialog. /// </summary> /// <param name="mode">The mode (Add/Edit).</param> protected override void AddEditDialog(WorkModeType mode) { try { switch (mode) { case WorkModeType.Add: this.AddItem(mode); break; case WorkModeType.Edit: this.EditItem(mode); break; default: throw new InvalidOperationException("Unexpected mode type."); } this.SearchPatient(); } catch (Exception ex) { Log.Exception(ex); } }
/// <summary> /// Add/Edit education dialog. /// </summary> /// <param name="mode">The mode (Add/Edit).</param> protected override void AddEditDialog(WorkModeType mode) { try { EducationDialogViewModel dialogViewModel; switch (mode) { case WorkModeType.Add: this.AddItem(out dialogViewModel, mode); break; case WorkModeType.Edit: this.EditItem(out dialogViewModel, mode); break; default: throw new InvalidOperationException("Unexpected mode type."); } if (this.IsDataAddedOrUpdated(dialogViewModel)) { this.educationCache.Clear(); } } catch (Exception ex) { Log.Exception(ex); } }
/// <summary> /// Initializes a new instance of the <see cref="NotificationTemplateDialogViewModel"/> class. /// </summary> /// <param name="unitOfWork">Unit of work.</param> /// <param name="messageBoxProvider">Message box provider.</param> /// <param name="mode">The mode.</param> /// <param name="model">Notification template model.</param> public NotificationTemplateDialogViewModel( IUnitOfWork unitOfWork, IMessageBoxProvider messageBoxProvider, WorkModeType mode, NotificationTemplateModel model = null) : base(mode) { this.unitOfWork = unitOfWork; this.messageBoxProvider = messageBoxProvider; Task.Factory.StartNewWithDefaultCulture(() => this.Load(model)); }
private void AddItem(WorkModeType mode) { var dialogViewModel = this.viewModelBuilder.Build <PatientDialogViewModel>( new ResolverParameter(ParameterName.Mode, mode)); this.viewBuilder.Build <PatientDialogView, IPatientDialogViewModel>(dialogViewModel).ShowDialog(); if (dialogViewModel.Status == LoadingStatus.Added) { this.Model.Insert(0, dialogViewModel.Model); } }
private void AddItem(out PositionDialogViewModel dialogViewModel, WorkModeType mode) { dialogViewModel = this.viewModelBuilder.Build <PositionDialogViewModel>(new ResolverParameter(ParameterName.Mode, mode)); this.viewBuilder.Build <PositionDialogView, IPositionDialogViewModel>(dialogViewModel).ShowDialog(); if (dialogViewModel.Status == LoadingStatus.Added) { this.Model.Insert(0, dialogViewModel.Model); } this.OnPropertyChanged(() => this.Count); }
private void AddItem(WorkModeType mode) { var dialogViewModel = this.viewModelBuilder.Build <StaffDialogViewModel>( new ResolverParameter(ParameterName.Mode, mode)); this.viewBuilder.Build <StaffDialogView, IStaffDialogViewModel>(dialogViewModel).ShowDialog(); if (dialogViewModel.Status == LoadingStatus.Added) { this.Model.Insert(0, dialogViewModel.Model); this.eventAggregator.Publish <StaffAddedEvent>(); } }
private void EditItem(out EducationDialogViewModel dialogViewModel, WorkModeType mode) { dialogViewModel = this.viewModelBuilder.Build <EducationDialogViewModel>( new ResolverParameter(ParameterName.Mode, mode), new ResolverParameter(ParameterName.Model, this.SelectedItem)); this.viewBuilder.Build <EducationDialogView, IEducationDialogViewModel>(dialogViewModel).ShowDialog(); if (dialogViewModel.Status == LoadingStatus.Updated) { dialogViewModel.Model.Map(this.SelectedItem); } }
private void EditItem(WorkModeType mode) { var dialogViewModel = this.viewModelBuilder.Build <PatientDialogViewModel>( new ResolverParameter(ParameterName.Mode, mode), new ResolverParameter(ParameterName.Model, this.SelectedItem)); this.viewBuilder.Build <PatientDialogView, IPatientDialogViewModel>(dialogViewModel).ShowDialog(); if (dialogViewModel.Status == LoadingStatus.Updated) { dialogViewModel.Model.Map(this.SelectedItem); this.eventAggregator.Publish <PatientChangedEvent>(); } }
private void AddItem(WorkModeType mode) { var dialogViewModel = this.viewModelBuilder.Build <NotificationTemplateDialogViewModel>( new ResolverParameter(ParameterName.Mode, mode)); this.viewBuilder.Build <NotificationTemplateDialogView, INotificationTemplateDialogViewModel>(dialogViewModel).ShowDialog(); if (dialogViewModel.Status == LoadingStatus.Added) { this.Model.Insert(0, dialogViewModel.Model); } this.OnPropertyChanged(() => this.Count); }
/// <summary> /// Initializes a new instance of the <see cref="LoginDialogViewModel"/> class. /// </summary> /// <param name="unitOfWork">Unit of work.</param> /// <param name="resourceHandler">Resource handler.</param> /// <param name="messageBoxProvider">Message box provider.</param> /// <param name="roleCache">Role cache.</param> /// <param name="mode">Mode (Add/Edit).</param> /// <param name="model">Login model.</param> public LoginDialogViewModel( IUnitOfWork unitOfWork, IResourceHandler resourceHandler, IMessageBoxProvider messageBoxProvider, IRoleCache roleCache, WorkModeType mode, LoginModel model = null) : base(mode) { this.unitOfWork = unitOfWork; this.resourceHandler = resourceHandler; this.messageBoxProvider = messageBoxProvider; this.roleCache = roleCache; Task.Factory.StartNewWithDefaultCulture(() => this.Load(model)); }
private void AddItem(WorkModeType mode) { var dialogViewModel = this.viewModelBuilder.Build <NotificationGroupDialogViewModel>( new ResolverParameter(ParameterName.Mode, mode)); this.viewBuilder.Build <NotificationGroupDialogView, NotificationGroupDialogViewModel>(dialogViewModel).ShowDialog(); if (dialogViewModel.Status == LoadingStatus.Added || dialogViewModel.Status == LoadingStatus.Updated) { // Workaround. Status name is localized via database. var group = this.unitOfWork.NotificationGroupRepository.GetById(dialogViewModel.Model.Id); dialogViewModel.Model.StatusName = group.StatusName; this.Model.Insert(0, dialogViewModel.Model); } this.OnPropertyChanged(() => this.Count); }
/// <summary> /// Initializes a new instance of the <see cref="StaffDialogViewModel"/> class. /// </summary> /// <param name="unitOfWork">Unit of work.</param> /// <param name="messageBoxProvider">Message box provider.</param> /// <param name="genderCache">Gender cache.</param> /// <param name="positionCache">Position cache.</param> /// <param name="educationCache">Education cache.</param> /// <param name="mode">Mode (Add/Edit).</param> /// <param name="model">Staff model.</param> public StaffDialogViewModel( IUnitOfWork unitOfWork, IMessageBoxProvider messageBoxProvider, IGenderCache genderCache, IPositionCache positionCache, IEducationCache educationCache, WorkModeType mode, StaffModel model = null) : base(mode) { this.unitOfWork = unitOfWork; this.messageBoxProvider = messageBoxProvider; this.genderCache = genderCache; this.positionCache = positionCache; this.educationCache = educationCache; Task.Factory.StartNewWithDefaultCulture(() => this.Load(model)); }
/// <summary> /// Initializes a new instance of the <see cref="PatientDialogViewModel"/> class. /// </summary> /// <param name="unitOfWork">Unit of work.</param> /// <param name="viewModelBuilder">View model builder.</param> /// <param name="viewBuilder">View builder.</param> /// <param name="messageBoxProvider">Message box provider.</param> /// <param name="applicationSettings">Application settings.</param> /// <param name="genderCache">Gender cache.</param> /// <param name="mode">Mode (Add/Edit).</param> /// <param name="model">Patient model.</param> public PatientDialogViewModel( IUnitOfWork unitOfWork, IViewModelBuilder viewModelBuilder, IViewBuilder viewBuilder, IMessageBoxProvider messageBoxProvider, IApplicationSettings applicationSettings, IGenderCache genderCache, WorkModeType mode, PatientModel model = null) : base(mode) { this.unitOfWork = unitOfWork; this.viewModelBuilder = viewModelBuilder; this.viewBuilder = viewBuilder; this.messageBoxProvider = messageBoxProvider; this.applicationSettings = applicationSettings; this.genderCache = genderCache; Task.Factory.StartNewWithDefaultCulture(() => this.Load(model)); }
/// <summary> /// Initializes a new instance of the <see cref="NotificationGroupDialogViewModel"/> class. /// </summary> /// <param name="unitOfWork">Unit of work.</param> /// <param name="viewModelBuilder">View model builder.</param> /// <param name="viewBuilder">View builder.</param> /// <param name="resourceHandler">Resource handler.</param> /// <param name="messageBoxProvider">Message box provider.</param> /// <param name="emailDeliveryService">Email delivery service.</param> /// <param name="mode">Mode (Add/Edit).</param> /// <param name="model">Notification group model.</param> public NotificationGroupDialogViewModel( IUnitOfWork unitOfWork, IViewModelBuilder viewModelBuilder, IViewBuilder viewBuilder, IResourceHandler resourceHandler, IMessageBoxProvider messageBoxProvider, IEmailDeliveryService emailDeliveryService, WorkModeType mode, NotificationGroupModel model) : base(mode) { this.unitOfWork = unitOfWork; this.viewModelBuilder = viewModelBuilder; this.viewBuilder = viewBuilder; this.resourceHandler = resourceHandler; this.messageBoxProvider = messageBoxProvider; this.emailDeliveryService = emailDeliveryService; Task.Factory.StartNewWithDefaultCulture(() => this.Load(model)); }
/// <summary> /// Initializes a new instance of the <see cref="ViewModelDialogBase2{T}"/> class. /// </summary> /// <param name="mode">The mode.</param> protected ViewModelDialogBase2(WorkModeType mode) { this.Mode = mode; }
/// <summary> /// Add/Edit dialog. /// </summary> /// <param name="mode">The mode (Add/Edit).</param> protected abstract void AddEditDialog(WorkModeType mode);
/// <summary> /// Add/Edit patient dialog. /// </summary> /// <param name="mode">The mode (Add/Edit).</param> protected override void AddEditDialog(WorkModeType mode) { }