public authorityItem GetAuthByEmail(string email) { ac = new AuthorityController(); authorityItem result = ac.GetAuthByEmail(email); return(result); }
public authorityItem GetAuthById(string id) { ac = new AuthorityController(); authorityItem result = ac.GetAuthById(id); return(result); }
public void CannotSearchAfterLogout() { (s.RootQueryBlock.AutocompleteAll as AutocompleteViewModel).AddTag(w[6]); AuthorityController.LogOut(); Assert.IsFalse(s.SearchCommand.CanExecute(null)); }
public MenuBarViewModel(ScreenSwitcher switcher) { this.switcher = switcher; AuthorityController.LoggedIn += (s, e) => { CurrentUser = AuthorityController.CurrentUser; OpenSyncCommand.IsVisible = AuthorityController.CurrentUserCanOpen(Screen.Sync); OpenDoctorsCommand.IsVisible = AuthorityController.CurrentUserCanOpen(Screen.Doctors); OpenPatientsCommand.IsVisible = AuthorityController.CurrentUserCanOpen(Screen.Patients); OpenWordsCommand.IsVisible = AuthorityController.CurrentUserCanOpen(Screen.Words); OpenVocsCommand.IsVisible = AuthorityController.CurrentUserCanOpen(Screen.Vocabularies); OpenCriteriaCommand.IsVisible = AuthorityController.CurrentUserCanOpen(Screen.Criteria); #if DEBUG OpenSyncCommand.IsVisible = true; OpenVocsCommand.IsVisible = true; #endif }; AuthorityController.LoggedOut += (s, e) => { CurrentUser = AuthorityController.CurrentUser; }; switcher.PropertyChanged += (s, e) => { if (e.PropertyName == "CurrentView") { Visible = switcher.WithMenuBar; } }; }
protected override void OnOk() { AuthorityController.ChangePassword(admin, Passwords.Password); Session.DoSave(admin.Passport); this.Send(Event.EntitySaved, admin.AsParams(MessageKeys.Entity)); }
public override string this[string columnName] { get { if (!passWasSet) { return(string.Empty); } if (IsWrongPassword && columnName == "Password") { return("Неверный пароль"); } if (IsRepeatVisible && columnName == "Password" && !AuthorityController.IsStrong(Password)) { return("Пароль слабый."); } if (IsRepeatVisible && columnName == "PasswordRepeat" && !RepeatMatches && afterRepeatChanged) // не показываем ошибку после смены первого пароля { return("Пароли не совпадают."); } return(base[columnName]); } }
public void MultiCustom() { // отдельный пользовательский словарь на врача // первый создает слово var newW = CreateWordAsInEditor("123"); Assert.IsTrue(newW.Vocabularies.Single().IsCustom); Assert.AreEqual(d1, newW.Vocabularies.Single().Doctor); // другой врач не видит это слово AuthorityController.TryLogIn(d2); using (var wordList = new WordsListViewModel()) { Assert.IsFalse(wordList.Words.Select(x => x.word).Contains(newW)); // но может добавить var newW2 = CreateWordAsInEditor("123"); Assert.AreEqual(newW, newW2); // это слово в двух пользовательских словарях Assert.IsTrue(newW.Vocabularies.Count() == 2); Assert.IsTrue(newW.Vocabularies.All(x => x.IsCustom)); } }
public void DoctorSeeAllWordsForHisSpeciality() { AuthorityController.TryLogIn(d2); Assert.IsTrue(d2.Speciality != null); Assert.IsTrue(d2.Speciality.Vocabularies.SelectMany(y => y.Words).All(x => d2.SpecialityWords.Contains(x))); }
public void CanSearchAfterRelogin() { AuthorityController.LogOut(); AuthorityController.TryLogIn(d1); (s.RootQueryBlock.AutocompleteAll as AutocompleteViewModel).AddTag(w[6]); Assert.IsTrue(s.SearchCommand.CanExecute(null)); }
public void DeleteVocs(IEnumerable <Vocabulary> toDel) { new VocLoader(Session).DeleteVocs(toDel); MakeInstalledVms(); MakeAvailableVms(); #if DEBUG AuthorityController.LoadVocsAfterLogin(); // обновляем доступные слова не меняя пользователя #endif }
public void GetAuthorities_Handles_InvalidResponse() { var httpClientMock = GetHttpClientMock(false); _httpClienServiceFactory.Setup(p => p.Create(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IEnumerable <KeyValuePair <string, string> > >())) .Returns(httpClientMock.Object); var result = new AuthorityController(_httpClienServiceFactory.Object, new LocalCacheService(), _configurationOptions).GetAuthorities(); var contentResult = result as NotFoundObjectResult; Assert.NotNull(result); Assert.NotNull(contentResult); }
public void AfterLoad(IEnumerable <Vocabulary> vocsToLoad) { var ids = vocsToLoad.Select(x => x.Id).ToList(); var selectedSynced = VocabularyQuery.ByIds(Session)(ids); new VocLoader(Session).LoadOrUpdateVocs(selectedSynced); MakeInstalledVms(); MakeAvailableVms(); #if DEBUG AuthorityController.LoadVocsAfterLogin(); // загружаем словари не меняя пользователя #endif }
public void GetAuthorities_Returns_AuthorityList() { var httpClientMock = GetHttpClientMock(true); _httpClienServiceFactory.Setup(p => p.Create(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IEnumerable <KeyValuePair <string, string> > >())) .Returns(httpClientMock.Object); var result = new AuthorityController(_httpClienServiceFactory.Object, new LocalCacheService(), _configurationOptions).GetAuthorities(); var contentResult = result as JsonResult; var dataResult = contentResult?.Value as List <Authority>; Assert.NotNull(result); Assert.NotNull(contentResult); Assert.NotNull(dataResult); Assert.Equal(5, dataResult.Count); }
public void CanCreateWordInHiddenVoc() { // врач создает слово, которое есть в недоступном ему словаре var d1w = w[1]; Assert.IsTrue(d1.Words.Contains(d1w)); AuthorityController.TryLogIn(d2); // другой врач не видит это слово Assert.IsFalse(d2.Words.Contains(d1w)); // но может добавить var newW2 = CreateWordAsInEditor(d1w.Title); Assert.AreEqual(d1w, newW2); }
public void RemoveVoc() { AuthorityController.TryLogIn(d2); l.LoadOrUpdateVocs(voc[2]); // 2 слова только в словаре. используем одно из них var onlyVocWords = voc[2].Words.Where(x => x.Vocabularies.Count() == 1).ToList(); Assert.IsTrue(onlyVocWords.Count > 1); Assert.IsTrue(onlyVocWords.All(x => x.HealthRecords.Count() == 0)); var hr = new HealthRecord(a[1], d2); var usedWord = onlyVocWords.First(); hr.SetItems(new[] { usedWord }); session.SaveOrUpdate(hr); // удаляем словарь l.DeleteVocs(voc[2]); AuthorityController.LoadVocsAfterLogin(); // на клиенте не осталось шаблонов, слов и специальностей, связанных со словарем Assert.AreEqual(0, session.Query <Speciality>().ToList().Where(x => x.Vocabularies.Contains(voc[2])).Count()); Assert.AreEqual(0, session.Query <Word>().ToList().Where(x => x.Vocabularies.Contains(voc[2])).Count()); Assert.AreEqual(0, session.Query <WordTemplate>().Where(x => x.Vocabulary == voc[2]).Count()); // слова специальности у врача теперь без слов, кот были только в словаре Assert.IsTrue(d2.SpecialityWords.All(x => !onlyVocWords.Contains(x))); // врачу недоступны неиспользованные им слова, бывшие только в убранном словаре var notUsedByDoctor = onlyVocWords.Where(x => x.HealthRecords.All(y => y.Doctor != d2)).ToList(); Assert.IsTrue(d2.Words.All(x => !notUsedByDoctor.Contains(x))); // и доступны использованные var usedByDoctor = onlyVocWords.Where(x => x.HealthRecords.Any() && x.HealthRecords.All(y => y.Doctor == d2)).ToList(); Assert.IsTrue(usedByDoctor.All(x => d2.Words.Contains(x))); }
public void AddWordToDoctorAfterSaveHisHr() { // слова становятся видны доктору только после сохранения записи AuthorityController.TryLogIn(d2); Word wForD1Only = word3; Assert.IsTrue(!d2.Words.Contains(wForD1Only)); using (var card = new CardViewModel(hr)) { card.HrList.AddHealthRecordCommand.Execute(null); (card.HrEditor.Autocomplete as AutocompleteViewModel).AddTag(wForD1Only); Assert.IsTrue(!d2.Words.Contains(wForD1Only)); card.HrEditor.CloseCommand.Execute(null); } Assert.IsTrue(d2.Words.Contains(wForD1Only)); }
public void FirstMatchingReturnsWordsNotInDoctorVocs() { // слова становятся видны доктору только после сохранения записи AuthorityController.TryLogIn(d2); var word = r.FirstMatchingOrNewWord(notExistQ); Assert.IsTrue(!d2.Words.Contains(word)); Assert.IsTrue(!d2.CustomVocabulary.Words.Contains(word)); Word wForD1Only = w[1]; Assert.IsTrue(!d2.Words.Contains(wForD1Only)); var word2 = r.FirstMatchingOrNewWord(wForD1Only.Title); Assert.IsTrue(!d2.Words.Contains(word2)); Assert.IsTrue(!d2.CustomVocabulary.Words.Contains(word2)); Assert.AreEqual(wForD1Only, word2); }
public ScreenSwitcher(AuthorityController ac) { this.ac = ac; // диалоги SubscribeForSendOpenDialog(); // экраны AuthorityController.LoggedIn += (s, e) => { if (e.user is Admin) { OpenScreen(Screen.Doctors); } else if (e.user is Doctor) { OpenScreen(Screen.Patients); } }; AuthorityController.LoggedOut += (s, e) => { OpenScreen(Screen.Login); }; SubscribeForOpenInCard(); SubscribeForOpenInCriteria(); // closing screen this.Subscribe(Event.Shutdown, (e) => { if (CurrentView != null) { CurrentView.Dispose(); } }); this.Subscribe(Event.NewSession, (e) => { AuthorityController.Default.LogOut(); }); }
public void AddUsedHiddenWordToCustomVoc() { card.Dispose(); AuthorityController.TryLogIn(d2); card = new CardViewModel(true); // слово в словарях, но недоступно врачу Assert.IsTrue(w[6].Vocabularies.Any()); Assert.IsTrue(!d2.Words.Contains(w[6])); card.Open(a[1]); card.HrList.AddHealthRecordCommand.Execute(null); // используеум слово в записи card.HrEditor.HealthRecord.healthRecord.SetItems(new[] { w[6] }); // сохраняем запись card.HrEditor.Unload(); Assert.IsTrue(d2.Words.Contains(w[6])); Assert.IsTrue(d2.CustomVocabulary.Words.Contains(w[6])); }
public void InMemoryDatabaseTestInit() { Diagnosis.Data.Mappings.MappingHelper.Reset(); NHibernateHelper.Default.InMemory = true; NHibernateHelper.Default.ShowSql = true; Constants.IsClient = true; session = NHibernateHelper.Default.OpenSession(); Load <Doctor>(); AuthorityController = AuthorityController.Default; AuthorityController.TryLogIn(d1); handler = this.Subscribe(Event.NewSession, (e) => { var s = e.GetValue <ISession>(MessageKeys.Session); if (session.SessionFactory == s.SessionFactory) { session = s; } }); }
public void DeleteWordRemovesFromDoctorVocs() { var newW = CreateWordAsInEditor("123"); AuthorityController.TryLogIn(d2); var newW2 = CreateWordAsInEditor("123"); using (var wordList = new WordsListViewModel()) { wordList.SelectWord(newW2); wordList.DeleteCommand.Execute(null); Assert.IsFalse(wordList.Words.Select(x => x.word).Contains(newW2)); Assert.IsFalse(d2.Words.Contains(newW2)); // пока врач удаляет как админ, сразу для всех врачей // при удалении одним врачом остается для другого //Assert.IsTrue(d1.Words.Contains(newW2)); //Assert.AreEqual(d1, newW.Vocabularies.Single().Doctor); } }
public void SpawnObject() { GameObject[] objs = GameObject.FindGameObjectsWithTag("Authority"); Debug.Log("Number of objects " + objs.Length); for (int i = 0; i < objs.Length; ++i) { GameObject obj = objs[i]; if (obj != null) { _aController = obj.GetComponent <AuthorityController>(); } else { Debug.Log("Couldn't find prefab"); } if (_aController.IsLocalPlayer()) { Debug.Log("Found Local Player"); _aController.Spawn(); } } }
public authorityItem[] GetAuthsBySolved(string num) { ac = new AuthorityController(); authorityItem[] result = ac.GetAuthsBySolved(num); return(result); }
public authorityItem[] GetAuthsByPin(string pin) { ac = new AuthorityController(); authorityItem[] result = ac.GetAuthsByPin(pin); return(result); }
public authorityItem[] GetAuthsByCountry(string country) { ac = new AuthorityController(); authorityItem[] result = ac.GetAuthsByCountry(country); return(result); }
public authorityItem[] GetAuthsByState(string state) { ac = new AuthorityController(); authorityItem[] result = ac.GetAuthsByState(state); return(result); }
public authorityItem[] GetAuthsByName(string name) { ac = new AuthorityController(); authorityItem[] result = ac.GetAuthsByName(name); return(result); }
public authorityItem[] GetAuths() { ac = new AuthorityController(); authorityItem[] result = ac.GetAuths(); return(result); }
public complaintItem[] GetComplaintsByAuthId(string authId) { ac = new AuthorityController(); complaintItem[] result = ac.GetComplaintsByAuthId(authId); return(result); }
public void Init() { AuthorityController.LogOut(); }