/// <summary> /// File the case to the corresponding case folder. /// </summary> public void FileCase() { CaseFolder folder = FilingCabinet.Instance.FetchFolderByCase(caseNumber); folder.FilePage(this); int newIdAmount = 0; UnderlineRender UR = folder.GetComponentInChildren <UnderlineRender>(); foreach (var TG in GetComponentsInChildren <TextCreator>()) { TG.SetText(UR.GetIDCount() + newIdAmount); TG.clickText.underLiner = UR; TG.clickText.caseFolder = folder; foreach (var link in TG.clickText.textField.textInfo.linkInfo) { if (link.GetLinkID() != "") { newIdAmount++; } } } UR.AddPage(newIdAmount); _fileButton.SetActive(false); if (TutorialManager.Instance._doTutorial && TutorialManager.Instance.currentState == TutorialManager.TutorialState.PrintCase) { TutorialManager.Instance.AdvanceTutorial(); } }
public async Task TrackingEvents_AddCaseFolder_Success() { var unitOfWork = _provider.GetService <UnitOfWork>(); var caseFolderRepository = _provider.GetService <ICaseFolderRepository>(); var caseTypeRepository = _provider.GetService <ICaseTypeRepository>(); CaseFolder caseFolder; using (unitOfWork.Begin()) { caseFolder = new CaseFolder(); caseFolder.AddCaseCard(caseTypeRepository.GetFirst(), Guid.NewGuid()); await caseFolderRepository.Add(caseFolder); await unitOfWork.CommitAsync(); } using (unitOfWork.Begin()) { CaseFolder fromDb = await caseFolderRepository.GetById(caseFolder.Id); Assert.NotNull(fromDb); Assert.Equal(caseFolder.Id, fromDb.Id); Assert.NotNull(fromDb.Cases); Assert.True(fromDb.Cases.Any()); Assert.True(fromDb.TrackingEvents.Any()); } }
/// <summary> /// Создать DTO с информацией о статусах карточек в CaseFolder /// </summary> /// <param name="caseFolder"></param> /// <param name="user"></param> /// <returns></returns> public Result <CaseStatusesInfoDto> GetStatusInfoDto(CaseFolder caseFolder, UserDto user) { var currentCaseResult = caseFolder.GetCaseForUser(user.Id); if (currentCaseResult.IsFailure) { return(Result.Failure <CaseStatusesInfoDto>(currentCaseResult.ErrorCode)); } var cases = caseFolder.Cases; var caseStatuses = cases.Select(x => new CaseStatusDto { CaseCardId = x.Id, Status = x.Status }) .ToList(); var statusesInfo = new CaseStatusesInfoDto { Statuses = caseStatuses, CanCloseCaseCard = currentCaseResult.Value.IsInProgress() }; return(Result.Success(statusesInfo)); }
/// <summary> /// Create a folder for the opened emaillisting. /// </summary> /// <returns></returns> public CaseFolder CreateFolder() { // TODO add better placement script here GameObject newFolderObj = Instantiate(_caseFolderPrefab, transform.position, Quaternion.Euler(new Vector3(270, 0, Random.Range(0f, 360f)))); CaseFolder newFolder = newFolderObj.GetComponent <CaseFolder>(); caseFolders.Add(newFolder); return(newFolder); }
protected override void ReadAttributeEvent(object sender, ReadElementEventArgs eventArgs) { if (IdentifiesCaseFolder(eventArgs)) { _currentCaseFolder = new CaseFolder { ArchivePartSystemId = _currentArchivePartSystemId } } ; }
protected override void ReadEndElementEvent(object sender, ReadElementEventArgs eventArgs) { // TODO: Handle non-casefolder-type subfolders? if (eventArgs.NameEquals("mappe") && _currentCaseFolder != null) { _folders.Add(_currentCaseFolder); _currentCaseFolder = null; } }
private async Task SaveCaseFolder(CaseFolder caseFolder) { var unitOfWork = _provider.GetScopedService <UnitOfWork>(); using (unitOfWork.Begin()) { var caseFolderRepository = new CaseFolderRepository(unitOfWork); await caseFolderRepository.Add(caseFolder); await unitOfWork.CommitAsync(); } }
/// <summary> /// Перезвонить заявителю /// </summary> public async Task <Result <CallBackToApplicantStatus> > CallBackToApplicant(Guid userId, CallBackToApplicantDto model) { using (_unitOfWork.Begin()) { var caseFolderId = model.CaseFolderId; CaseFolder caseFolder = await _caseFolderRepository.GetById(caseFolderId); if (caseFolder == null) { _logger.Warning($"CaseFolder with Id {caseFolderId} not found"); return(Result.Failure <CallBackToApplicantStatus>(ErrorCodes.CaseFolderNotFound)); } var participantResult = await GetApplicant(caseFolder); if (participantResult.IsFailure) { _logger.Warning(participantResult.ErrorMessage); return(Result.Failure <CallBackToApplicantStatus>(participantResult.ErrorCode)); } Result <UserClientDto> userResult = await _userManagementServiceClient.GetUserById(userId); if (userResult.IsFailure) { _logger.Warning($"CallBackToApplicant. Error get user by Id. {userResult.ErrorMessage}"); return(Result.Failure(ErrorCodes.UserNotFound)); } var user = _mapper.Map <UserDto>(userResult.Value); var clientModel = new CallBackToApplicantClientDto { UserExtension = user.Extension, ParticipantExtension = participantResult.Value.ParticipantExtension, CaseFolderId = caseFolderId, }; var result = await _callManagementServiceClient.CallBackToApplicant(clientModel); if (result.IsFailure) { _logger.Warning($"CallBackToApplicant. {result.ErrorMessage}"); return(Result.Failure <CallBackToApplicantStatus>(ErrorCodes.UnableToCallBackToApplicant)); } await _unitOfWork.CommitAsync(); await _phoneHubMessageService.NotifyUserAboutStartedExternalCall(userId, result.Value.LineId); return(Result.Success(CallBackToApplicantStatus.Ok)); } }
/// <summary> /// The create folder method for when the player loads a save. /// </summary> /// <returns></returns> public CaseFolder CreateFolderLoad() { Physics.Raycast(transform.position, Vector3.down, out RaycastHit hit); GameObject newFolderObj = Instantiate(_caseFolderPrefab, hit.point, Quaternion.Euler(new Vector3(270, 0, Random.Range(0f, 360f)))); CaseFolder newFolder = newFolderObj.GetComponent <CaseFolder>(); caseFolders.Add(newFolder); Rigidbody rb = newFolder.GetComponent <Rigidbody>(); rb.useGravity = false; rb.isKinematic = true; newFolder.GetComponent <HoverOverObject>().SetOriginPoints(); return(newFolder); }
/// <summary> /// Оповестить клиентов о добавлении местоположения абонента. /// </summary> private async Task NotifyGisFacadeAboutNewApplicantLocation(CaseFolder caseFolder, Guid operatorId) { Result <SmsLocationData> applicantLocationDataResult = caseFolder.GetLocationData(); if (applicantLocationDataResult.IsFailure) { _logger.Warning($"CaseService. Не удалось получить данные о местоположении из CaseFolder. {applicantLocationDataResult.ErrorMessage}"); } if (applicantLocationDataResult.IsSuccess && !caseFolder.IsClosed) { var applicantLocationDto = _mapper.Map <LocationDataClientDto>(applicantLocationDataResult.Value); await _gisFacadeClient.AddApplicantLocationMarker(caseFolder.Id, applicantLocationDto); await _phoneHubMessageService.NotifyClientsAboutApplicantLocationUpdateAsync(caseFolder.Id, operatorId); } }
public async void Add_CaseWithoutCall_SuccessfullySaved() { //Arrange var unitOfWork = _provider.GetService <UnitOfWork>(); var caseCardRepository = _provider.GetService <ICaseRepository>(); var caseCardTypeRepository = _provider.GetService <ICaseTypeRepository>(); Guid case112TypeId = new Guid(AddCaseTableAndCaseTemplateTable.CaseTypeId112); //Action CaseType caseType; using (unitOfWork.Begin()) { caseType = await caseCardTypeRepository.GetById(case112TypeId); await caseCardTypeRepository.Add(caseType); await unitOfWork.CommitAsync(); } Case caseCard; using (unitOfWork.Begin()) { var caseTypeFromDb = await caseCardTypeRepository.GetById(caseType.Id); var caseFolder = new CaseFolder(); caseFolder.AddCaseCard(caseTypeFromDb, Guid.NewGuid()); caseCard = caseFolder.Cases.FirstOrDefault(); await caseCardRepository.Add(caseCard); await unitOfWork.CommitAsync(); } //Assert using (unitOfWork.Begin()) { var caseCardFromDb = await caseCardRepository.GetById(caseCard.Id); caseCardFromDb.ShouldNotBeNull(); caseCardFromDb.Type.ShouldNotBeNull(); } }
public async void Remove_CaseFolder_CaseMustBeRemoved() { //Arrange var caseType = GetCaseType(); var caseFolder = new CaseFolder(); caseFolder.AddCaseCard(caseType, new Guid()); var caseCard = caseFolder.Cases.FirstOrDefault(); await SaveCaseFolder(caseFolder); //action await RemoveEntity(caseFolder); var result = await GetEntity <Case>(x => x.Id == caseCard.Id); //arrange result.ShouldBeNull(); }
/// <summary> /// Создание Line, CaseFolder и добавление Data к CaseFolder /// </summary> /// <param name="caseData"></param> /// <returns>LineId</returns> private async Task <Guid> CreateCaseFolder(string caseData, Guid userId) { using var uow = _provider.GetScopedService <UnitOfWork>(); uow.Begin(); var caseTypeRepo = new CaseTypeRepository(uow); var caseType = await caseTypeRepo.GetById(_case112TypeId); var caseFolder = new CaseFolder { Data = caseData }; caseFolder.AddCaseCard(caseType, userId); var caseFolderRepository = new CaseFolderRepository(uow); await caseFolderRepository.Add(caseFolder); await uow.CommitAsync(); return(caseFolder.Id); }
private async Task <Result <Guid> > PrepareCase(UserItemClientDto userItem) { Result <CallClientDto> callInfoResult = await _callManagementServiceClient.GetCallById(userItem.ItemId); if (callInfoResult.IsFailure) { _logger.Error($"ProcessCall. {callInfoResult.ErrorMessage}"); return(Result.Failure(callInfoResult.ErrorCode, callInfoResult.ErrorMessage)); } var caseFolderIdResult = callInfoResult.Value.Line.CaseFolderId; if (!userItem.CreateCaseCard) { if (caseFolderIdResult.HasValue) { return(Result.Success(caseFolderIdResult.Value)); } var newEmptyCaseFolder = new CaseFolder(); await _caseFolderRepository.Add(newEmptyCaseFolder); return(Result.Success(newEmptyCaseFolder.Id)); } var caseType = await _caseTypeRepository.GetById(userItem.CaseTypeId); if (caseFolderIdResult.HasValue) { var caseFolder = await _caseFolderRepository.GetById(caseFolderIdResult.Value); caseFolder.AddCaseCard(caseType, userItem.UserId); return(Result.Success(caseFolderIdResult.Value)); } var newCaseFolder = new CaseFolder(); newCaseFolder.AddCaseCard(caseType, userItem.UserId); await _caseFolderRepository.Add(newCaseFolder); return(Result.Success(newCaseFolder.Id)); }
private async Task <Result <Participant> > GetApplicant(CaseFolder caseFolder) { if (caseFolder.Sms != null) { return(Result.Success(caseFolder.Sms.Applicant)); } Result <List <LineByCaseFolderClientDto> > linesResult = await _callManagementServiceClient.GetLinesByCaseFolderId(caseFolder.Id); if (linesResult.IsFailure) { _logger.Warning($"GetApplicant. Failed to get line by caseFolderId: {caseFolder.Id}"); return(Result.Failure <Participant>(ErrorCodes.UnableToCallBackToApplicant)); } var lines = _mapper.Map <List <LineDto> >(linesResult.Value); if (lines == null) { _logger.Warning($"Lines not found for CaseFolder: {caseFolder.Id}"); return(Result.Failure <Participant>(ErrorCodes.LineNotFound)); } var callerId = lines.FirstOrDefault(l => l.ExternalCallerId.HasValue)?.ExternalCallerId; if (callerId == null) { _logger.Warning("Error getting applicant call from CaseFolder"); return(Result.Failure <Participant>(ErrorCodes.UnableToGetApplicant)); } var participant = await GetParticipant(callerId.Value); if (participant == null) { _logger.Warning($"Participant not found. Id: {callerId}"); return(Result.Failure <Participant>(ErrorCodes.UserNotFound)); } return(Result.Success(participant)); }
/// <summary> /// Принять СМС /// </summary> /// <param name="sms"></param> /// <param name="caseType"></param> /// <param name="userId"></param> /// <returns></returns> private Result <CaseFolder> AcceptSms(Sms sms, CaseType caseType, Guid userId) { var applicantExt = sms.Applicant.ParticipantExtension; sms.Status = SmsStatus.Accepted; var caseFolder = new CaseFolder { Sms = sms }; caseFolder.AddCaseCard(caseType, userId); var result = caseFolder.FillSmsData(applicantExt, sms); if (result.IsFailure) { return(result); } return(Result.Success(caseFolder)); }
public async Task TrackingEvents_UpdateCase_Success() { var unitOfWork = _provider.GetService <UnitOfWork>(); var caseFolderRepository = _provider.GetService <ICaseFolderRepository>(); var caseRepository = _provider.GetService <ICaseRepository>(); var caseTypeRepository = _provider.GetService <ICaseTypeRepository>(); Guid caseId; CaseFolder caseFolder; using (unitOfWork.Begin()) { caseFolder = new CaseFolder(); caseFolder.AddCaseCard(caseTypeRepository.GetFirst(), Guid.NewGuid()); await caseFolderRepository.Add(caseFolder); caseId = caseFolder.Cases.FirstOrDefault().Id; await unitOfWork.CommitAsync(); } using (unitOfWork.Begin()) { var caseFromDb = await caseRepository.GetById(caseId); caseFromDb.Status = "Closed"; await unitOfWork.CommitAsync(); } using (unitOfWork.Begin()) { CaseFolder caseFolderFromDb = await caseFolderRepository.GetById(caseFolder.Id); var caseCard = caseFolderFromDb.Cases.First(); Assert.Equal(4, caseFolderFromDb.TrackingEvents.Count); Assert.Equal(3, caseCard.Root.TrackingEvents.Count(t => t.OperationType == EventType.Inserted)); Assert.Equal(1, caseCard.Root.TrackingEvents.Count(t => t.OperationType == EventType.Updated)); } }
// ReSharper disable once InconsistentNaming public async void Get_Case_ShouldExists() { //arrange _unitOfWork.Begin(); var caseType = _caseTypeRepository.GetFirst(); var userId = Guid.NewGuid(); var caseFolder = new CaseFolder(); caseFolder.AddCaseCard(caseType, userId); await _caseFolderRepository.Add(caseFolder); await _unitOfWork.CommitAsync(); //action SetCurrentUserId(userId); demoResult <CaseDto> caseCardResult = await _caseController.GetCase(caseFolder.Id); //Assert caseCardResult.Result.ShouldBeOfType <demoOkResult <CaseDto> >(); }
public async Task TrackingEvents_UpdateBaseEntity_Success() { var unitOfWork = _provider.GetService <UnitOfWork>(); var caseRepository = _provider.GetService <ICaseRepository>(); var caseTypeRepository = _provider.GetService <ICaseTypeRepository>(); Case caseCard; using (unitOfWork.Begin()) { var caseTypeFromDb = caseTypeRepository.GetFirst(); var caseFolder = new CaseFolder(); caseFolder.AddCaseCard(caseTypeFromDb, Guid.NewGuid()); caseCard = caseFolder.Cases.FirstOrDefault(); await caseRepository.Add(caseCard); await unitOfWork.CommitAsync(); } using (unitOfWork.Begin()) { caseCard = await caseRepository.GetById(caseCard.Id); caseCard.Updated = DateTime.Now; await unitOfWork.CommitAsync(); } using (unitOfWork.Begin()) { caseCard = await caseRepository.GetById(caseCard.Id); Assert.NotNull(caseCard.Root); Assert.Equal(1, caseCard.CaseFolder.TrackingEvents.Count(t => t.OperationType == EventType.Updated)); Assert.Equal(3, caseCard.CaseFolder.TrackingEvents.Count(t => t.OperationType == EventType.Inserted)); } }