Beispiel #1
0
        public async Task <IActionResult> Create([Bind] DataCenterResponseViewModel dataCenterResponseViewModel)
        {
            DataCenterDTO dataCenter = dataCenterResponseViewModel.DataCenterResponse;
            string        url        = $"{CoreApiUrl}DataCenters/Add";

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Post(accessToken, url, dataCenter);

            if (response.StatusCode == HttpStatusCode.Created)
            {
                AppContextHelper.SetToastMessage("Identification type has been successfully created", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to create identification type", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }
            dataCenterResponseViewModel.Districts = await GetDistricts();

            dataCenterResponseViewModel.FacilityTypes = await GetFacilityTypes();

            return(View(dataCenterResponseViewModel));
        }
        public async Task <IActionResult> Edit([Bind] ScheduledNotificationViewModel scheduledNotificationViewModel)
        {
            ScheduledNotificationDTO scheduledNotification = scheduledNotificationViewModel.ScheduledNotification;

            string url = $"{NotificationsApiUrl}ScheduledNotifications/Update";

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Put(accessToken, url, scheduledNotification);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                AppContextHelper.SetToastMessage("Scheduled notification has been successfully updated", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to update scheduled notification", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }

            scheduledNotificationViewModel.EscalationRules = await GetEscalationRules();

            scheduledNotificationViewModel.NotificationTemplates = await GetNotificationTemplates();

            scheduledNotificationViewModel.NotificationChannels = await GetNotificationChannels();

            return(View(scheduledNotificationViewModel));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind] TeamMappingResponse teamMappingResponse)
        {
            ResponseTeamMappingDTO responseTeamMember = new ResponseTeamMappingDTO
            {
                CreatedBy    = teamMappingResponse.CreatedBy,
                DistrictCode = teamMappingResponse.DistrictCode,
                MappingId    = teamMappingResponse.MappingId,
                TeamMemberId = teamMappingResponse.TeamMemberId
            };

            string url = $"{CoreApiUrl}ResponseTeamMappings/Add";

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Post(accessToken, url, responseTeamMember);

            if (response.StatusCode == HttpStatusCode.Created)
            {
                AppContextHelper.SetToastMessage("Response team member has been successfully mapped", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index), new { teamMemberId = _teamMemberId, teamMemberName = _teamMemberName }));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to map response team member", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }
            ViewBag.TeamMemberName = _teamMemberName;
            return(View(teamMappingResponse));
        }
 public IActionResult Create()
 {
     return(View(new ScheduledNotificationEscalationRuleDTO
     {
         CreatedBy = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.Name)
     }));
 }
        public async Task <IActionResult> Edit([Bind] PatientResponseViewModel patientResponseViewModel)
        {
            PatientDTO patient = patientResponseViewModel.PatientResponse;
            string     url     = $"{PatientsApiUrl}Update";

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Put(accessToken, url, patient);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                AppContextHelper.SetToastMessage("Patient has been successfully updated", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to update patient", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }

            patientResponseViewModel.PatientStatuses = await GetPatientStatuses();

            patientResponseViewModel.IdentificationTypes = await GetIdentificationTypes();

            patientResponseViewModel.TransmissionClassifications = await GetClassifications();

            return(View(patientResponseViewModel));
        }
Beispiel #6
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseAuthentication();

            AppContextHelper.Configure(app.ApplicationServices.GetRequiredService <IHttpContextAccessor>());

            RunMigrations(app);

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
 public IActionResult Create()
 {
     return(View(new ResourceDTO
     {
         CreatedBy = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.Name)
     }));
 }
Beispiel #8
0
 public IActionResult Create()
 {
     return(View(new TransmissionClassificationDTO
     {
         CreatedBy = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.Name)
     }));
 }
 public IActionResult Create()
 {
     return(View(new PatientResponse
     {
         CreatedBy = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.Name)
     }));
 }
        public async Task <IActionResult> Create([Bind] ResponseTeamMemberDTO responseTeamMember)
        {
            string url = $"{CoreApiUrl}ResponseTeamMembers/Add";

            //Clean up phoner number
            var sanitizedNumber = PhoneNumberSanitizer.Sanitize(responseTeamMember.PhoneNumber, "+265");

            responseTeamMember.PhoneNumber = sanitizedNumber;
            var fullName = $"{responseTeamMember.FirstName} {responseTeamMember.Surname}";

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Post(accessToken, url, responseTeamMember);

            if (response.StatusCode == HttpStatusCode.Created)
            {
                var identityResponse = await HttpRequestFactory.Post($"{IdentityServerAuthority}/api/Users/RegisterUser", new UserDTO { PhoneNumber = responseTeamMember.PhoneNumber, FullName = fullName });

                if (identityResponse.StatusCode == HttpStatusCode.Created)
                {
                    AppContextHelper.SetToastMessage("User account has been successfully created", MessageType.Danger, 1, Response);
                }
                AppContextHelper.SetToastMessage("Response team member has been successfully created", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to create response team member", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }

            return(View(responseTeamMember));
        }
Beispiel #11
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }

            app.UseAuthentication();
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();
            app.UseSession();

            AppContextHelper.Configure(app.ApplicationServices.GetRequiredService <IHttpContextAccessor>());
            RunMigrations(app);
            SeedData(serviceProvider);


            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Beispiel #12
0
 public IActionResult Create()
 {
     return(View(new DistrictResponse
     {
         CreatedBy = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.Name),
         RegionId = _regionId,
         RegionName = _regionName
     }));
 }
