public WOData(WOMetricType WOMetric, int RecordSetCount, bool PopulateSeriesDataSets = false) { var db = new DashboardDbEntities(); SeriesDataSets = new List<List<WorkOrderMetric>>(); CollectionComparisonData = new List<WorkOrderMetric>(); var objQueryDefs = new QueryDefinitions(); var strSQL = objQueryDefs.GetQuery("SelectTopNWOAvgsByCategory", new string[] { ((char)WOMetric).ToString(), RecordSetCount.ToString() }); CollectionData = db.Database .SqlQuery<WorkOrderMetric>(strSQL) .ToList(); if (PopulateSeriesDataSets) PopulateSeriesDataSetsByCategory(); }
public InventoryData(InventoryCostGroup objInventoryCostGroup, int RecordSetCount) { SeriesDataSets = new List<List<InventoryCostMetric>>(); mobjInventoryCostGroup = objInventoryCostGroup; var db = new DashboardDbEntities(); var objQueryDefs = new QueryDefinitions(); var strSQL = objQueryDefs.GetQuery("SelectTopNInventoryCosts", new string[] { RecordSetCount.ToString() }); var CostMetrics = db.Database .SqlQuery<InventoryCostMetric>(strSQL); mobjInventoryTypes = CostMetrics .GroupBy(w => w.InventoryType) .Select(w => w.Key) .ToList(); mobjWarehouses = CostMetrics .GroupBy(w => w.Warehouse) .Select(w => w.Key) .ToList(); switch (InventoryCostGroup) { case InventoryCostGroup.InventoryType: GroupCollectionDataByInventoryType(CostMetrics); PopulateSeriesDataSetsByInventoryType(); break; case InventoryCostGroup.Warehouse: GroupCollectionDataByWarehouse(CostMetrics); PopulateSeriesDataSetsByWarehouse(); break; case InventoryCostGroup.Purchased: GetCollectionDataByInventoryType(CostMetrics, "Purchased"); break; case InventoryCostGroup.Manufactured: GetCollectionDataByInventoryType(CostMetrics, "Manufactured"); break; case InventoryCostGroup.WIP: GetCollectionDataByInventoryType(CostMetrics, "WIP"); break; case InventoryCostGroup.None: GetCollectionData(CostMetrics); break; } }