Exemplo n.º 1
0
        public void Init(string formId, string encounterTypeId, string mode, string clientId, string encounterId, string indexclient)
        {
            // Load Client

            Client = _dashboardService.LoadClient(new Guid(clientId));

            if (null != Client)
            {
                var clientJson = JsonConvert.SerializeObject(Client);
                _settings.AddOrUpdateValue("client", clientJson);
            }
            if (!string.IsNullOrWhiteSpace(indexclient))
            {
                IndexClient = new IndexClientDTO(new Guid(indexclient));
                _settings.AddOrUpdateValue("mclientIndex", JsonConvert.SerializeObject(IndexClient));
            }
            // Load or Create Encounter

            if (!string.IsNullOrWhiteSpace(encounterTypeId))
            {
                _settings.AddOrUpdateValue("encounterTypeId", encounterTypeId);
            }

            EncounterTypeId = new Guid(encounterTypeId);

            if (mode == "new")
            {
                //  New Encounter
                _settings.AddOrUpdateValue("client.link.mode", "new");
                Encounter = _tracingService.StartEncounter(new Guid(formId), EncounterTypeId, Client.Id, AppProviderId, AppUserId, AppPracticeId, AppDeviceId, IndexClient.Id);
            }
            else
            {
                //  Load Encounter
                _settings.AddOrUpdateValue("client.link.mode", "open");
                Encounter = _tracingService.OpenEncounter(new Guid(encounterId));
            }

            if (null == Encounter)
            {
                throw new ArgumentException("Encounter has not been Initialized");
            }
            //Store Encounter

            var encounterJson = JsonConvert.SerializeObject(Encounter);

            _settings.AddOrUpdateValue("client.encounter", encounterJson);



            var modes = _lookupService.GetCategoryItems("TraceMode", true, "[Select Mode]").ToList();

            _settings.AddOrUpdateValue("lookup.TMode", JsonConvert.SerializeObject(modes));
            var outcomes = _lookupService.GetCategoryItems("PNSOutcome", true, "[Select Outcome]").ToList();

            _settings.AddOrUpdateValue("lookup.TOutcome", JsonConvert.SerializeObject(outcomes));
            var consents = _lookupService.GetCategoryItems("YesNo", true, "[Select Consent]").ToList();

            _settings.AddOrUpdateValue("lookup.TConsent", JsonConvert.SerializeObject(consents));
        }
        public void Init(string formId, string encounterTypeId, string mode, string clientId, string encounterId, string indexclient)
        {
            // Load Client

            Client = _dashboardService.LoadClient(new Guid(clientId));

            if (null != Client)
            {
                var clientJson = JsonConvert.SerializeObject(Client);
                _settings.AddOrUpdateValue("client", clientJson);
            }

            if (!string.IsNullOrWhiteSpace(indexclient))
            {
                IndexClient = new IndexClientDTO(new Guid(indexclient));
                _settings.AddOrUpdateValue("clientIndex", JsonConvert.SerializeObject(IndexClient));
            }

            // Load or Create Encounter

            if (!string.IsNullOrWhiteSpace(encounterTypeId))
            {
                _settings.AddOrUpdateValue("encounterTypeId", encounterTypeId);
            }

            EncounterTypeId = new Guid(encounterTypeId);


            var hivstatus = _lookupService.GetCategoryItems("HIVStatus", true, "[Select Mode]").ToList();

            HIVStatus = hivstatus;
            _settings.AddOrUpdateValue("lookup.hivstatus", JsonConvert.SerializeObject(hivstatus));
            var eligibility = _lookupService.GetCategoryItems("Eligibility", true, "[Select Outcome]").ToList();

            Eligibility = eligibility;
            _settings.AddOrUpdateValue("lookup.eligibility", JsonConvert.SerializeObject(eligibility));

            if (mode == "new")
            {
                //  New Encounter
                _settings.AddOrUpdateValue("client.ms.mode", "new");
                Encounter = _memberScreeningService.StartEncounter(new Guid(formId), EncounterTypeId, Client.Id, AppProviderId, AppUserId, AppPracticeId, AppDeviceId, IndexClient.Id);
            }
            else
            {
                //  Load Encounter
                _settings.AddOrUpdateValue("client.ms.mode", "open");
                Encounter = _memberScreeningService.OpenEncounter(new Guid(encounterId));
            }

            if (null == Encounter)
            {
                throw new ArgumentException("Encounter has not been Initialized");
            }
            //Store Encounter

            var encounterJson = JsonConvert.SerializeObject(Encounter);

            _settings.AddOrUpdateValue("client.encounter", encounterJson);
        }