Beispiel #13
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseElmah();

            // note: already registered in the ABP
            AppContextHelper.Configure(app.ApplicationServices.GetRequiredService <IHttpContextAccessor>());

            // use NHibernate session per request
            //app.UseNHibernateSessionPerRequest();

            app.UseHangfireServer();

            app.UseAbp(options => { options.UseAbpRequestLocalization = false; }); // Initializes ABP framework.

            // global cors policy
            app.UseCors(x => x
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .SetIsOriginAllowed(origin => true) // allow any origin
                        .AllowCredentials());               // allow credentials

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseAbpRequestLocalization();

            app.UseRouting();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "defaultWithArea",
                    pattern: "{area}/{controller=Home}/{action=Index}/{id?}");
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapHub <AbpCommonHub>("/signalr");
                endpoints.MapControllers();
                endpoints.MapSignalRHubs();
            });

            // Enable middleware to serve generated Swagger as a JSON endpoint
            app.UseSwagger();

            // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
            app.UseSwaggerUI(options =>
            {
                options.SwaggerEndpoint("swagger/v1/swagger.json", "Shesha API V1");
                options.IndexStream = () => Assembly.GetExecutingAssembly()
                                      .GetManifestResourceStream("Shesha.Web.Host.wwwroot.swagger.ui.index.html");
            }); // URL: /swagger

            app.UseHangfireDashboard();
        }
Beispiel #14
0
        public IActionResult Dashboard()
        {
            var user     = HttpContext.User;
            var name     = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.Name);
            var fullname = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.PreferredUserName);

            //_cookieService.Add("UserName", "vvinkhumbo");
            // _cookieService.Add("UserId", "vvin");
            //_cookieService.Add("PhoneNumber", "0884776533");
            //var accessToken = await HttpContext.GetTokenAsync("access_token");
            return(View());
        }
 public async Task <IActionResult> Create()
 {
     return(View(new BulkNotificationRequestViewModel
     {
         BulkNotificationRequest = new BulkNotificationRequest
         {
             CreatedBy = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.Name),
             SendDate = DateTime.UtcNow,
             SendNow = false
         },
         Channels = await GetNotificationChannels()
     }));
 }
Beispiel #16
0
 public async Task <IActionResult> Create()
 {
     return(View(new ResourceAllocationResponseViewModel
     {
         ResourceAllocationResponse = new ResourceAllocationResponse
         {
             CreatedBy = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.Name),
             PatientStatusId = _statusId,
             PatientStatusName = _patientStatusName
         },
         Resources = await GetResources()
     }));
 }
Beispiel #17
0
 public async Task <IActionResult> Create()
 {
     return(View(new DataCenterResponseViewModel
     {
         DataCenterResponse = new DataCenterResponse
         {
             CreatedBy = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.Name),
             IsHealthFacility = false
         },
         Districts = await GetDistricts(),
         FacilityTypes = await GetFacilityTypes()
     }));
 }
Beispiel #18
0
 public IActionResult Create()
 {
     ViewBag.TeamMemberName = _teamMemberName;
     if (_teamMemberId == 0)
     {
         return(RedirectToAction("Index", "ResponseTeamMembers"));
     }
     return(View(new TeamMappingResponse
     {
         TeamMemberId = _teamMemberId,
         CreatedBy = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.Name),
     }));
 }
 public async Task <IActionResult> Create()
 {
     return(View(new ScheduledNotificationViewModel
     {
         ScheduledNotification = new ScheduledNotificationDTO
         {
             CreatedBy = AppContextHelper.GetStringValueClaim(HttpContext, JwtClaimTypes.Name),
             IsActive = true,
             StartDate = DateTime.UtcNow.AddHours(2)
         },
         EscalationRules = await GetEscalationRules(),
         NotificationTemplates = await GetNotificationTemplates(),
         NotificationChannels = await GetNotificationChannels()
     }));
 }
        public async Task <IActionResult> Edit([Bind] ResourceDTO resource)
        {
            string url = $"{ResourcesApiUrl}Update";

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Put(accessToken, url, resource);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                AppContextHelper.SetToastMessage("Resource has been successfully updated", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to update resource", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }
            return(View(resource));
        }
Beispiel #21
0
        public async Task <IActionResult> VerifyDelete(int mappingId)
        {
            string url = $"{CoreApiUrl}ResponseTeamMappings/Delete?mappingId={mappingId}";

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Delete(accessToken, url);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                AppContextHelper.SetToastMessage("Response team member mapping has been successfully deleted", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index), new { teamMemberId = _teamMemberId, teamMemberName = _teamMemberName }));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to delete response team member mapping", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }
            return(RedirectToAction(nameof(Delete), new { mappingId }));
        }
