Example #1
0
        static List <MetricValue> GetValues(LinqMicajahDataContext dc, Guid InstanceId, Guid MetricID, Guid?OrgLocationID, DateTime BeginDate, DateTime?EndDate)
        {
            if (OrgLocationID == null)
            {
                OrgLocationID = Guid.Empty;
            }

            var values = (from h in dc.ViewHierarchyOrgLocation
                          join mo in dc.ViewMetricOrgLocation on new { InstanceId = (Guid?)InstanceId, MetricID = (Guid?)MetricID, OrgLocationID = (Guid?)h.SubOrgLocationID } equals new { mo.InstanceId, mo.MetricID, mo.OrgLocationID }
                          join v in dc.MetricValue on new { MetricID, OrgLocationID = (Guid?)h.SubOrgLocationID, Status = (bool?)true } equals new { v.MetricID, OrgLocationID = (Guid?)v.OrgLocationID, v.Status }
                          where h.InstanceId == InstanceId && h.OrgLocationID == OrgLocationID &&
                          (dc.FxGetNextPeriodDate(v.FrequencyID, v.Date) > BeginDate &&
                           (
                               (EndDate == null && v.Date <= BeginDate)
                               ||
                               (EndDate != null && v.Date < EndDate)
                           )
                          )
                          select v)
                         .ToList();

            return(values);
        }
Example #2
0
        static List <MetricValue> GetValue(LinqMicajahDataContext dc, Guid InstanceId, Guid MetricID, Guid?OrgLocationID, DateTime BeginDate, DateTime?EndDate)
        {
            Guid _OrgLocationID = Guid.Empty;

            if (OrgLocationID != null)
            {
                _OrgLocationID = (Guid)OrgLocationID;
            }

            var values = (from mo in dc.ViewMetricOrgLocation
                          join v in dc.MetricValue on new { MetricID, OrgLocationID = _OrgLocationID, Status = (bool?)true } equals new { v.MetricID, v.OrgLocationID, v.Status }
                          where mo.InstanceId == InstanceId && mo.OrgLocationID == OrgLocationID && mo.MetricID == MetricID &&
                          (dc.FxGetNextPeriodDate(v.FrequencyID, v.Date) > BeginDate &&
                           (
                               (EndDate == null && v.Date <= BeginDate)
                               ||
                               (EndDate != null && v.Date < EndDate)
                           )
                          )
                          select v)
                         .ToList();

            return(values);
        }