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; }
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; }
private void ApplyStepTemperature(BrewLogStep brewStep) { var runtimeValues = GetRuntimeValues(); runtimeValues.TargetTemp1 = brewStep.TargetMashTemp; runtimeValues.TargetTemp2 = brewStep.TargetSpargeTemp; }
private StepDto GetNextStep(BrewLogStep brewLogStep) { return GetStepDto(_db.BrewStepTemplates.Where(x => x.Id > brewLogStep.Order).First(), brewLogStep.BrewLog); }