Exemplo n.º 3
0
        public void Init(string id, string callerId, string mode)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return;
            }

            if (!string.IsNullOrWhiteSpace(callerId))
            {
                _settings.AddOrUpdateValue("callerId", callerId);
                _settings.AddOrUpdateValue("activetabId", 1);
                IndexClient = new IndexClientDTO(new Guid(callerId));
                _settings.AddOrUpdateValue("myIndexId", JsonConvert.SerializeObject(IndexClient));
            }
            else
            {
                if (_settings.Contains("callerId"))
                {
                    _settings.DeleteValue("callerId");
                }
                if (_settings.Contains("activetabId"))
                {
                    _settings.DeleteValue("activetabId");
                }
            }

            if (!string.IsNullOrWhiteSpace(mode))
            {
                _settings.AddOrUpdateValue("emod", mode);
            }
            else
            {
                if (_settings.Contains("emod"))
                {
                    _settings.DeleteValue("emod");
                }
            }

            Client  = _dashboardService.LoadClient(new Guid(id));
            Modules = _dashboardService.LoadModules();

            if (null != Client)
            {
                var clientJson = JsonConvert.SerializeObject(Client);
                _settings.AddOrUpdateValue("client", clientJson);

                var clientDto     = ClientDTO.Create(Client);
                var clientDtoJson = JsonConvert.SerializeObject(clientDto);
                _settings.AddOrUpdateValue("client.dto", clientDtoJson);
            }

            if (null != Modules)
            {
                var modulesJson = JsonConvert.SerializeObject(Modules);
                _settings.AddOrUpdateValue("modules", modulesJson);
            }
        }