Beispiel #22
0
        public async Task <IActionResult> VerifyDelete(int symptomId)
        {
            string url            = $"{PatientsApiUrl}Symptoms/Delete?symptomId={symptomId}";
            var    PatientSymptom = new PatientSymptomDTO();

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Delete(accessToken, url);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                AppContextHelper.SetToastMessage("Patient symptom has been successfully deleted", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to delete patient symptom", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }
            return(View(await GetPatientSymptom(symptomId)));
        }
        public async Task <IActionResult> VerifyConfirmPatient(long patientId)
        {
            string url     = $"{PatientsApiUrl}ConfirmPatient?patientId={patientId}";
            var    patient = new PatientResponse();

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Put(accessToken, url, patientId);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                AppContextHelper.SetToastMessage("Patient has been successfully confirmed", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to confirm patient", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }
            return(RedirectToAction(nameof(ConfirmPatient), new { patientId }));
        }
        public async Task <IActionResult> VerifyDelete(string resourceId)
        {
            string url      = $"{ResourcesApiUrl}Delete?resourceId={resourceId}";
            var    Resource = new ResourceDTO();

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Delete(accessToken, url);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                AppContextHelper.SetToastMessage("Resource has been successfully deleted", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to delete resource", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }
            return(View(await GetResource(resourceId)));
        }
        public async Task <IActionResult> Create([Bind] ScheduledNotificationEscalationRuleDTO escalationRule)
        {
            string url = $"{NotificationsApiUrl}ScheduledNotificationEscalationRules/Add";

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Post(accessToken, url, escalationRule);

            if (response.StatusCode == HttpStatusCode.Created)
            {
                AppContextHelper.SetToastMessage("Scheduled notification escalation rule has been successfully created", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to create scheduled notification escalation rule", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }

            return(View(escalationRule));
        }
        public async Task <IActionResult> VerifyDelete(int notificationId)
        {
            string url = $"{NotificationsApiUrl}BulkNotifications/Delete?notificationId={notificationId}";
            var    BulkNotification = new BulkNotificationDTO();

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Delete(accessToken, url);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                AppContextHelper.SetToastMessage("Bulk notification has been successfully deleted", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to delete bulk notification", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }
            return(View(await GetBulkNotification(notificationId)));
        }
        public async Task <IActionResult> VerifyDelete(int ruleId)
        {
            string url = $"{NotificationsApiUrl}ScheduledNotificationEscalationRules/Delete?ruleId={ruleId}";
            var    ScheduledNotificationEscalationRule = new ScheduledNotificationEscalationRuleDTO();

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Delete(accessToken, url);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                AppContextHelper.SetToastMessage("Scheduled notification escalation rule has been successfully deleted", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to delete scheduled notification escalation rule", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }
            return(View(await GetScheduledNotificationEscalationRule(ruleId)));
        }
        public async Task <IActionResult> Create([Bind] FacilityTypeDTO facilityType)
        {
            string url = $"{CoreApiUrl}FacilityTypes/Add";

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Post(accessToken, url, facilityType);

            if (response.StatusCode == HttpStatusCode.Created)
            {
                AppContextHelper.SetToastMessage("Facility type has been successfully created", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to create facility type", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }

            return(View(facilityType));
        }
        public async Task <IActionResult> VerifyDelete(int facilityTypeId)
        {
            string url          = $"{CoreApiUrl}FacilityTypes/Delete?facilityTypeId={facilityTypeId}";
            var    FacilityType = new FacilityTypeDTO();

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Delete(accessToken, url);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                AppContextHelper.SetToastMessage("Facility type has been successfully deleted", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to delete identification Type", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }
            return(View(await GetFacilityType(facilityTypeId)));
        }
        public async Task <IActionResult> VerifyDelete(string countryCode)
        {
            string url     = $"{CoreApiUrl}Countries/Delete?countryCode={countryCode}";
            var    Country = new CountryDTO();

            var accessToken = await HttpContext.GetTokenAsync("access_token");

            var response = await HttpRequestFactory.Delete(accessToken, url);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                AppContextHelper.SetToastMessage("Country has been successfully deleted", MessageType.Success, 1, Response);
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AppContextHelper.SetToastMessage("Failed to delete country", MessageType.Danger, 1, Response);
                ModelState.AddModelError("", HttpResponseHandler.Process(response));
            }
            return(View(await GetCountry(countryCode)));
        }