Beispiel #1
0
        private static void Main(string[] args)
        {
            foreach (var endpoint in GetEndPoints())
            {
                var binding = new NetTcpBinding();
                var channel = new ChannelFactory <IInstitutionService>(binding, endpoint);
                IInstitutionService client = null;

                try
                {
                    client = channel.CreateChannel();
                    GetInstitutionName(client);
                    GetPatientInfo(client);

                    (client as ICommunicationObject).Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    if (client != null)
                    {
                        (client as ICommunicationObject).Abort();
                    }
                }
            }

            Console.ReadLine();
        }
Beispiel #2
0
        public InstitutionViewController(ICatalogService catalogService, IInstitutionService institutionService)
        {
            _catalogService     = catalogService;
            _institutionService = institutionService;

            _viewModelMapperHelper = new ViewModelMapperHelper(ViewBag, _institutionService, _catalogService);
        }
Beispiel #3
0
        public List <TViewModel> GetAllPatientsFromInstitution <TViewModel>(Guid institutionId) where TViewModel : class
        {
            var institution = _repository.Read(institutionId);

            if (institution != null)
            {
                _connection = EstablishConnection(institution.InstitutionEndpointAddress);
            }

            if (_connection == null)
            {
                return(new List <TViewModel>());
            }

            var allPatientsFromInstitution = _connection?.GetAllPatients();

            _searchHistoryRepository.Create(new SearchHistory
            {
                CreatedAt  = DateTime.Now,
                CreatedBy  = _username,
                SearchType = SearchType.ALL_PATIENTS_FROM_INSTITUTION
            });

            return(Mapper.Map <List <TViewModel> >(allPatientsFromInstitution));
        }
 public ViewModelMapperHelper(dynamic viewBag, IInstitutionService institutionService, ICatalogService catalogService)
 {
     // TODO: Complete member initialization
     _viewBag            = viewBag;
     _institutionService = institutionService;
     _catalogService     = catalogService;
 }
Beispiel #5
0
 public DonateController(IDonationService donationService, IInstitutionService institutionService, ICategoryService categoryService, UserManager <AspNetUser> userManager)
 {
     this._donationService    = donationService;
     this._institutionService = institutionService;
     this._categoryService    = categoryService;
     this._userManager        = userManager;
 }
 public InstitutionController(IInstitutionService institutionService,
                              ILoginService loginService,
                              IEmailService emailService)
 {
     this.institutionService = institutionService;
     this.loginService       = loginService;
     this.emailService       = emailService;
 }
 public DonationController(ICategoryService categoryService, IDonationService donationService,
                           IInstitutionService institutionService
                           )
 {
     _categoryService    = categoryService;
     _donationService    = donationService;
     _institutionService = institutionService;
 }
Beispiel #8
0
        public TViewModel GetDocument <TViewModel>(Guid hospitalizationDocumentId, string endpoint) where TViewModel : class
        {
            _connection = EstablishConnection(endpoint);

            var document = _connection?.GetDocument(hospitalizationDocumentId);

            return(Mapper.Map <TViewModel>(document));
        }
 public ViewChangePasswordViewModel(IEventAggregator eventAggregator, IRegionManager regionManager, IInstitutionService institutionService)
 {
     this.eventAggregator    = eventAggregator;
     this.regionManager      = regionManager;
     this.institutionService = institutionService;
     this.Institution        = new Institution();
     SaveCommand             = new DelegateCommand(SaveCommandExecute, SaveCommandCanExecute);
     this.eventAggregator.GetEvent <ChangePasswordEvent>().Subscribe(GetInstitution);
 }
Beispiel #10
0
 public InstitutionDeleteController(IInstitutionService institutionService,
                                    ILoanManagementV3DataService loanManagementV3DataService,
                                    ICatalogService catalogService)
 {
     _institutionService          = institutionService;
     _catalogService              = catalogService;
     _authorizationService        = AuthorizationServiceFactory.Current;
     _loanManagementV3DataService = loanManagementV3DataService;
 }
 public EducationalBackgroundService(IUnitOfWork unitOfWork, ITitleService titleService,IInstitutionService institutionService,
     IApplicationUserManager userManager, IMappingEngine mappingEngine)
 {
     _userManager = userManager;
     _unitOfWork = unitOfWork;
     _educationalBackgrounds = _unitOfWork.Set<EducationalBackground>();
     _mappingEngine = mappingEngine;
     _titleService = titleService;
     _institutionService = institutionService;
 }
