示例#1
0
        private FieldsStage BuildFieldStage(AgriculturalStageEnum id, DateTime date, TimeSpan duration)
        {
            var isCurrent = date <= DateTime.Now && date + duration > DateTime.Now;

            return(new FieldsStage
            {
                Id = id,
                StartDate = date,
                Duration = duration,
                IsCurrent = isCurrent
            });
        }
示例#2
0
        public void UpdateField(Guid id, int cultureId, AgriculturalStageEnum stage, DateTime startDate)
        {
            var field   = GetField(id);
            var culture = _cropData.Crops.FirstOrDefault(c => c.Id == cultureId);

            field.Culture = culture.Name;

            var currentStage = new FieldsStage
            {
                Id        = stage,
                StartDate = startDate,
                IsCurrent = true
            };
            var stages = _fieldsStageService.CalculateStagesFromCurrent(field.FieldsStages, currentStage);

            field.FieldsStages = stages;

            _fieldsRepository.UpdateField(field);
        }
示例#3
0
 public FieldsStage GetNextStage(List <FieldsStage> stages, AgriculturalStageEnum currentStageId)
 {
     throw new NotImplementedException();
 }