예제 #1
0
        public IList <Program> GetReportFilters(int contractId, List <Group> groups, MeasureTypes type)
        {
            HttpQueryString queryString = GetDefaultQueryString();

            // ###################################### This service NEEDS to be moved to Rest.Site!!!! ##############################################
            Uri            uri      = GetServiceRequestUri(ServiceUriFormats.ComparisonReportFilters, "Insight", new object[] { contractId, (int)type });
            List <Program> programs = PostRESTData <List <Program> >(queryString, uri, groups);

            return(programs);
        }
 /// <summary>
 /// Get field list for filter display column
 /// </summary>
 /// <param name="measureType">The measure type</param>
 /// <returns>List of key value pairs</returns>
 public IList <KeyValue> GetColumnsList(MeasureTypes measureType)
 {
     using (var context = new PDDModelDataContext())
     {
         return((from m in context.Measures
                 where m.MeasureTypeId == (int)measureType && m.IsDeleted != true
                 select new KeyValueDesc()
         {
             Key = m.MeasureID,
             Value = m.MeasureCd,
             Description = m.MeasureDesc
         }).OfType <KeyValue>().ToList());
     }
 }
예제 #3
0
        private static Measure MeasureFromReader(SqliteDataReader reader)
        {
            MeasureTypes type = MeasureTypes.GetFromId(reader.GetInt32(3));

            if (type == MeasureTypes.Predictor)
            {
                return new Predictor(DataTypes.GetFromName(reader.GetString(2)), reader.GetString(1))
                       {
                           Id = reader.GetInt32(0)
                       }
            }
            ;
            return(new Outcome(DataTypes.GetFromName(reader.GetString(2)), reader.GetString(1))
            {
                Id = reader.GetInt32(0)
            });
        }
예제 #4
0
        void Save(object sender, EventArgs e)
        {
            DataTypes    dataType    = _measureTypes.SelectedItem.Cast <DataTypes>();
            MeasureTypes type        = _measureTypes.SelectedItem.Cast <MeasureTypes>();
            TextView     measureName = FindViewById <TextView>(Resource.Id.MeasureName);
            Measure      measure;

            if (type == MeasureTypes.Outcome)
            {
                measure = new Outcome(dataType, measureName.Text);
            }
            else
            {
                measure = new Predictor(dataType, measureName.Text);
            }
            MeasureService.SaveMeasure(measure);
            Finish();
        }
        public IList <HealthBase> GetHealthData(MeasureTypes measureType, DateTime?startDate, DateTime?endDate, int timeZoneOffset)
        {
            List <HealthBase> list = null;

            if (startDate.HasValue && !endDate.HasValue)
            {
                return(list);
            }

            if (endDate.HasValue && (!startDate.HasValue))
            {
                return(list);
            }

            if (startDate != null && startDate.Value > endDate.Value)
            {
                return(list);
            }

            switch (measureType)
            {
            case MeasureTypes.AppHealth:
                return(GetApplicationHealthData(startDate, endDate, timeZoneOffset));

            case MeasureTypes.Ram:
                return(GetRamHealthData(startDate, endDate, timeZoneOffset));

            case MeasureTypes.HardDisk:
                return(GetHardDiskData(startDate, endDate, timeZoneOffset));

            case MeasureTypes.Processor:
                return(GetProcessorData(startDate, endDate, timeZoneOffset));

            case MeasureTypes.SQLServer:
                return(GetSQLServerData(startDate, endDate, timeZoneOffset));

            default:
                break;
            }

            return(list);
        }
예제 #6
0
        public static IEnumerable <Measure> GetMeasures(MeasureTypes type)
        {
            var sql = "SELECT Id, MeasureName, DataType, MeasureType FROM Measures WHERE MeasureType = @MeasureType;";

            using (var conn = GetConnection()) {
                conn.Open();

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = sql;
                    cmd.Parameters.AddWithValue("@MeasureType", type.Id);

                    using (var reader = cmd.ExecuteReader()) {
                        while (reader.Read())
                        {
                            yield return(MeasureFromReader(reader));
                        }
                    }
                }
            }
        }
예제 #7
0
        public IList <Data.Program> GetReportFilters(int contractId, List <Data.Group> groups, MeasureTypes type)
        {
            var context  = new SqlComparisonDataContext();
            var programs = (from p in context.Programs
                            from cgp in context.ContractGroupPrograms
                            from cg in context.ContractGroups
                            from c in context.Contracts
                            from g in context.Groups
                            from pc in context.ProgramConditions
                            where c.ContractId == contractId &&
                            c.ContractId == cg.ContractId &&
                            cg.ContractGroupId == cgp.ContractGroupId &&
                            cgp.ProgramId == p.ProgramId &&
                            p.ProgramId == pc.ProgramId
                            select new Data.Program
            {
                Name = p.ProgramName,
                ProgramId = p.ProgramId,
            }).Distinct().OrderBy(p => p.Name).ToList();

            foreach (Data.Program program in programs)
            {
                int programId = program.ProgramId;
                program.Groups = (from cgp in context.ContractGroupPrograms
                                  from cg in context.ContractGroups
                                  from g in context.Groups
                                  where cgp.ProgramId == programId &&
                                  cgp.ContractGroupId == cg.ContractGroupId &&
                                  cg.GroupId == g.GroupId
                                  select new Data.Group()
                {
                    GroupId = g.GroupId, Name = g.Name
                }).Distinct().OrderBy(g => g.Name)
                                 .ToList();
                foreach (Data.Group group in program.Groups)
                {
                    int groupId = group.GroupId;
                    group.Subscribers = (from sb in context.GroupSubscribers
                                         where sb.GroupId == groupId
                                         select
                                         new Data.Subscriber
                    {
                        SubscriberId = sb.SubscriberId,
                        Name = sb.Subscriber.SubscriberName
                    }).Distinct().OrderBy(
                        p => p.Name).ToList();
                }
                program.Conditions = (from pc in context.ProgramConditions
                                      where pc.ProgramId == programId
                                      select new Data.Condition {
                    ConditionId = pc.ConditionId, Name = pc.Condition.ConditionName
                }).Distinct().OrderBy(c => c.Name).ToList();
                foreach (Data.Condition condition in program.Conditions)
                {
                    int conditionId = condition.ConditionId;
                    condition.Populations = (from cp in context.ConditionPopulations
                                             where cp.ConditionId == conditionId
                                             select
                                             new Data.Population
                    {
                        PopulationId = cp.PopulationId,
                        Name = cp.Population.PopulationName
                    }).Distinct().OrderBy(
                        p => p.Name).ToList();
                    foreach (Data.Population population in condition.Populations)
                    {
                        int populationId = population.PopulationId;
                        population.Measures = (from m in context.Measures
                                               where
                                               m.ConditionPopulation.PopulationId == populationId &&
                                               m.ConditionPopulation.ConditionId == conditionId
                                               select new Data.Measure
                        {
                            MeasureId = m.MeasureId,
                            Name = m.MeasureName
                        }).Distinct().OrderBy(m => m.Name).ToList();
                    }
                }
            }
            return(programs);
        }
예제 #8
0
 public static IList <Measure> GetMeasures(MeasureTypes type)
 {
     return(new List <Measure>(MeasureRepository.GetMeasures(type)));
 }