Beispiel #12
0
        public async Task <IActionResult> Index([FromServices] IInstitutionService institutionService, [FromServices] IDonationService donationService, [FromServices] ICategoryService categoryService)
        {
            var viewModel = new IndexViewModel()
            {
                InstitutionList         = await institutionService.GetAllAsync(),
                CountSupportedCharities = await donationService.CountInstitution(),
                SumOfQuantity           = await donationService.SumOfAllQuantity(),
            };

            return(View(viewModel));
        }
Beispiel #13
0
 public ViewLoginViewModel(IEventAggregator eventAggregator, IRegionManager regionManager, IAuthenticationService authService, ILostService lostService, IInstitutionService institutionService)
 {
     this.Institution             = new Institution();
     LoginCommand                 = new DelegateCommand(LoginCommandExecute, LoginCommandCanExecute);
     Institution.PropertyChanged += Institution_PropertyChanged;
     this.eventAggregator         = eventAggregator;
     this.regionManager           = regionManager;
     this.authService             = authService;
     this.lostService             = lostService;
     this.institutionService      = institutionService;
 }
Beispiel #14
0
 public ResumeController(IResumeService resumeService, IResumeManagerService managerService, IContactService contactService,
                         IInstitutionService instService, IProfessionService profService, IWorkPlaceService workService,
                         ICertificateService certService, ISkillService skillService)
 {
     _resumeService      = resumeService;
     _managerService     = managerService;
     _contactService     = contactService;
     _institutionService = instService;
     _professionService  = profService;
     _workPlaceService   = workService;
     _certificateService = certService;
     _skillService       = skillService;
 }
Beispiel #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserController"/> class
 /// </summary>
 /// <param name="userService">The user service which is used to communicate with the logic layer.</param>
 /// <param name="mapper">The mapper which is used to convert the resources to the models to the resource results.</param>
 /// <param name="roleService">The role service which is used to communicate with the logic layer.</param>
 /// <param name="institutionService">The institution service which is used to communicate with the logic layer.</param>
 /// <param name="authorizationHelper">The authorization helper which is used to communicate with the authorization helper class.</param>
 /// <param name="userUserService">The user user service is responsible for users that are following users.</param>
 public UserController(IUserService userService,
                       IMapper mapper,
                       IRoleService roleService,
                       IAuthorizationHelper authorizationHelper,
                       IInstitutionService institutionService,
                       IUserUserService userUserService)
 {
     this.userService         = userService;
     this.mapper              = mapper;
     this.roleService         = roleService;
     this.authorizationHelper = authorizationHelper;
     this.institutionService  = institutionService;
     this.userUserService     = userUserService;
 }
Beispiel #16
0
        public TViewModel GetHospitalization <TViewModel>(Guid hospitalizationId, string endpoint) where TViewModel : class
        {
            _connection = EstablishConnection(endpoint);

            var hospitalization = _connection?.GetHospitalization(hospitalizationId);

            _searchHistoryRepository.Create(new SearchHistory
            {
                CreatedAt         = DateTime.Now,
                CreatedBy         = _username,
                HospitalizationId = hospitalizationId,
                SearchType        = SearchType.HOSPITALIZATION
            });

            return(Mapper.Map <TViewModel>(hospitalization));
        }
Beispiel #17
0
        public TViewModel GetExamination <TViewModel>(Guid examinationId, string endpoint) where TViewModel : class
        {
            _connection = EstablishConnection(endpoint);

            var examination = _connection?.GetExamination(examinationId);

            _searchHistoryRepository.Create(new SearchHistory
            {
                CreatedAt     = DateTime.Now,
                CreatedBy     = _username,
                ExaminationId = examinationId,
                SearchType    = SearchType.EXAMINATION
            });

            return(Mapper.Map <TViewModel>(examination));
        }
