added copy template function
This commit is contained in:
parent
1ac6cc64a6
commit
83f9b2d0b8
4 changed files with 41 additions and 4 deletions
|
@ -18,7 +18,7 @@ namespace Lieb.Models.GuildWars2.Raid
|
|||
|
||||
public Raid() { }
|
||||
|
||||
public Raid(RaidTemplate template) : base(template, template.TimeZone)
|
||||
public Raid(RaidTemplate template) : base(template, template.TimeZone, true)
|
||||
{
|
||||
TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(template.TimeZone);
|
||||
StartTimeUTC = TimeZoneInfo.ConvertTimeToUtc(template.StartTime, timeZone);
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace Lieb.Models.GuildWars2.Raid
|
|||
|
||||
public RaidBase() { }
|
||||
|
||||
public RaidBase(RaidBase template, string timeZoneString)
|
||||
public RaidBase(RaidBase template, string timeZoneString, bool convertTimeForRaid)
|
||||
{
|
||||
this.Title = template.Title;
|
||||
this.Description = template.Description;
|
||||
|
@ -88,11 +88,17 @@ namespace Lieb.Models.GuildWars2.Raid
|
|||
TimeZoneInfo timeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneString);
|
||||
foreach (RaidReminder reminder in template.Reminders)
|
||||
{
|
||||
DateTimeOffset reminderTime = reminder.ReminderTimeUTC;
|
||||
if(convertTimeForRaid)
|
||||
{
|
||||
reminderTime = TimeZoneInfo.ConvertTimeToUtc(reminder.ReminderTimeUTC.DateTime, timeZone);
|
||||
}
|
||||
|
||||
this.Reminders.Add(new RaidReminder()
|
||||
{
|
||||
DiscordServerId = reminder.DiscordServerId,
|
||||
DiscordChannelId = reminder.DiscordChannelId,
|
||||
ReminderTimeUTC = TimeZoneInfo.ConvertTimeToUtc(reminder.ReminderTimeUTC.DateTime, timeZone),
|
||||
ReminderTimeUTC = reminderTime,
|
||||
Message = reminder.Message,
|
||||
Sent = false,
|
||||
Type = reminder.Type,
|
||||
|
|
|
@ -19,5 +19,17 @@ namespace Lieb.Models.GuildWars2.Raid
|
|||
public int Interval { get; set; }
|
||||
|
||||
public int CreateDaysBefore { get; set; }
|
||||
|
||||
public RaidTemplate() { }
|
||||
|
||||
public RaidTemplate(RaidTemplate template) : base(template, template.TimeZone, false)
|
||||
{
|
||||
StartTime = template.StartTime;
|
||||
EndTime = template.EndTime;
|
||||
FreeForAllTime = template.FreeForAllTime;
|
||||
TimeZone = template.TimeZone;
|
||||
Interval = template.Interval;
|
||||
CreateDaysBefore = template.CreateDaysBefore;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue