コード例 #1
0
        private void PopulateAdditionPlanData()
        {
            var parameters = new Dictionary <DictionaryParameter, string>();

            using (var dataAccess = new AdditionPlanDataAccess(parameters))
            {
                var additionData = dataAccess.GetAdditionPlanEntryEntries(SelectedScenarioId, LocationLevelGroupings.Location, VehicleLevelGrouping.CarGroup);

                var additionPlan = dataAccess.GetAdditionPlan(SelectedScenarioId);

                SwitchApplyUnApplyButtons(additionPlan.Applied);


                lblUpdateLessonLabel.Text       = string.Format(hfUpdateLessonLabel.Value, additionPlan.Name);
                lblAdditionPlanDateCreated.Text = additionPlan.DateCreated.ToString("dd/MM/yyyy HH:mm");
                lblAdditionPlanName.Text        = additionPlan.Name;
                tbUpdatedLesson.Text            = additionPlan.LessonLearnt;
                tbLessonsLearnt.Text            = additionPlan.LessonLearnt;

                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
                };
                agAdditionPlanDetails.GridData = additionEntities.ToList();
            }
        }
コード例 #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;
        }