Beispiel #18
0
        public TViewModel GetTreatment <TViewModel>(Guid treatmentId, string endpoint) where TViewModel : class
        {
            _connection = EstablishConnection(endpoint);

            var treatment = _connection?.GetTreatment(treatmentId);

            _searchHistoryRepository.Create(new SearchHistory
            {
                CreatedAt   = DateTime.Now,
                CreatedBy   = _username,
                TreatmentId = treatmentId,
                SearchType  = SearchType.TREATMENT
            });

            return(Mapper.Map <TViewModel>(treatment));
        }
Beispiel #19
0
        private PatientTransferObject GetPatient(string pesel, Institution institution, bool fullHistory)
        {
            _connection = EstablishConnection(institution.InstitutionEndpointAddress);
            var patient = _connection?.GetPatient(pesel, fullHistory);

            if (patient == null)
            {
                return(null);
            }

            foreach (var h in patient.Hospitalizations)
            {
                h.InstitutionId = institution.InstitutionId;
            }

            return(patient);
        }
Beispiel #20
0
 public PaymentController(RegisterUserService registerUserService, InstitutionService institutionService)
 {
     BuckarooClient      = new SdkClient();
     _registerUser       = registerUserService;
     _institutionService = institutionService;
 }
 public InstitutionsController(IInstitutionService service)
 {
     _institutionService = service;
 }
 public InstitutionController(IInstitutionService institutionService, ICorrectingInsService correctingInsService, IEmployeeService employeeService)
 {
     _institutionService   = institutionService;
     _correctingInsService = correctingInsService;
     _employeeService      = employeeService;
 }
 public HomeController(IInstitutionService institutionService,
                       IEmailService emailService)
 {
     this.institutionService = institutionService;
     this.emailService       = emailService;
 }
 public InstitutionSaveController(IInstitutionService institutionService,
                                  ICatalogService catalogService)
 {
     _institutionService = institutionService;
     _catalogService     = catalogService;
 }
 public InstitutionAppService(IMapper mapper, IInstitutionService institutionService, IUnitOfWork uow)
 {
     _mapper             = mapper;
     _institutionService = institutionService;
     _uow = uow;
 }
