Ejemplo n.º 1
0
 /// <summary>
 /// Starts a Unit of Work if one isn't already running.
 /// </summary>
 public void Start()
 {
     if (dbContext == null)
     {
         dbContext = new PVIMSDbContext();
     }
 }
Ejemplo n.º 2
0
        private void SetCustomReportMenus()
        {
            // Generate list of custom menus
            HtmlGenericControl ul = new HtmlGenericControl("ul");

            PVIMSDbContext db = new PVIMSDbContext();

            foreach (MetaReport report in db.MetaReports.OrderBy(mr => mr.Id))
            {
                HtmlGenericControl li = new HtmlGenericControl("li");
                li.Attributes.Add("id", "mnu_report" + report.Id.ToString());

                HyperLink hyp = new HyperLink()
                {
                    NavigateUrl = "/Reports/ReportViewer.aspx?id=" + report.Id.ToString()
                };
                HtmlGenericControl i = new HtmlGenericControl("i");
                i.Attributes.Add("class", "fa fa-lg fa-fw fa-bar-chart-o");
                hyp.Controls.Add(i);
                HtmlGenericControl span = new HtmlGenericControl("span");
                span.Attributes.Add("class", "menu-item-parent");
                span.InnerHtml = "&nbsp; " + report.ReportName;
                hyp.Controls.Add(span);

                li.Controls.Add(hyp);
                ul.Controls.Add(li);
            }
            db = null;

            spnCustomReportList.Controls.Add(ul);
        }
