public GenericHours(Operatinghour operatinghour) { this.wednesday = operatinghour.standardHours.wednesday; this.monday = operatinghour.standardHours.monday; this.thursday = operatinghour.standardHours.thursday; this.sunday = operatinghour.standardHours.sunday; this.tuesday = operatinghour.standardHours.tuesday; this.friday = operatinghour.standardHours.friday; this.saturday = operatinghour.standardHours.saturday; this.name = operatinghour.name; this.description = operatinghour.description; this.isException = false; }
private void AddOperatingHours(int parkId, Operatinghour operatingHours, SqlConnection connection) { List <GenericHours> FlattenedHours = new List <GenericHours>(FlattenHours(operatingHours)); foreach (GenericHours hours in FlattenedHours) { string cmdText = "AddOperatingHours"; SqlCommand command = new SqlCommand(); command.CommandText = cmdText; command.Connection = connection; command.CommandType = System.Data.CommandType.StoredProcedure; AddOperatingHoursParameters(parkId, hours, command); command.ExecuteNonQuery(); } }
private IEnumerable <GenericHours> FlattenHours(Operatinghour operatinghour) { List <GenericHours> hours = new List <GenericHours>(); hours.Add(new GenericHours(operatinghour)); if (operatinghour.exceptions != null && operatinghour.exceptions.Length > 0) { foreach (Exception exception in operatinghour.exceptions) { hours.Add(new GenericHours(exception)); } } return(hours); }