private void UpdateCurrentDailyStandardMeasure(LoadDailyStandardMeasures firstWeek)
        {
            _currentDailyStandardMeasure = firstWeek;

            gvDailyMeasures.DataSource = firstWeek.DailyStandardMeasures;

            ShowHideFoodClassColumn();
        }
        private void FrmEnterDailyMeasures_Load(object sender, EventArgs e)
        {
            lbCurrentStandard.Text = String.Format("Indicador: {0}: {1}   |    Etapa: {2}",
                                                Resources.Standard,
                                                _stateController.CurrentSelectedStandard.Name.ToUpper(),
                                                _stateController.CurrentSelectedBatch.StageName.ToUpper());

            var geneticLineId = _stateController.CurrentSelectedBatch.GeneticLineId;
            var stageId = _stateController.CurrentSelectedBatch.StageId;
            var standardId = _stateController.CurrentSelectedStandard.Id;
            var batchId = _stateController.CurrentSelectedBatch.Id;
            var batchDateOfBirth = _stateController.CurrentSelectedBatch.DateOfBirth;

            using (var standardItemService = _serviceFactory.Create<IStandardItemService>())
            {
                using (var measureService = _serviceFactory.Create<IMeasureService>())
                {
                    var items = standardItemService.GetByStandardAndGeneticLine(standardId, stageId.GetValueOrDefault(), geneticLineId);

                    var measures = measureService.GetByStandardAndBatch(standardId, batchId);

                    var model = new List<LoadDailyStandardMeasures>();

                    DateTime endDate;

                    using (var batchService = _serviceFactory.Create<IBatchService>())
                    {
                        endDate = batchService.GetEndDateById(batchId);
                    }

                    foreach (var item in items)
                    {
                        var dailyLoad = new LoadDailyStandardMeasures();

                        dailyLoad.Week = item.Sequence;
                        dailyLoad.DailyStandardMeasures = new List<DailyStandardMeasure>();

                        for (var i = 0; i < 7; i++)
                        {
                            var measureDate = batchDateOfBirth.AddDays((item.Sequence - 1) * 7 + i);
                            if (measureDate.Date < endDate.Date)
                            {
                                var measure = measures.Where(m => !m.StandardItem.IsDeleted)
                                            .FirstOrDefault(x => x.StandardItemId == item.Id
                                                            && x.Date == measureDate.Date);

                                var measureModel = new DailyStandardMeasure()
                                {
                                    StandardItemId = item.Id,
                                    MeasureId = measure == null ? Guid.Empty : measure.Id,
                                    Date = measureDate,
                                    Day = (item.Sequence - 1) * 7 + i + 1,
                                    Value = measure == null ? (decimal?)null : measure.Value,
                                    FoodClassId = measure == null ? (Guid?)null : measure.FoodClassId
                                };

                                dailyLoad.DailyStandardMeasures.Add(measureModel);
                            }
                        }

                        model.Add(dailyLoad);
                    }

                    ucLoadDailyMeasures.Standard = _stateController.CurrentSelectedStandard;
                    ucLoadDailyMeasures.LoadDailyStandardMeasures = model;
                    ucLoadDailyMeasures.CurrentWeek = _stateController.CurrentSelectedBatch.Week;
                }
            }
        }