/// <summary> /// Initializes a new instance of the <see cref="TemporalRules" /> class. /// </summary> /// <param name="cycle">The recurrence cycle for this rule (required).</param> /// <param name="days">The recurrence days for this rule.</param> /// <param name="enabled">Whether the rule is enabled.</param> /// <param name="flags">Flags set by external applications.</param> /// <param name="interval">The recurrence interval for this rule.</param> /// <param name="month">The recurrence month for this rule.</param> /// <param name="name">A friendly name for the temporal rule (required).</param> /// <param name="ordinal">The recurrence ordinal for this rule.</param> /// <param name="startDate">The date that any recurrence should be calculated as starting on.</param> /// <param name="timeWindowStart">Seconds from the start of a day to consider this rule valid.</param> /// <param name="timeWindowStop">Seconds from the start of a day to stop considering this rule valid.</param> /// <param name="wdays">The recurrence weekdays for this rule.</param> public TemporalRules(CycleEnum cycle = default(CycleEnum), List <int?> days = default(List <int?>), bool?enabled = default(bool?), List <string> flags = default(List <string>), int?interval = default(int?), int?month = default(int?), string name = default(string), OrdinalEnum?ordinal = default(OrdinalEnum?), int?startDate = default(int?), int?timeWindowStart = default(int?), int?timeWindowStop = default(int?), List <WdaysEnum> wdays = default(List <WdaysEnum>)) { // to ensure "cycle" is required (not null) if (cycle == null) { throw new InvalidDataException("cycle is a required property for TemporalRules and cannot be null"); } else { this.Cycle = cycle; } // to ensure "name" is required (not null) if (name == null) { throw new InvalidDataException("name is a required property for TemporalRules and cannot be null"); } else { this.Name = name; } this.Days = days; this.Enabled = enabled; this.Flags = flags; this.Interval = interval; this.Month = month; this.Ordinal = ordinal; this.StartDate = startDate; this.TimeWindowStart = timeWindowStart; this.TimeWindowStop = timeWindowStop; this.Wdays = wdays; }
private void Testing(CycleEnum cycleEnum) { try { testPath = ReaderWriter.ReaderWriter.CreateTestFile(testsDictionary[cycleEnum]); reader = new ReaderWriter.ReaderGraph(testPath, false); graph = reader.ReadFile(); stringBuilder.AppendLine(cycleEnum.ToString()); stringBuilder.AppendLine("Graph created."); stringBuilder.AppendLine(graph.ToString()); stringBuilder.AppendLine("Is graph cyclic: " + graph.GetGraphProperty().GetIsCyclic()); stringBuilder.AppendLine("Gridth: " + graph.GetGraphProperty().GetGirth()); } catch (KeyNotFoundException) { throw new MyException.TestsException.TestsMissingTestException(cycleEnum.ToString()); } catch (MyException.ReaderWriterException.ReaderWriterException e) { stringBuilder.AppendLine(e.Message); } }
/// <summary> /// Test a particular enum (file) /// </summary> /// <param name="cycleEnum">enum (file)</param> /// <returns>report</returns> public StringBuilder Test(CycleEnum cycleEnum) { stringBuilder.Clear(); Testing(cycleEnum); return(stringBuilder); }
public Form1() { InitializeComponent(); cycle = CycleEnum.Break; ToggleCycle(); TimerState = TimerStateEnum.Stop; alarmSound = new SoundPlayer(_25work.Properties.Resources.alarm); alarmSound.Load(); UpdateWorkTimeLabel(); }
private void ToggleCycle() { if (cycle == CycleEnum.Break) { cycle = CycleEnum.Work; } else { cycle = CycleEnum.Break; } time = Duration; infoLabel.Text = string.Format(remainingTimeString, CycleName); UpdateTimeLabel(); }
private DateTime getTime(DateTime startTime, CycleEnum cycle, int i) { switch (cycle) { case CycleEnum.Day: return(startTime.AddDays(i)); case CycleEnum.Month: return(startTime.AddMonths(i)); case CycleEnum.TwoWeek: return(startTime.AddDays(2 * 7 * i)); case CycleEnum.Week: return(startTime.AddDays(7 * i)); } return(startTime); }
void IClass.BatchBuildClass(CheckIn.Model.Class classInfo, DateTime startTime, CycleEnum cycle, int time) { for (int i = 1; i < time; i++) { Entity.ClassEntity entity = new Entity.ClassEntity(); entity.ClassLevel = classInfo.Level; entity.ClassTime = classInfo.ClassTime; entity.Description = classInfo.Description; entity.StartTime = getTime(startTime, cycle, i); entity.EndTime = entity.StartTime.AddMinutes(Common.GlobalVariable.ClassTimeMinute); entity.InputTime = DateTime.Now; entity.InputUser = classInfo.InputUser; entity.Name = classInfo.Name; entity.Teacher = classInfo.Teacher; entity.Type = classInfo.Type; _db.Save(entity); } }