public void Run(params string[] args) { PhoneSystem ps = PhoneSystem.Root; Tenant tadd = ps.GetTenants()[0]; if (tadd != null) { System.Collections.Generic.List <HoursRange> arr = new System.Collections.Generic.List <HoursRange>(); HoursRange r = tadd.CreateHoursRange(); r.DayOfWeek = System.DayOfWeek.Monday; r.StartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 0, 0); r.EndTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, 0, 0); arr.Add(r); r = tadd.CreateHoursRange(); r.DayOfWeek = System.DayOfWeek.Tuesday; r.StartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 0, 0); r.EndTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 17, 0, 0); arr.Add(r); tadd.OfficeHoursRanges = arr.ToArray(); tadd.Save(); } }