Exemplo n.º 4
0
        public void Init(string id, string indexId, string reltype, string enroll)
        {
            ClearCache();

            if (!string.IsNullOrWhiteSpace(indexId) && !string.IsNullOrWhiteSpace(reltype))
            {
                var indexClient    = _registryService.Find(new Guid(indexId));
                var indexClientDTO = new IndexClientDTO(new Guid(indexId), reltype);
                if (null != indexClient)
                {
                    indexClientDTO.Names      = indexClient.Person.FullName;
                    indexClientDTO.Gender     = indexClient.Person.Gender;
                    indexClientDTO.PracticeId = indexClient.PracticeId;
                }

                var json = JsonConvert.SerializeObject(indexClientDTO);
                _settings.AddOrUpdateValue(nameof(IndexClientDTO), json);

                ShowViewModel <ClientDemographicViewModel>(new { indexId = indexId });

                return;
            }

            if (!string.IsNullOrWhiteSpace(id))
            {
                Client = _registryService.Find(new Guid(id));
                if (!string.IsNullOrWhiteSpace(enroll))
                {
                    Client.PreventEnroll = false;
                    _settings.AddOrUpdateValue("PreventEnroll", "false");
                }
            }


            ShowViewModel <ClientDemographicViewModel>();
        }
        public void Init(string formId, string encounterTypeId, string mode, string clientId, string encounterId, string indexclient)
        {
            // Load Client

            Client = _dashboardService.LoadClient(new Guid(clientId));

            if (null != Client)
            {
                var clientJson = JsonConvert.SerializeObject(Client);
                _settings.AddOrUpdateValue("client", clientJson);
            }

            if (!string.IsNullOrWhiteSpace(indexclient))
            {
                IndexClient = new IndexClientDTO(new Guid(indexclient));
                _settings.AddOrUpdateValue("pclientIndex", JsonConvert.SerializeObject(IndexClient));
            }

            // Load or Create Encounter

            if (!string.IsNullOrWhiteSpace(encounterTypeId))
            {
                _settings.AddOrUpdateValue("encounterTypeId", encounterTypeId);
            }

            EncounterTypeId = new Guid(encounterTypeId);


            var hivstatus = _lookupService.GetCategoryItems("PNSKnowledgeHIVStatus", true).ToList();

            HIVStatus = hivstatus;
            _settings.AddOrUpdateValue("lookup.hivstatus", JsonConvert.SerializeObject(hivstatus));


            var pnsAccepted = _lookupService.GetCategoryItems("IPVScreening", true).ToList();

            PnsAccepted = pnsAccepted;
            _settings.AddOrUpdateValue("lookup.pnsAccepted", JsonConvert.SerializeObject(pnsAccepted));


            var ipvscreening = _lookupService.GetCategoryItems("IPVScreening", true).ToList();

            IPVScreening = ipvscreening;
            _settings.AddOrUpdateValue("lookup.ipvscreening", JsonConvert.SerializeObject(ipvscreening));

            var physicalAssult = _lookupService.GetCategoryItems("IPVScreening", true).ToList();

            PhysicalAssult = physicalAssult;
            _settings.AddOrUpdateValue("lookup.physicalAssult", JsonConvert.SerializeObject(physicalAssult));

            var threatened = _lookupService.GetCategoryItems("IPVScreening", true).ToList();

            Threatened = threatened;
            _settings.AddOrUpdateValue("lookup.threatened", JsonConvert.SerializeObject(threatened));

            var sexuallyUncomfortable = _lookupService.GetCategoryItems("IPVScreening", true).ToList();

            SexuallyUncomfortable = sexuallyUncomfortable;
            _settings.AddOrUpdateValue("lookup.sexuallyUncomfortable", JsonConvert.SerializeObject(sexuallyUncomfortable));

            var ipvoutcome = _lookupService.GetCategoryItems("IPVOutcome", true).ToList();

            IPVOutcome = ipvoutcome;
            _settings.AddOrUpdateValue("lookup.ipvoutcome", JsonConvert.SerializeObject(ipvoutcome));

            var pNsRealtionship = _lookupService.GetCategoryItems("PNSRealtionship", true).ToList();

            PNSRealtionship = pNsRealtionship;
            _settings.AddOrUpdateValue("lookup.pNSRealtionship", JsonConvert.SerializeObject(pNsRealtionship));

            var livingWithClient = _lookupService.GetCategoryItems("PNSCurrentlyLivingWithClient", true).ToList();

            LivingWithClient = livingWithClient;
            _settings.AddOrUpdateValue("lookup.livingWithClient", JsonConvert.SerializeObject(livingWithClient));

            var pNsApproach = _lookupService.GetCategoryItems("PNSApproach", true).ToList();

            PNSApproach = pNsApproach;
            _settings.AddOrUpdateValue("lookup.pNSApproach", JsonConvert.SerializeObject(pNsApproach));

            var eligibility = _lookupService.GetCategoryItems("IPVScreening", true).ToList();

            Eligibility = eligibility;
            _settings.AddOrUpdateValue("lookup.eligibility", JsonConvert.SerializeObject(eligibility));


            if (mode == "new")
            {
                //  New Encounter
                _settings.AddOrUpdateValue("client.ms.mode", "new");
                Encounter = _partnerScreeningService.StartEncounter(new Guid(formId), EncounterTypeId, Client.Id,
                                                                    AppProviderId, AppUserId, AppPracticeId, AppDeviceId, IndexClient.Id);
            }
            else
            {
                //  Load Encounter
                _settings.AddOrUpdateValue("client.ms.mode", "open");
                Encounter = _partnerScreeningService.OpenEncounter(new Guid(encounterId));
            }

            if (null == Encounter)
            {
                throw new ArgumentException("Encounter has not been Initialized");
            }
            //Store Encounter

            var encounterJson = JsonConvert.SerializeObject(Encounter);

            _settings.AddOrUpdateValue("client.encounter", encounterJson);
        }
        public ActionResult Index()
        {
            if (Request.IsAuthenticated)
            {
                if (User.IsInRole("Client"))
                {
                    var client         = GetClient();
                    var indexClientDTO = new IndexClientDTO();

                    db.Reservations
                    .Join(db.ChargingPoints,
                          reser => reser.ChargingPoint,
                          charg => charg,
                          (reser, charg) => new
                    {
                        Reser = reser,
                        Charg = charg
                    }
                          )
                    .Join(db.Stations,
                          joined => joined.Charg.Station,
                          stat => stat,
                          (joined, stat) => new
                    {
                        Joined = joined,
                        Stat   = stat
                    }
                          )
                    .OrderByDescending(e => e.Joined.Reser.Date)
                    .Where(e => e.Joined.Reser.Client.Id == client.Id)
                    .Where(e => e.Joined.Reser.Status == ConstantValues.READY)
                    .Select(e => new
                    {
                        Reservation = e.Joined.Reser,
                        StationName = e.Stat.Name
                    }).Take(5).ToList().ForEach(e => indexClientDTO.myReservations.Add(new ReservationDetailsViewModel(e.Reservation, e.StationName)));

                    db.Reservations
                    .Join(db.ChargingPoints,
                          reser => reser.ChargingPoint,
                          charg => charg,
                          (reser, charg) => new
                    {
                        Reser = reser,
                        Charg = charg
                    }
                          )
                    .Join(db.Stations,
                          joined => joined.Charg.Station,
                          stat => stat,
                          (joined, stat) => new
                    {
                        Joined = joined,
                        Stat   = stat
                    }
                          )
                    .OrderByDescending(e => e.Joined.Reser.Date)
                    .Where(e => e.Joined.Reser.Client.Id == client.Id)
                    .Where(e => e.Joined.Reser.Status == ConstantValues.DONE)
                    .Select(e => new
                    {
                        Reservation = e.Joined.Reser,
                        StationName = e.Stat.Name
                    }).Take(5).ToList().ForEach(e => indexClientDTO.reservationsHistory.Add(new ReservationDetailsViewModel(e.Reservation, e.StationName)));


                    return(View("IndexClient", indexClientDTO));
                }
                else if (User.IsInRole("Company"))
                {
                    var company = GetCompany();

                    if (company.Status == ConstantValues.ACCEPTED)
                    {
                        var myStations       = db.Stations.Where(e => e.Companies.Id == company.Id).ToList();
                        var myChargingPoints = db.ChargingPoints.Where(e => e.Station.Companies.Id == company.Id).ToList();

                        var indexCompanyDTO = new IndexCompanyDTO();
                        indexCompanyDTO.myStations       = myStations;
                        indexCompanyDTO.myChargingPoints = myChargingPoints;

                        return(View("IndexCompany", indexCompanyDTO));
                    }
                    else
                    {
                        return(View("PendingApproval"));
                    }
                }
            }


            return(View());
        }