protected void OnButtonChangeToEmployeeClicked(object sender, EventArgs e) { if (UoW.HasChanges || Entity.Id == 0) { if (!MessageDialogHelper.RunQuestionDialog("Для продолжения необходимо сохранить изменения, сохранить и продолжить?")) { return; } if (Save()) { OnEntitySaved(true); } else { return; } } var employeeUow = UnitOfWorkFactory.CreateWithNewRoot <Employee>(); Personnel.ChangeTraineeToEmployee(employeeUow, Entity); var cs = new ConfigurationSection(new ConfigurationRoot(new List <IConfigurationProvider> { new MemoryConfigurationProvider(new MemoryConfigurationSource()) }), ""); cs["BaseUri"] = "https://driverapi.vod.qsolution.ru:7090/api/"; var apiHelper = new ApiClientProvider.ApiClientProvider(cs); var driverApiRegisterEndpoint = new DriverApiUserRegisterEndpoint(apiHelper); var employeeViewModel = new EmployeeViewModel( _authorizationService, _employeeWageParametersFactory, _employeeJournalFactory, _subdivisionJournalFactory, _employeePostsJournalFactory, _cashDistributionCommonOrganisationProvider, _subdivisionService, _emailServiceSettingAdapter, _wageCalculationRepository, _employeeRepository, employeeUow, ServicesConfig.CommonServices, _validationContextFactory, _phonesViewModelFactory, _warehouseRepository, _routeListRepository, driverApiRegisterEndpoint, CurrentUserSettings.Settings, _userRepository, _baseParametersProvider, true); TabParent.OpenTab(DialogHelper.GenerateDialogHashName <Employee>(Entity.Id), () => employeeViewModel); OnCloseTab(false); }
protected void OnButtonChangeToEmployeeClicked(object sender, EventArgs e) { if (UoW.HasChanges || Entity.Id == 0) { if (!MessageDialogHelper.RunQuestionDialog("Для продолжения необходимо сохранить изменения, сохранить и продолжить?")) { return; } if (Save()) { OnEntitySaved(true); } else { return; } } var employeeUow = UnitOfWorkFactory.CreateWithNewRoot <Employee>(); Personnel.ChangeTraineeToEmployee(employeeUow, Entity); TabParent.OpenTab(DialogHelper.GenerateDialogHashName <Employee>(Entity.Id), () => new EmployeeDlg(employeeUow)); this.OnCloseTab(false); }
public void ChangeTraineeToEmployeeTestCase() { //Тестируемое действие Personnel.ChangeTraineeToEmployee(uowEmployeeMock, traineeMock); //Проверка результата string output = "Не верно перенесены следующие свойства: "; bool result = true; if (traineeMock.CreationDate != employeeMock.CreationDate) { result = false; output += nameof(traineeMock.CreationDate) + ", "; } if (traineeMock.Name != employeeMock.Name) { result = false; output += nameof(traineeMock.Name) + ", "; } if (traineeMock.LastName != employeeMock.LastName) { result = false; output += nameof(traineeMock.LastName) + ", "; } if (traineeMock.Patronymic != employeeMock.Patronymic) { result = false; output += nameof(traineeMock.Patronymic) + ", "; } if (traineeMock.DrivingLicense != employeeMock.DrivingLicense) { result = false; output += nameof(traineeMock.DrivingLicense) + ", "; } if (traineeMock.AddressRegistration != employeeMock.AddressRegistration) { result = false; output += nameof(traineeMock.AddressRegistration) + ", "; } if (traineeMock.AddressCurrent != employeeMock.AddressCurrent) { result = false; output += nameof(traineeMock.AddressCurrent) + ", "; } if (traineeMock.INN != employeeMock.INN) { result = false; output += nameof(traineeMock.INN) + ", "; } foreach (var item in traineeMock.Phones) { if (!employeeMock.Phones.Contains(item)) { result = false; output += nameof(traineeMock.Phones) + ", "; break; } } foreach (var item in traineeMock.Documents) { if (!employeeMock.Documents.Contains(item)) { result = false; output += nameof(traineeMock.Documents) + ", "; break; } } if (traineeMock.Citizenship != employeeMock.Citizenship) { result = false; output += nameof(traineeMock.Citizenship) + ", "; } if (traineeMock.Nationality != employeeMock.Nationality) { result = false; output += nameof(traineeMock.Nationality) + ", "; } if (traineeMock.Photo != employeeMock.Photo) { result = false; output += nameof(traineeMock.Photo); } Assert.IsTrue(result, output); }