Пример #1
0
        private void PopulateMinMaxTables(AdditionPlanDataAccess dataAccess, int scenarioId, AutoGrid gridToUpdate)
        {
            var minMaxValues = dataAccess.GetAdditionPlanMinMaxRows(scenarioId);

            var additionPlan = dataAccess.GetAdditionPlan(scenarioId);

            if (rbAScenario.Checked)
            {
                rbAScenario.Text         = additionPlan.Name;
                lblMaxScenASelected.Text = additionPlan.MaxFleetScenarioName;
                lblMinScenASelected.Text = additionPlan.MinComSegScenarioName;
            }
            else
            {
                rbBScenario.Text         = additionPlan.Name;
                lblMaxScenBSelected.Text = additionPlan.MaxFleetScenarioName;
                lblMinScenBSelected.Text = additionPlan.MinComSegScenarioName;
            }

            gridToUpdate.GridData = minMaxValues.ToList();
            gridToUpdate.Visible  = true;
        }
Пример #2
0
        private void PopulateAdditionTables(AdditionPlanDataAccess dataAccess, LocationLevelGroupings locationGrouping
                                            , VehicleLevelGrouping vehicleGrouping, int scenarioId, AutoGrid gridToUpdate, bool scenarioASelected)
        {
            var additionData = dataAccess.GetAdditionPlanEntryEntries(scenarioId, locationGrouping, vehicleGrouping);

            var additionPlan = dataAccess.GetAdditionPlan(scenarioId);

            var bottomLevelGrouping = locationGrouping == LocationLevelGroupings.Location &&
                                      vehicleGrouping == VehicleLevelGrouping.CarGroup;

            gridToUpdate.HideLastColumn = !bottomLevelGrouping;


            if (scenarioASelected)
            {
                rbAScenario.Text         = additionPlan.Name;
                lblMaxScenASelected.Text = additionPlan.MaxFleetScenarioName;
                lblMinScenASelected.Text = additionPlan.MinComSegScenarioName;
            }
            else
            {
                rbBScenario.Text         = additionPlan.Name;
                lblMaxScenBSelected.Text = additionPlan.MaxFleetScenarioName;
                lblMinScenBSelected.Text = additionPlan.MinComSegScenarioName;
            }

            var additionEntities = from ad in additionData
                                   select new AdditionEntity
            {
                Year         = ad.Year,
                IsoWeek      = ad.IsoWeek,
                CarGroupId   = ad.CarGroupId,
                LocationId   = ad.LocationId,
                CarGroup     = ad.CarGroup,
                Location     = ad.Location,
                Amount       = ad.Amount,
                Contribution = (double)ad.CpU
            };

            gridToUpdate.GridData = additionEntities.ToList();
            gridToUpdate.Visible  = true;
        }