public async Task<List<IndicantChartDto>> GetChartAsync([FromHeader] System.Guid hServiceId, [FromHeader] double maxPeriodData) { _logger.LogDebug("GetChartAsync"); InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); return await inpatientDoctorClient.GetIndicantChartAsync(hServiceId, maxPeriodData); }
public async Task <ActionResult <CustomizationInfoDto> > CopyAsync([FromHeader] string sourceLogin, [FromHeader] string targetLogin) { InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); await inpatientDoctorClient.CopyCustomizationAsync(sourceLogin, targetLogin); return(await inpatientDoctorClient.GetCustomizationAsync(targetLogin, null)); }
public async Task <ActionResult <CustomizationInfoDto> > PostAsync([FromHeader] CustomizationInfoDto customizationInfo, [FromHeader] string Login, [FromHeader] string targetLogin) { InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); await inpatientDoctorClient.SaveCustomizationAsync(customizationInfo, Login, targetLogin); return(await inpatientDoctorClient.GetCustomizationAsync(Login, targetLogin)); }
public async Task <IActionResult> Login(LoginRequest request) { //var user = await _userManager.FindByNameAsync(request.UserName); //if (user == null) return BadRequest("User does not exist"); //var singInResult = await _signInManager.CheckPasswordSignInAsync(user, request.Password, false); //if (!singInResult.Succeeded) return BadRequest("Invalid password"); //await _signInManager.SignInAsync(user, request.RememberMe); //return Ok(); InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); bool result = await inpatientDoctorClient.AuthorizeAsync(request.UserName, request.Password); return(result ? Ok() : BadRequest()); }
public async Task <IEnumerable <DepartmentPatientDiagnosInfoDto> > GetAsync() { Guid parsePersonId; Guid parseHealthcareServiceId; bool parseIsArchive; Guid.TryParse(Request.Headers["PersonId"], out parsePersonId); bool.TryParse(Request.Headers["Archive"], out parseIsArchive); Guid.TryParse(Request.Headers["HealthcareServiceId"], out parseHealthcareServiceId); InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); try { return(await inpatientDoctorClient.GetPatientDiagnosisAsync(parsePersonId, parseIsArchive, parseIsArchive?Guid.Empty : parseHealthcareServiceId)); } catch (Exception ex) { return(null); } }
public async Task <IActionResult> Register(RegisterRequest parameters) { var user = new ApplicationUser(); user.UserName = parameters.UserName; /* var result = await _userManager.CreateAsync(user, parameters.Password); * if (!result.Succeeded) * return BadRequest(result.Errors.FirstOrDefault()?.Description);*/ InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); Guid?authResult = await inpatientDoctorClient.AuthorizeAsync(parameters.UserName, parameters.Password); if (!authResult.HasValue) { return(BadRequest("Contact the administrator for registration")); } return(await Login(new LoginRequest { UserName = parameters.UserName, Password = parameters.Password })); }
public async Task <IEnumerable <PatientDto> > GetAsync() { int.TryParse(Request.Headers["FilterType"], out int parseResult); string login = Request.Headers["UserLogin"].ToString(); if (parseResult != 0 && Enum.IsDefined(typeof(FilterPersonTypeDto), parseResult)) { Guid DepartmentId; Guid DoctorId; int.TryParse(Request.Headers["Page"], out int page); int.TryParse(Request.Headers["PageSize"], out int pageSize); string sortLabel = Request.Headers["SortLabel"].ToString(); bool.TryParse(Request.Headers["IsDescending"], out bool isDescending); PersonQueryParamsDto personQueryParams = new PersonQueryParamsDto(); personQueryParams.PersonQueryType = (FilterPersonTypeDto)parseResult; personQueryParams.Page = new PageParamDto { OffSet = page * pageSize + 1, Size = pageSize }; personQueryParams.SortBy = new SortByParamDto() { AttributeName = sortLabel, IsDescending = isDescending }; personQueryParams.SearchCondition = new SearchParamDto { DepartmentId = Guid.TryParse(Request.Headers["SearchDepartmentId"].ToString(), out DepartmentId) ? DepartmentId : Guid.Empty, DoctorId = Guid.TryParse(Request.Headers["SearchDoctorId"].ToString(), out DoctorId) ? DoctorId : Guid.Empty, FIOCardNumber = Request.Headers["SearchFIOCardNumber"].ToString() }; InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); inpatientDoctorClient.Endpoint.Binding.ReceiveTimeout = new TimeSpan(0, 10, 0); inpatientDoctorClient.Endpoint.Binding.OpenTimeout = new TimeSpan(0, 10, 0); inpatientDoctorClient.Endpoint.Binding.SendTimeout = new TimeSpan(0, 10, 0); inpatientDoctorClient.Endpoint.Binding.CloseTimeout = new TimeSpan(0, 10, 0); return(await inpatientDoctorClient.GetPatientsAsync(personQueryParams, login)); } return(null); }
public IEnumerable <PersonDto> Get() { InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); return(inpatientDoctorClient.GetPersonsAsync().Result.ToArray()); }
public async Task <Tuple <UserInfoDto, CustomizationInfoDto> > GetLoginAsync([FromQuery] string Login) { InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); return(new Tuple <UserInfoDto, CustomizationInfoDto>(await inpatientDoctorClient.GetUserInfoAsync(Login), await inpatientDoctorClient.GetCustomizationAsync(Login, null))); }
public async Task <IActionResult> Login(LoginRequest request) { InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); Guid?authResult = await inpatientDoctorClient.AuthorizeAsync(request.UserName, request.Password); if (authResult.HasValue) { var appUser = new ApplicationUser { Id = authResult.ToString(), UserName = request.UserName, SecurityStamp = Guid.NewGuid().ToString() }; try { // var userPrincipal = await _signInManager.CreateUserPrincipalAsync(appUser); //await _signInManager.SignInAsync(appUser, request.RememberMe); var claims = new List <Claim> { new Claim(ClaimTypes.Name, appUser.UserName), new Claim(ClaimTypes.NameIdentifier, appUser.Id), }; var claimsIdentity = new ClaimsIdentity( claims, CookieAuthenticationDefaults.AuthenticationScheme); var authProperties = new AuthenticationProperties { //AllowRefresh = <bool>, // Refreshing the authentication session should be allowed. //ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(10), // The time at which the authentication ticket expires. A // value set here overrides the ExpireTimeSpan option of // CookieAuthenticationOptions set with AddCookie. //IsPersistent = true, // Whether the authentication session is persisted across // multiple requests. When used with cookies, controls // whether the cookie's lifetime is absolute (matching the // lifetime of the authentication ticket) or session-based. //IssuedUtc = <DateTimeOffset>, // The time at which the authentication ticket was issued. //RedirectUri = <string> // The full path or absolute URI to be used as an http // redirect response value. }; await HttpContext.SignInAsync( CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(claimsIdentity), authProperties); return(Ok()); } catch (Exception ex) { return(BadRequest("Неправильный логин/пароль")); } } return(BadRequest("Неправильный логин/пароль")); }
public async Task <UserInfoDto> GetUserInfo(string login) { InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); return(await inpatientDoctorClient.GetUserInfoAsync(login)); }
public async Task <List <UserDto> > GetUsersAsync([FromHeader] string login) { InpatientDoctorClient inpatientDoctorClient = new InpatientDoctorClient(); return(await inpatientDoctorClient.GetAllUsersAsync(login)); }
public DataWCFService(ILogger <DataWCFService> logger) { _logger = logger; _client = new InpatientDoctorClient(); _logger.LogDebug("Create"); }