static SportEvent GetRandomRecurrenceSportEvent(int id, DateTime startDate, SportChannel channel, int dayCount) { SportEvent pattern = new SportEvent(); pattern.Id = id; TimeSpanRange newsTimeRange = channel.NewsTimeRange; pattern.StartTime = startDate + newsTimeRange.Start; pattern.EndTime = startDate + newsTimeRange.End; pattern.SportId = 0; pattern.ChannelId = channel.Id; pattern.Caption = "Sport News"; pattern.Location = "New York City, USA"; pattern.Type = (int)AppointmentType.Pattern; RecurrenceInfo recInfo = new RecurrenceInfo(); recInfo.Start = pattern.StartTime; recInfo.End = pattern.EndTime.AddDays(dayCount); recInfo.WeekDays = WeekDays.WorkDays; recInfo.Range = RecurrenceRange.EndByDate; recInfo.Type = RecurrenceType.Daily; pattern.RecurrenceInfo = String.Format(CultureInfo.InvariantCulture, recurrenceInfoFormat, recInfo.Start, recInfo.End, (int)recInfo.WeekDays, recInfo.OccurrenceCount, (int)recInfo.Range, (int)recInfo.Type, recInfo.Id.ToString()); return(pattern); }
static SportEvent GetRandomSportEvent(int id, DateTime start, DateTime end, int channelId) { var res = new SportEvent(); res.Id = id; res.StartTime = start; res.EndTime = end; res.SportId = rnd.Next(1, 10); res.ChannelId = channelId; res.Caption = GetRandomString(GetEvents(res.SportId)); res.Location = GetRandomString(GetLocations(res.SportId)); res.Description = GetRandomString(GetDescriptions(res.SportId)); res.Type = 0; return(res); }