public CyclicDayProgramView(CyclicDayProgram setting) { if (setting == null) { return; } StartDate = TimeConvertor.GetTicks(setting.StartDate); DaysInterval = setting.DaysInterval; }
public ProgramSettingView(ProgramSetting setting, WeeklyProgramSetting Weeklysetting, CyclicDayProgram cSetting, ExecutionHours[] executionHours, ZoneInProgram[] zones) { Name = setting.Name; ProgramType = (WaterProgramType)setting.WaterUnitID; ProgramID = setting.ProgramID; ProgramNumber = setting.ProgramNumber; Priority = setting.Priority; ConfigID = setting.ConfigID; IsFertilizerON = setting.IsFertilizerON; Status = (StatusType)setting.StatusID; FertExecutionType = (FertExecutionType)setting.FertUnitID; WaterFactor = setting.WaterFactor; HoursExecution = (HoursExecutionType)setting.HoursExecutionsTypeID; DaysExecutionType = (DaysExecutionType)setting.DaysExecutionsTypeID; Advanced = new AdvancedProgramSettingView() { FinalEndDateLimit = setting.FinalEndDateLimit.HasValue ? (long?)TimeConvertor.GetTicks(setting.FinalEndDateLimit.Value) : null, FinalStartDateLimit = setting.FinalStartDateLimit.HasValue ? (long?)TimeConvertor.GetTicks(setting.FinalStartDateLimit.Value) : null, FinalStartHoursLimit = setting.FinalStartHoursLimit, FinalStopHoursLimit = setting.FinalStopHoursLimit }; HourlyCycle = new HourlyCycleView() { HourlyCyclesPerDay = setting.HourlyCyclesPerDay, HourlyCyclesStartTime = setting.HourlyCyclesStartTime, HourlyCycleTime = setting.HourlyCycleTime, HourlyCyclesStopTime = setting.FinalStopHoursLimit }; WeeklyDaysProgram = new ValidDaysView(Weeklysetting); CyclicDayProgram = new CyclicDayProgramView(cSetting); ExecutionHours = executionHours.Select(e => e.ExecTime).ToArray(); ZoneInProgram = zones.Select(z => new ZoneInProgramView(z)).ToArray(); }