private string GetDisplayTimeString(BrewLogStep step)
        {
            var timeToShow = "";

            if (step != null)
            {
                if (step.CompleteTime.HasValue)
                {
                    timeToShow = step.CompleteTime.Value.Subtract(DateTime.UtcNow).ToString("c").Substring(0, 8);
                }
                else
                {
                    timeToShow = DateTime.UtcNow.Subtract(step.StartTime).ToString("c").Substring(0, 8);
                }
            }
            else
            {
                timeToShow = DateTime.UtcNow.AddHours(2).ToString("HH:mm:ss");
            }

            return timeToShow;
        }
示例#2
0
        private BrewLogStep AddStep(BrewLog log, StepDto step)
        {
            var brewStep = new BrewLogStep
            {
                BrewLog = log,
                Order = step.Order,
                Name = step.Name,
                StartTime = DateTime.UtcNow,
                CompleteTime = step.CompleteTime,
                TargetMashTemp = step.TargetMashTemp,
                TargetSpargeTemp = step.TargetSpargeTemp,
                CompleteButtonText = step.CompleteButtonText,
                Instructions = step.Instructions,
                ShowTimer = step.ShowTimer
            };
            _db.Add(brewStep);

            ApplyStepTemperature(brewStep);

            //Add DataCapture values
            var dataCaptureValues = _db.DataCaptureDefinitions.Where(x => x.BrewStepTemplateId == step.Order);
            foreach (var v in dataCaptureValues)
            {
                if (v.ValueType == "float")
                {
                    _db.Add(new DataCaptureFloatValue
                    {
                        BrewLogStep = brewStep,
                        Label = v.Label,
                        Optional = v.Optional,
                        Units = v.Units
                    });
                }
                else if (v.ValueType == "int")
                {
                    _db.Add(new DataCaptureIntValue
                    {
                        BrewLogStep = brewStep,
                        Label = v.Label,
                        Optional = v.Optional,
                        Units = v.Units
                    });
                }
                else if (v.ValueType == "string")
                {
                    _db.Add(new DataCaptureStringValue
                    {
                        BrewLogStep = brewStep,
                        Label = v.Label,
                        Optional = v.Optional,
                        Units = v.Units
                    });
                }
            }

            return brewStep;
        }
示例#3
0
 private void ApplyStepTemperature(BrewLogStep brewStep)
 {
     var runtimeValues = GetRuntimeValues();
     runtimeValues.TargetTemp1 = brewStep.TargetMashTemp;
     runtimeValues.TargetTemp2 = brewStep.TargetSpargeTemp;
 }
示例#4
0
 private StepDto GetNextStep(BrewLogStep brewLogStep)
 {
     return GetStepDto(_db.BrewStepTemplates.Where(x => x.Id > brewLogStep.Order).First(), brewLogStep.BrewLog);
 }