Ejemplo n.º 3
0
 public PatientsDetailQueryHandler(
     IRepositoryInt <ConditionMedDra> conditionMeddraRepository,
     IRepositoryInt <CustomAttributeConfiguration> customAttributeRepository,
     IRepositoryInt <Facility> facilityRepository,
     IRepositoryInt <Patient> patientRepository,
     IRepositoryInt <PatientCondition> patientConditionRepository,
     IRepositoryInt <SelectionDataItem> selectionDataItemRepository,
     IRepositoryInt <User> userRepository,
     PVIMSDbContext dbContext,
     ITypeExtensionHandler modelExtensionBuilder,
     ILinkGeneratorService linkGeneratorService,
     IMapper mapper,
     IHttpContextAccessor httpContextAccessor,
     ILogger <PatientsDetailQueryHandler> logger)
 {
     _conditionMeddraRepository   = conditionMeddraRepository ?? throw new ArgumentNullException(nameof(conditionMeddraRepository));
     _customAttributeRepository   = customAttributeRepository ?? throw new ArgumentNullException(nameof(customAttributeRepository));
     _facilityRepository          = facilityRepository ?? throw new ArgumentNullException(nameof(facilityRepository));
     _patientRepository           = patientRepository ?? throw new ArgumentNullException(nameof(patientRepository));
     _patientConditionRepository  = patientConditionRepository ?? throw new ArgumentNullException(nameof(patientConditionRepository));
     _selectionDataItemRepository = selectionDataItemRepository ?? throw new ArgumentNullException(nameof(selectionDataItemRepository));
     _userRepository        = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
     _context               = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     _modelExtensionBuilder = modelExtensionBuilder ?? throw new ArgumentNullException(nameof(modelExtensionBuilder));
     _linkGeneratorService  = linkGeneratorService ?? throw new ArgumentNullException(nameof(linkGeneratorService));
     _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Ejemplo n.º 4
0
        private void SetCustomPublicationMenus()
        {
            // Generate list of custom menus
            HtmlGenericControl ul = new HtmlGenericControl("ul");

            PVIMSDbContext db = new PVIMSDbContext();

            foreach (MetaPage page in db.MetaPages.Where(mp => mp.IsVisible).OrderBy(mp => mp.Id))
            {
                HtmlGenericControl li = new HtmlGenericControl("li");
                li.Attributes.Add("id", "mnu_info" + page.Id.ToString());

                HyperLink hyp = new HyperLink()
                {
                    NavigateUrl = "/Publisher/PageViewer.aspx?guid=" + page.metapage_guid.ToString()
                };
                HtmlGenericControl i = new HtmlGenericControl("i");
                i.Attributes.Add("class", "fa fa-lg fa-fw fa-files-o");
                hyp.Controls.Add(i);
                HtmlGenericControl span = new HtmlGenericControl("span");
                span.InnerHtml = "&nbsp; " + page.PageName;
                hyp.Controls.Add(span);

                li.Controls.Add(hyp);
                ul.Controls.Add(li);
            }
            db = null;

            spnCustomPublisherList.Controls.Add(ul);
        }
 public PatientExpandedByConditionTermQueryHandler(
     IRepositoryInt <CohortGroup> cohortGroupRepository,
     IRepositoryInt <CohortGroupEnrolment> cohortGroupEnrolmentRepository,
     IRepositoryInt <ConditionMedDra> conditionMeddraRepository,
     IRepositoryInt <Patient> patientRepository,
     IRepositoryInt <PatientClinicalEvent> patientClinicalEventRepository,
     IRepositoryInt <PatientCondition> patientConditionRepository,
     IRepositoryInt <PatientMedication> patientMedicationRepository,
     IRepositoryInt <SelectionDataItem> selectionDataItemRepository,
     PVIMSDbContext dbContext,
     IReportInstanceQueries reportInstanceQueries,
     ITypeExtensionHandler modelExtensionBuilder,
     ILinkGeneratorService linkGeneratorService,
     IMapper mapper,
     ILogger <PatientExpandedByConditionTermQueryHandler> logger,
     ICustomAttributeService customAttributeService)
 {
     _cohortGroupRepository          = cohortGroupRepository ?? throw new ArgumentNullException(nameof(cohortGroupRepository));
     _cohortGroupEnrolmentRepository = cohortGroupEnrolmentRepository ?? throw new ArgumentNullException(nameof(cohortGroupEnrolmentRepository));
     _conditionMeddraRepository      = conditionMeddraRepository ?? throw new ArgumentNullException(nameof(conditionMeddraRepository));
     _patientRepository = patientRepository ?? throw new ArgumentNullException(nameof(patientRepository));
     _patientClinicalEventRepository = patientClinicalEventRepository ?? throw new ArgumentNullException(nameof(patientClinicalEventRepository));
     _patientConditionRepository     = patientConditionRepository ?? throw new ArgumentNullException(nameof(patientConditionRepository));
     _patientMedicationRepository    = patientMedicationRepository ?? throw new ArgumentNullException(nameof(patientMedicationRepository));
     _selectionDataItemRepository    = selectionDataItemRepository ?? throw new ArgumentNullException(nameof(selectionDataItemRepository));
     _context = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     _reportInstanceQueries = reportInstanceQueries ?? throw new ArgumentNullException(nameof(reportInstanceQueries));
     _modelExtensionBuilder = modelExtensionBuilder ?? throw new ArgumentNullException(nameof(modelExtensionBuilder));
     _linkGeneratorService  = linkGeneratorService ?? throw new ArgumentNullException(nameof(linkGeneratorService));
     _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _customAttributeService = customAttributeService ?? throw new ArgumentNullException(nameof(customAttributeService));
 }
Ejemplo n.º 6
0
 public IntegrationEventService(
     IEventBus eventBus,
     PVIMSDbContext dbContext,
     Func <DbConnection, IIntegrationEventLogService> integrationEventLogServiceFactory,
     IntegrationEventLogContext eventLogContext,
     ILogger <IntegrationEventService> logger)
 {
     _eventBus  = eventBus ?? throw new ArgumentNullException(nameof(eventBus));
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     _integrationEventLogServiceFactory = integrationEventLogServiceFactory ?? throw new ArgumentNullException(nameof(integrationEventLogServiceFactory));
     _eventLogService = _integrationEventLogServiceFactory(_dbContext.Database.GetDbConnection());
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Ejemplo n.º 7
0
 public PatientsIdentifierQueryHandler(
     IRepositoryInt <CustomAttributeConfiguration> customAttributeRepository,
     IRepositoryInt <Facility> facilityRepository,
     PVIMSDbContext dbContext,
     ILinkGeneratorService linkGeneratorService,
     IMapper mapper,
     ILogger <PatientsIdentifierQueryHandler> logger)
 {
     _customAttributeRepository = customAttributeRepository ?? throw new ArgumentNullException(nameof(customAttributeRepository));
     _facilityRepository        = facilityRepository ?? throw new ArgumentNullException(nameof(facilityRepository));
     _context = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     _linkGeneratorService = linkGeneratorService ?? throw new ArgumentNullException(nameof(linkGeneratorService));
     _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Ejemplo n.º 8
0
 public AnalysisTermsController(IRepositoryInt <WorkFlow> workFlowRepository,
                                IRepositoryInt <TerminologyMedDra> termsRepository,
                                IRepositoryInt <RiskFactor> riskFactorRepository,
                                IMapper mapper,
                                IUnitOfWorkInt unitOfWork,
                                ILinkGeneratorService linkGeneratorService,
                                PVIMSDbContext dbContext)
 {
     _workFlowRepository   = workFlowRepository ?? throw new ArgumentNullException(nameof(workFlowRepository));
     _termsRepository      = termsRepository ?? throw new ArgumentNullException(nameof(termsRepository));
     _riskFactorRepository = riskFactorRepository ?? throw new ArgumentNullException(nameof(riskFactorRepository));
     _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _linkGeneratorService = linkGeneratorService ?? throw new ArgumentNullException(nameof(linkGeneratorService));
     _unitOfWork           = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _context = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
Ejemplo n.º 9
0
        private void SetContext()
        {
            _currentContext = CurrentContext.ccClinical;
            PVIMSDbContext db = new PVIMSDbContext();

            var user = db.Users.SingleOrDefault(u => u.UserName == HttpContext.Current.User.Identity.Name);

            if (user != null)
            {
                if (!String.IsNullOrWhiteSpace(user.CurrentContext))
                {
                    _currentContext = (CurrentContext)Convert.ToInt32(user.CurrentContext);
                }
            }
            db = null;
        }
Ejemplo n.º 10
0
        private static async Task HandleAuditedEntities(IMediator mediator, PVIMSDbContext context)
        {
            var domainEntities = context.ChangeTracker
                                 .Entries <AuditedEntityBase>()
                                 .Where(x => x.Entity.DomainEvents != null && x.Entity.DomainEvents.Any());

            var domainEvents = domainEntities
                               .SelectMany(x => x.Entity.DomainEvents)
                               .ToList();

            domainEntities.ToList()
            .ForEach(entity => entity.Entity.ClearDomainEvents());

            foreach (var domainEvent in domainEvents)
            {
                await mediator.Publish(domainEvent);
            }
        }
Ejemplo n.º 11
0
        private void SetContext()
        {
            var currentContext = "";

            if (Session["CurrentContext"] == null)
            {
                PVIMSDbContext db = new PVIMSDbContext();

                var user = db.Users.SingleOrDefault(u => u.UserName == HttpContext.Current.User.Identity.Name);
                if (user != null)
                {
                    currentContext = user.CurrentContext;
                }
                else
                {
                    currentContext = string.Empty;
                }

                db = null;
            }

            switch (currentContext)
            {
            case "Clinical":
                _currentContext = CurrentContext.ccClinical;
                break;

            case "Analytical":
                _currentContext = CurrentContext.ccAnalytical;
                break;

            case "Info":
                _currentContext = CurrentContext.ccPublication;
                break;

            case "Reports":
                _currentContext = CurrentContext.ccReporting;
                break;

            case "":
                _currentContext = CurrentContext.ccClinical;
                break;
            }
        }
Ejemplo n.º 12
0
 public EncountersDetailQueryHandler(
     IRepositoryInt <CustomAttributeConfiguration> customAttributeRepository,
     IRepositoryInt <DatasetInstance> datasetInstanceRepository,
     IRepositoryInt <Encounter> encounterRepository,
     IRepositoryInt <Facility> facilityRepository,
     PVIMSDbContext dbContext,
     ILinkGeneratorService linkGeneratorService,
     IMapper mapper,
     ILogger <EncountersDetailQueryHandler> logger)
 {
     _customAttributeRepository = customAttributeRepository ?? throw new ArgumentNullException(nameof(customAttributeRepository));
     _datasetInstanceRepository = datasetInstanceRepository ?? throw new ArgumentNullException(nameof(datasetInstanceRepository));
     _encounterRepository       = encounterRepository ?? throw new ArgumentNullException(nameof(encounterRepository));
     _facilityRepository        = facilityRepository ?? throw new ArgumentNullException(nameof(facilityRepository));
     _context = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     _linkGeneratorService = linkGeneratorService ?? throw new ArgumentNullException(nameof(linkGeneratorService));
     _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Ejemplo n.º 13
0
        private void LogAudit(AuditType type, string details, string log)
        {
            PVIMSDbContext db = new PVIMSDbContext();

            var user = db.Users.Single(u => u.Id == UserContext.Current.User.Id);

            var audit = new AuditLog()
            {
                AuditType  = type,
                User       = user,
                ActionDate = DateTime.Now,
                Details    = details,
                Log        = log
            };

            db.AuditLogs.Add(audit);
            db.SaveChanges();

            db = null;
        }
Ejemplo n.º 14
0
 public PatientService(IUnitOfWorkInt unitOfWork,
                       IRepositoryInt <Patient> patientRepository,
                       IRepositoryInt <PatientStatus> patientStatusRepository,
                       IRepositoryInt <Encounter> encounterRepository,
                       IRepositoryInt <Facility> facilityRepository,
                       IRepositoryInt <CohortGroup> cohortGroupRepository,
                       IRepositoryInt <Concept> conceptRepository,
                       IRepositoryInt <EncounterType> encounterTypeRepository,
                       IRepositoryInt <EncounterTypeWorkPlan> encounterTypeWorkPlanRepository,
                       IRepositoryInt <LabTest> labTestRepository,
                       IRepositoryInt <Dataset> datasetRepository,
                       IRepositoryInt <DatasetInstance> datasetInstanceRepository,
                       IRepositoryInt <Priority> priorityRepository,
                       IRepositoryInt <AuditLog> auditLogRepository,
                       IRepositoryInt <User> userRepository,
                       ITypeExtensionHandler modelExtensionBuilder,
                       IHttpContextAccessor httpContextAccessor,
                       PVIMSDbContext dbContext)
 {
     _patientRepository               = patientRepository ?? throw new ArgumentNullException(nameof(patientRepository));
     _patientStatusRepository         = patientStatusRepository ?? throw new ArgumentNullException(nameof(patientStatusRepository));
     _encounterRepository             = encounterRepository ?? throw new ArgumentNullException(nameof(encounterRepository));
     _facilityRepository              = facilityRepository ?? throw new ArgumentNullException(nameof(facilityRepository));
     _cohortGroupRepository           = cohortGroupRepository ?? throw new ArgumentNullException(nameof(cohortGroupRepository));
     _conceptRepository               = conceptRepository ?? throw new ArgumentNullException(nameof(conceptRepository));
     _encounterTypeRepository         = encounterTypeRepository ?? throw new ArgumentNullException(nameof(encounterTypeRepository));
     _encounterTypeWorkPlanRepository = encounterTypeWorkPlanRepository ?? throw new ArgumentNullException(nameof(encounterTypeWorkPlanRepository));
     _labTestRepository               = labTestRepository ?? throw new ArgumentNullException(nameof(labTestRepository));
     _datasetRepository               = datasetRepository ?? throw new ArgumentNullException(nameof(datasetRepository));
     _datasetInstanceRepository       = datasetInstanceRepository ?? throw new ArgumentNullException(nameof(datasetInstanceRepository));
     _priorityRepository              = priorityRepository ?? throw new ArgumentNullException(nameof(priorityRepository));
     _auditLogRepository              = auditLogRepository ?? throw new ArgumentNullException(nameof(auditLogRepository));
     _userRepository       = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
     _unitOfWork           = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork));
     _typeExtensionHandler = modelExtensionBuilder ?? throw new ArgumentNullException(nameof(modelExtensionBuilder));
     _httpContextAccessor  = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor));
     _context = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
Ejemplo n.º 15
0
        private void StoreLink(string termType, string fileName, int elementCount)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(fileName);

            string parentTermType = "";

            switch (termType)
            {
            case "HLGT":
                parentTermType = "SOC";
                break;

            case "HLT":
                parentTermType = "HLGT";
                break;

            case "PT":
                parentTermType = "HLT";
                break;

            case "LLT":
                parentTermType = "PT";
                break;

            default:
                break;
            }

            var    lineCount = 0;
            string line;

            string parentCode;
            string childCode;

            while ((line = file.ReadLine()) != null)
            {
                lineCount += 1;
                string[] array = line.Split('$');

                parentCode = "";
                childCode  = "";

                if (elementCount == 2)
                {
                    parentCode = array[0];
                    childCode  = array[1];
                }

                // Get meddra item
                // If we get here, data is fine
                PVIMSDbContext db = new PVIMSDbContext();

                var terminology = db.TerminologyMedDras.Single(tm => tm.MedDraCode == childCode && tm.MedDraTermType == termType);
                var parent      = db.TerminologyMedDras.Single(tm => tm.MedDraCode == parentCode && tm.MedDraTermType == parentTermType);
                terminology.Parent = parent;

                db.SaveChanges();
                db = null;
            }

            file.Close();
            file = null;
        }
Ejemplo n.º 16
0
        private void StoreBase(string termType, string fileName, int elementCount)
        {
            System.IO.StreamReader file = new System.IO.StreamReader(fileName);

            string parentTermType = "";

            switch (termType)
            {
            case "HLGT":
                parentTermType = "SOC";
                break;

            case "HLT":
                parentTermType = "HLGT";
                break;

            case "PT":
                parentTermType = "HLT";
                break;

            case "LLT":
                parentTermType = "PT";
                break;

            default:
                break;
            }

            var    lineCount = 0;
            string line;

            string childCode;
            string term;
            string parentCode;

            while ((line = file.ReadLine()) != null)
            {
                lineCount += 1;
                string[] array = line.Split('$');

                childCode  = "";
                term       = "";
                parentCode = "";

                if (elementCount == 2)
                {
                    childCode = array[0];
                    term      = array[1];
                }
                if (elementCount == 3)
                {
                    childCode  = array[0];
                    term       = array[1];
                    parentCode = array[2];
                }

                // If we get here, write record to database
                TerminologyMedDra terminology = null;
                TerminologyMedDra parent      = null;

                PVIMSDbContext db = new PVIMSDbContext();

                if (String.IsNullOrEmpty(parentCode))
                {
                    terminology = db.TerminologyMedDras.SingleOrDefault(tm => tm.MedDraCode == childCode);
                }
                else
                {
                    terminology = db.TerminologyMedDras.SingleOrDefault(tm => tm.MedDraCode == childCode && tm.Parent.MedDraCode == parentCode);
                    parent      = db.TerminologyMedDras.SingleOrDefault(tm => tm.MedDraCode == parentCode && tm.MedDraTermType == parentTermType);
                }

                if (terminology == null)
                {
                    // Addition
                    _additions.Add(childCode);

                    terminology = new TerminologyMedDra()
                    {
                        MedDraCode     = childCode,
                        MedDraTerm     = term,
                        MedDraTermType = termType,
                        MedDraVersion  = _version,
                        Parent         = parent
                    };
                    db.TerminologyMedDras.Add(terminology);
                }
                else
                {
                    if (terminology.MedDraTermType.ToLower().Trim() == termType.ToLower().Trim())
                    {
                        if (terminology.MedDraTerm == term)
                        {
                            _refreshCount += 1;
                        }
                        else
                        {
                            _updates.Add(childCode);
                            terminology.MedDraTermType = termType;
                            terminology.MedDraTerm     = term;
                            terminology.MedDraVersion  = _version;
                            terminology.Parent         = parent;
                        }
                    }
                    else
                    {
                        _movements.Add(childCode);
                        terminology.MedDraTermType = termType;
                        terminology.MedDraTerm     = term;
                        terminology.MedDraVersion  = _version;
                        terminology.Parent         = parent;
                    }
                }
                db.SaveChanges();
                db = null;
            } // while ((line = file.ReadLine()) != null)

            file.Close();
            file = null;
        }
Ejemplo n.º 17
0
        public string ValidateSourceData(string fileName, string subdirectory)
        {
            _subDirectory = subdirectory;

            var err = false;

            PVIMSDbContext db = new PVIMSDbContext();

            var configValue = db.Configs.Single(c => c.ConfigType == ConfigType.MedDRAVersion).ConfigValue;

            _currentVersion = !String.IsNullOrEmpty(configValue) ? configValue : "Not Set";

            db = null;

            // Validate all files exists
            err = CheckAllFilesExist();
            if (!err)
            {
                err = CheckVersion();
            }
            ;

            // **** SOC
            var file = String.Format("{0}{1}", _subDirectory, _files[5]);

            if (!err)
            {
                err = ValidateBase("SOC", file, _elements[5]);
            }
            ;

            // **** HLGT
            file = String.Format("{0}{1}", _subDirectory, _files[4]);
            if (!err)
            {
                err = ValidateBase("HLGT", file, _elements[4]);
            }
            ;

            // **** HLT
            file = String.Format("{0}{1}", _subDirectory, _files[3]);
            if (!err)
            {
                err = ValidateBase("HLT", file, _elements[3]);
            }
            ;

            // **** PT
            file = String.Format("{0}{1}", _subDirectory, _files[2]);
            if (!err)
            {
                err = ValidateBase("PT", file, _elements[2]);
            }
            ;

            // **** LLT
            file = String.Format("{0}{1}", _subDirectory, _files[1]);
            if (!err)
            {
                err = ValidateBase("LLT", file, _elements[1]);
            }
            ;

            // **** LINK PT TO HLT
            file = String.Format("{0}{1}", _subDirectory, _files[6]);
            if (!err)
            {
                err = ValidateLink("PT", file, _elements[6]);
            }
            ;

            // **** LINK HLT TO HLGT
            file = String.Format("{0}{1}", _subDirectory, _files[7]);
            if (!err)
            {
                err = ValidateLink("HLT", file, _elements[7]);
            }
            ;

            // **** LINK HLGT TO SOC
            file = String.Format("{0}{1}", _subDirectory, _files[8]);
            if (!err)
            {
                err = ValidateLink("HLGT", file, _elements[8]);
            }
            ;

            // Process response
            if (err)
            {
                _summary += String.Format("<li>ERROR: Import files not validated successfully...</li>");
            }
            else
            {
                _summary += String.Format("<li>INFO: Import files validated successfully...</li>");
            }

            return(_summary);
        }
Ejemplo n.º 18
0
        public string ImportSourceData(string fileName, string subdirectory)
        {
            _subDirectory = subdirectory;

            var ns = ""; // urn:pvims-org:v3

            XmlNode rootNode = null;
            XmlNode responseNode;
            XmlNode outerNode;
            XmlNode innerNode;

            XmlAttribute attrib;

            PVIMSDbContext db = new PVIMSDbContext();

            var configValue = db.Configs.Single(c => c.ConfigType == ConfigType.MedDRAVersion).ConfigValue;

            _currentVersion = !String.IsNullOrEmpty(configValue) ? configValue : "Not Set";

            db = null;

            // Prepare for updates
            _movements    = new ArrayList();
            _updates      = new ArrayList();
            _additions    = new ArrayList();
            _refreshCount = 0;

            // Process response
            _response = new XmlDocument();

            try
            {
                // **** SOC
                var file = String.Format("{0}{1}", _subDirectory, _files[5]);
                StoreBase("SOC", file, _elements[5]);

                // **** HLGT
                file = String.Format("{0}{1}", _subDirectory, _files[4]);
                StoreBase("HLGT", file, _elements[4]);

                // **** HLT
                file = String.Format("{0}{1}", _subDirectory, _files[3]);
                StoreBase("HLT", file, _elements[3]);

                // **** PT
                file = String.Format("{0}{1}", _subDirectory, _files[2]);
                StoreBase("PT", file, _elements[2]);

                // **** LLT
                file = String.Format("{0}{1}", _subDirectory, _files[1]);
                StoreBase("LLT", file, _elements[1]);

                // **** LINK PT TO HLT
                file = String.Format("{0}{1}", _subDirectory, _files[6]);
                StoreLink("PT", file, _elements[6]);

                // **** LINK HLT TO HLGT
                file = String.Format("{0}{1}", _subDirectory, _files[7]);
                StoreLink("HLT", file, _elements[7]);

                // **** LINK HLGT TO SOC
                file = String.Format("{0}{1}", _subDirectory, _files[8]);
                StoreLink("HLGT", file, _elements[8]);
            }
            catch (Exception ex)
            {
                rootNode         = _response.CreateElement("Status", ns);
                attrib           = _response.CreateAttribute("Code");
                attrib.InnerText = "900";
                rootNode.Attributes.Append(attrib);

                responseNode           = _response.CreateElement("Description", ns);
                responseNode.InnerText = ex.Message;
                rootNode.AppendChild(responseNode);

                _summary += String.Format("<li>ERROR: Import not completed successfully. Please see log file...</li>");

                _response.AppendChild(rootNode);

                // invalid import
                LogAudit(AuditType.InValidMedDRAImport, String.Format("Unsuccessful meddra import (version {0})", _version), _response.InnerXml);
            }
            finally
            {
                rootNode         = _response.CreateElement("Status", ns);
                attrib           = _response.CreateAttribute("Code");
                attrib.InnerText = "200";
                rootNode.Attributes.Append(attrib);

                responseNode           = _response.CreateElement("Description", ns);
                responseNode.InnerText = "Import completed successfully";
                rootNode.AppendChild(responseNode);

                outerNode = _response.CreateElement("Movements", ns);
                foreach (string item in _movements)
                {
                    innerNode        = _response.CreateElement("Movement", ns);
                    attrib           = _response.CreateAttribute("MedDRACode");
                    attrib.InnerText = item;
                    innerNode.Attributes.Append(attrib);

                    outerNode.AppendChild(innerNode);
                }
                rootNode.AppendChild(outerNode);
                _summary += String.Format("<li>INFO: # of movements processed ({0})...</li>", _movements.Count.ToString());

                outerNode = _response.CreateElement("Additions", ns);
                foreach (string item in _additions)
                {
                    innerNode        = _response.CreateElement("Addition", ns);
                    attrib           = _response.CreateAttribute("MedDRACode");
                    attrib.InnerText = item;
                    innerNode.Attributes.Append(attrib);

                    outerNode.AppendChild(innerNode);
                }
                rootNode.AppendChild(outerNode);
                _summary += String.Format("<li>INFO: # of additions processed ({0})...</li>", _additions.Count.ToString());

                outerNode = _response.CreateElement("Updates", ns);
                foreach (string item in _updates)
                {
                    innerNode        = _response.CreateElement("Update", ns);
                    attrib           = _response.CreateAttribute("MedDRACode");
                    attrib.InnerText = item;
                    innerNode.Attributes.Append(attrib);

                    outerNode.AppendChild(innerNode);
                }
                rootNode.AppendChild(outerNode);
                _summary += String.Format("<li>INFO: # of updates processed ({0})...</li>", _updates.Count.ToString());
                _summary += String.Format("<li>INFO: # of refreshes processed ({0})...</li>", _refreshCount.ToString());

                _summary += String.Format("<li>INFO: Import completed successfully. Please see log file...</li>");

                _response.AppendChild(rootNode);

                // valid import
                LogAudit(AuditType.ValidMedDRAImport, String.Format("Successful meddra import (version {0})", _version), _response.InnerXml);

                // ConfigType.MedDRAVersion
                db = new PVIMSDbContext();

                var config = db.Configs.Single(c => c.ConfigType == ConfigType.MedDRAVersion);
                config.ConfigValue = _version;
                db.SaveChanges();

                db = null;
            }

            // Clean up
            System.IO.Directory.Delete(_subDirectory, true);
            _summary += String.Format("<li>INFO: Extraction cleaned up...</li>");

            return(_summary);
        }
Ejemplo n.º 19
0
 public ExceptionMiddleware(RequestDelegate next, PVIMSDbContext _appDbContext)
 {
     _next         = next;
     _AppDbContext = _appDbContext;
 }
Ejemplo n.º 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User != null)
            {
                var portalName = string.Empty;
                // Highlight selected portal
                switch (User.CurrentContext)
                {
                case "0":
                    hrefClinical.Style["color"] = "orange";
                    portalName = Constants.Portal.Clinical + " Portal";
                    break;

                case "1":
                    hrefAnalytical.Style["color"] = "orange";
                    portalName = Constants.Portal.Analytical + " Portal";
                    break;

                case "2":
                    hrefReporting.Style["color"] = "orange";
                    portalName = Constants.Portal.Reporting + " Portal";
                    break;

                case "3":
                    hrefPublisher.Style["color"] = "orange";
                    portalName = Constants.Portal.Information + " Portal";
                    break;

                case "4":
                    hrefAdmin.Style["color"] = "orange";
                    portalName = Constants.Portal.Admin + " Portal";
                    break;

                default:
                    break;
                }
                lblPortalName.Text           = portalName;
                lblPortalName.Style["color"] = "orange";

                // Portal roles
                hrefAnalytical.Visible = HttpContext.Current.User.IsInRole(Constants.Role.PVSpecialist);
                hrefReporting.Visible  = HttpContext.Current.User.IsInRole(Constants.Role.Reporter);
                hrefPublisher.Visible  = HttpContext.Current.User.IsInRole(Constants.Role.Publisher);
                hrefAdmin.Visible      = HttpContext.Current.User.IsInRole(Constants.Role.Administrator);

                PVIMSDbContext db = new PVIMSDbContext();

                // pepare facilities
                User localUser = db.Users.Include(u => u.Facilities.Select(f => f.Facility)).SingleOrDefault(u => u.UserName == User.UserName);

                db = null;

                string facilities = "<ul>";
                foreach (UserFacility uf in localUser.Facilities)
                {
                    facilities += string.Format("<li>{0}</li>", uf.Facility.FacilityName);
                }
                facilities += "</ul>";

                // pepare roles
                string roles = "<ul>";
                if (HttpContext.Current.User.IsInRole("Admin"))
                {
                    roles += string.Format("<li>{0}</li>", "Administrator");
                }
                if (HttpContext.Current.User.IsInRole("RegClerk"))
                {
                    roles += string.Format("<li>{0}</li>", "Registration Clerk");
                }
                if (HttpContext.Current.User.IsInRole("DataCap"))
                {
                    roles += string.Format("<li>{0}</li>", "Data Capturer");
                }
                if (HttpContext.Current.User.IsInRole("Clinician"))
                {
                    roles += string.Format("<li>{0}</li>", "Clinician");
                }
                if (HttpContext.Current.User.IsInRole("Analyst"))
                {
                    roles += string.Format("<li>{0}</li>", "Analytics");
                }
                if (HttpContext.Current.User.IsInRole("Reporter"))
                {
                    roles += string.Format("<li>{0}</li>", "Reporter");
                }
                if (HttpContext.Current.User.IsInRole("Publisher"))
                {
                    roles += string.Format("<li>{0}</li>", "Publisher");
                }
                if (HttpContext.Current.User.IsInRole("ReporterAdmin"))
                {
                    roles += string.Format("<li>{0}</li>", "Reporter Administrator");
                }
                if (HttpContext.Current.User.IsInRole("PublisherAdmin"))
                {
                    roles += string.Format("<li>{0}</li>", "Publisher Administrator");
                }
                roles += "</ul>";

                HyperLink storeHyp = new HyperLink()
                {
                    NavigateUrl = "#",
                    Text        = User.UserName
                };
                storeHyp.Attributes.Add("style", "color:white");
                storeHyp.Attributes.Add("data-toggle", "modal");
                storeHyp.Attributes.Add("data-target", "#userModal");
                storeHyp.Attributes.Add("data-facility", facilities);
                storeHyp.Attributes.Add("data-role", roles);
                pnlLogin.Controls.Add(storeHyp);
            }

            ShouldPopUpBeDisplayed();
        }
Ejemplo n.º 21
0
 public MedDraService(PVIMSDbContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
Ejemplo n.º 22
0
 public ReportService(PVIMSDbContext dbContext)
 {
     _context = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
Ejemplo n.º 23
0
 public DomainRepository(PVIMSDbContext dbContext)
 {
     context = dbContext;
     dbSet   = context.Set <TEntity>();
 }
Ejemplo n.º 24
0
 public static async Task DispatchDomainEventsAsync(this IMediator mediator, PVIMSDbContext context)
 {
     await HandleEntities(mediator, context);
     await HandleAuditedEntities(mediator, context);
 }
Ejemplo n.º 25
0
 public EntityFrameworkUnitOfWork(PVIMSDbContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }