Example #1
0
        public FullMonographSectionFactory(string countryCode, IConfiguration config)
        {
            _country = ConnectionStringManager.GetCountryNames()[countryCode];
            string connectionString = config.GetConnectionString(countryCode);

            _connection = new SqliteConnection(connectionString);

            string selectOne = string.Empty;

            if (AppSettings.ForCacheGeneration)
            {
                selectOne = "LIMIT 1";
            }

            string query = @"select distinct m.Id, 
                                    m.MonographName, 
                                    b.BrandName as Name,
                                    m.Dosage,
                                    m.ContraIndication, 
                                    m.SpecialPrecaution, 
                                    m.AdverseReaction,
                                    m.Interaction,
                                    m.Description,
                                    m.Action,
                                    m.Indication,
                                    m.OverDosage,
                                    m.Warning,
                                    m.Precaution,
                                    m.Storage,
                                    m.SideEffect,
                                    m.Pharmacodynamics,
                                    m.UseInChildren,
                                    m.UseInElderly,
                                    m.UseInPregnancyLactation,
                                    m.Pharmacokinetics,
                                    m.PackingAndPrice,
                                    m.PatientCounsellingInformation
									from MONOGRAPH m
									join REL_PRODUCT_MONOGRAPH pm on m.Id = pm.MonographId
									join PRODUCT p on pm.ProductId = p.Id
									join BRAND b on p.BrandId = b.Id
									join CODETABLE c on m.MonographType = c.Id
                                    where m.MonographType = 6001						
									order by m.Id  {0}"                                    ;

            query = string.Format(query, selectOne);

            _connection.Open();
            _fullMonographDict = (IList <object>)_connection.Query <object>(query);


            //Added this function to sync with the mims.com logic
            GetMappingMonographOriginalNameToAlias(countryCode);
            GetMappingBrandOriginalNameToAlias(countryCode);
        }
        public CompanyUrlFactory(string countryCode, IConfiguration config)
        {
            _country = ConnectionStringManager.GetCountryNames()[countryCode];
            string connectionString = config.GetConnectionString(countryCode);

            _connection = new SqliteConnection(connectionString);

            string query = @"select distinct Name as CompanyName from Company where Name is not null and LocalizationReference is null";

            _connection.Open();
            _companyDict = (IList <CompanyUrl>)_connection.Query <CompanyUrl>(query);
            //Added this function to sync with the mims.com logic
            GetMappingCompanyOriginalNameToAlias(countryCode);
        }
        public PatientMedInfoUrlFactory(string countryCode, IConfiguration config)
        {
            _country = ConnectionStringManager.GetCountryNames()[countryCode];
            string connectionString = config.GetConnectionString(countryCode);

            _connection = new SqliteConnection(connectionString);

            string query = @"select  distinct pmi.Description from PatientMedInfo pmi inner join Generic g
		                                    on pmi.GenericId = g.Id
                                    where pmi.LocalizationReference is null";

            _connection.Open();
            _patientMedInfoDict = (IList <PatientMedInfoUrl>)_connection.Query <PatientMedInfoUrl>(query);
        }
        public DrugImageUrlFactory(string countryCode, IConfiguration config)
        {
            _country = ConnectionStringManager.GetCountryNames()[countryCode];
            string connectionString = config.GetConnectionString(countryCode);

            _connection = new SqliteConnection(connectionString);


            string query = @"select distinct d.Id as DrugImageId, d.Strength as ProductStrength, p.ProductName 
                                    from DRUGIMAGE d
                                    left outer join PRODUCT p on d.ProductId = p.Id
                                    order by d.Id"                    ;

            _connection.Open();
            _drugImageDict = (IList <DrugImageUrl>)_connection.Query <DrugImageUrl>(query);

            //Added this function to sync with the mims.com logic
            GetMappingProductOriginalNameToAlias(countryCode);
            GetMappingStrengthOriginalNameToAlias(countryCode);
        }
        public MonographUrlFactory(string countryCode, IConfiguration config)
        {
            _country = ConnectionStringManager.GetCountryNames()[countryCode];
            string connectionString = config.GetConnectionString(countryCode);

            _connection = new SqliteConnection(connectionString);
            string selectOne = string.Empty;

            if (AppSettings.ForCacheGeneration)
            {
                selectOne = "LIMIT 1";
            }

            string query = @"select * from (select distinct  m.Id, m.MonographName, b.BrandName as Name, c.Value as UrlType 
									from MONOGRAPH m
									join REL_PRODUCT_MONOGRAPH pm on m.Id = pm.MonographId
									join PRODUCT p on pm.ProductId = p.Id
									join BRAND b on p.BrandId = b.Id
									join CODETABLE c on m.MonographType = c.Id  {0})
                                    union									

                              select * from (select distinct  m.Id, m.MonographName, g.GenericName as Name, c.Value as UrlType 
																		from MONOGRAPH m
																		join rel_Generic_Monograph gm on m.Id = gm.MonographId
																		join Generic g on gm.GenericId = g.Id
																		join CODETABLE c on m.MonographType = c.Id {0})
																		
                                    Order by id";

            query = string.Format(query, selectOne);

            _connection.Open();
            _brandMonographDict = (IList <Monograph>)_connection.Query <Monograph>(query);

            //Added this function to sync with the mims.com logic
            GetMappingMonographOriginalNameToAlias();
            GetMappingBrandOriginalNameToAlias();
        }