private BrewLogStep AddStep(BrewLog log, StepDto step) { var brewStep = new BrewLogStep { BrewLog = log, Order = step.Order, Name = step.Name, StartTime = DateTime.Now, 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 targetTemp = GetTargetTemp(); targetTemp.Target1 = brewStep.TargetMashTemp; targetTemp.Target2 = brewStep.TargetSpargeTemp; }
private StepDto GetNextStep(BrewLogStep brewLogStep) { return GetStepDto(_db.BrewStepTemplates.Where(x => x.Id > brewLogStep.Order).First(), brewLogStep.BrewLog); }