Beispiel #26
0
        /// <summary>
        ///     Configures the specified application.
        ///     This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <param name="env">The env.</param>
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            env.WebRootPath        = Path.Combine(Directory.GetCurrentDirectory(), "Uploads");
            Defaults.Path.filePath = Path.Combine(env.WebRootPath, "Images");


            UpdateDatabase(app, env);
            if (env.IsDevelopment())
            {
                //app.UseBrowserLink();
                app.UseDeveloperExceptionPage();

                //app.UseDatabaseErrorPage();
            }
            else if (env.IsProduction())
            {
                app.UseExceptionHandler(new ExceptionHandlerOptions
                {
                    ExceptionHandler = context =>
                    {
                        context.Response.ContentType = "text/HTML";
                        context.Response.Redirect("/Error.html");
                        return(Task.CompletedTask);
                    }
                });
            }
            else
            {
                app.UseExceptionHandler();
            }

            app.UseProblemDetails();

            app.UseStaticFiles();
            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(
                    Path.Combine(env.ContentRootPath, "Uploads", "Images")),
                RequestPath = "/Uploads/Images"
            });

            app.UseRouting();
            app.UseCors(c =>
            {
                c.WithOrigins(Config.Frontend.FrontendUrl);
                c.SetIsOriginAllowedToAllowWildcardSubdomains();
                c.AllowAnyHeader();
                c.AllowAnyMethod();
            });
            app.UseHttpsRedirection();
            app.UseAuthentication();
            app.UseAuthorization();

            //UserInfo
            app.UseWhen(context =>
                        context.User.Identities.Any(i => i.IsAuthenticated),
                        appBuilder =>
            {
                appBuilder.Use(async(context, next) =>
                {
                    DbContext dbContext      = context.RequestServices.GetService <DbContext>();
                    IUserService userService =
                        context.RequestServices.GetService <IUserService>();
                    string identityId = "";
                    try
                    {
                        identityId = context.User.GetIdentityId(context);
                    } catch (UnauthorizedAccessException e)
                    {
                        Log.Logger.Error(e, "User is not authorized.");
                        await next();
                    }
                    IInstitutionService institutionService =
                        context.RequestServices.GetService <IInstitutionService>();
                    UserCreateInternalResource userInformation = context.GetUserInformation(Config);
                    User user = await userService.GetUserByIdentityIdAsync(identityId)
                                .ConfigureAwait(false);
                    if (user == null)
                    {
                        IRoleService roleService = context.RequestServices.GetService <IRoleService>();
                        Role registeredUserRole  =
                            (await roleService.GetAll()).FirstOrDefault(
                                i => i.Name == nameof(Defaults.Roles.RegisteredUser));

                        if (userInformation == null)
                        {
                            // Then it probably belongs swagger so we set the username as developer.
                            User newUser = new User
                            {
                                Name          = "Developer",
                                Email         = "*****@*****.**",
                                IdentityId    = identityId,
                                Role          = registeredUserRole,
                                InstitutionId = 1
                            };
                            userService.Add(newUser);
                        }
                        else
                        {
                            User newUser = new User
                            {
                                Name       = userInformation.Name,
                                Email      = userInformation.Email,
                                IdentityId = userInformation.IdentityId,
                                Role       = registeredUserRole,
                            };
                            Institution institution =
                                await institutionService.GetInstitutionByInstitutionIdentityId(
                                    userInformation.IdentityInstitutionId);
                            if (institution != null)
                            {
                                newUser.InstitutionId = institution.Id;
                            }
                            userService.Add(newUser);
                        }
                        await dbContext.SaveChangesAsync()
                        .ConfigureAwait(false);
                    }

                    // If the user is already in the database and the Update institution on login is set to true
                    else if (Config.OriginalConfiguration.GetValue <bool>("UpdateInstitutionOnLogin"))
                    {
                        if (userInformation != null)
                        {
                            Institution institution = await institutionService.GetInstitutionByInstitutionIdentityId(
                                userInformation.IdentityInstitutionId);
                            if (institution != null)
                            {
                                user.InstitutionId = institution.Id;
                            }

                            userService.Update(user);
                            await dbContext.SaveChangesAsync()
                            .ConfigureAwait(false);
                        }
                    }
                    await next()
                    .ConfigureAwait(false);
                });
            });

            app.UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute());

            app.UseSwagger();
            app.UseSwaggerUI(o =>
            {
                o.SwaggerEndpoint("/swagger/v1/swagger.json", "Dex API V1");
                o.DocExpansion(DocExpansion.None);
                o.RoutePrefix = "";
                o.DisplayRequestDuration();
                o.OAuthClientId(Config.Swagger.ClientId);
            });
        }
 public InstitutionController(IUnitOfWork unitOfWork, IInstitutionService institutionService)
 {
     _unitOfWork = unitOfWork;
     _institutionService = institutionService;
 }
 public InstitutionController(IInstitutionService institutionService)
 {
     _institutionService = institutionService;
 }
Beispiel #29
0
 public DashboardApp(ICategoryService categoryService, IInstitutionService institutionService, IDonorService donorService)
 {
     _categoryService = categoryService;
     _institutionService = institutionService;
     _donorService = donorService;
 }
Beispiel #30
0
 public InstitutionController(ILogger <InstitutionController> logger,
                              IInstitutionService institutionService)
 {
     Logger             = logger;
     InstitutionService = institutionService;
 }
Beispiel #31
0
 private static void GetInstitutionName(IInstitutionService client)
 {
     Console.WriteLine(client.GetInstitutionName());
 }
 public InstitutionController(IInstitutionService institutionService)
 {
     this.institutionService = institutionService;
 }
Beispiel #33
0
 public HomeController(IDonationService donationService, IInstitutionService institutionService)
 {
     _donationService    = donationService;
     _institutionService = institutionService;
 }
Beispiel #34
0
 private static void GetPatientInfo(IInstitutionService client)
 {
     var patient = client.GetPatient("26112804811", false);
 }