public static async Task <string> SyncAllRemind(MyRemind remind) { id = ""; if (remind.Time != null) { int min = int.Parse(remind.Time) % 60; int hour = int.Parse(remind.Time) / 60; int day = hour / 24; TimeSpan beforeTime = new TimeSpan(day, hour, min, 0); List <SelectedWeekNum> weeklist = new List <SelectedWeekNum>(); foreach (var item in remind.DateItems) { var itemWeekList = item.Week.Split(','); var itemClassList = int.Parse(item.Class); var itemDayList = int.Parse(item.Day); TimeSet classTime = new TimeSet(); classTime.Set(itemClassList); for (int i = 0; i < itemWeekList.Count(); i++) { SelectedWeekNum swn = new SelectedWeekNum(); swn.SetWeekTime(int.Parse(itemWeekList[i]) - 1); remind.time = swn.WeekNumOfMonday.AddDays(itemDayList) + classTime.Time - beforeTime; if (remind.time.Ticks < DateTime.Now.Ticks) { } else { AddRemind(remind); } } } } return(id); }
public static async Task<string> SyncAllRemind(MyRemind remind) { id = ""; if (remind.Time != null) { int min = int.Parse(remind.Time) % 60; int hour = int.Parse(remind.Time) / 60; int day = hour / 24; TimeSpan beforeTime = new TimeSpan(day, hour, min, 0); List<SelectedWeekNum> weeklist = new List<SelectedWeekNum>(); foreach (var item in remind.DateItems) { var itemWeekList = item.Week.Split(','); var itemClassList = int.Parse(item.Class); var itemDayList = int.Parse(item.Day); TimeSet classTime = new TimeSet(); classTime.Set(itemClassList); for (int i = 0; i < itemWeekList.Count(); i++) { SelectedWeekNum swn = new SelectedWeekNum(); swn.SetWeekTime(int.Parse(itemWeekList[i]) - 1); remind.time = swn.WeekNumOfMonday.AddDays(itemDayList) + classTime.Time - beforeTime; if (remind.time.Ticks < DateTime.Now.Ticks) { } else { AddRemind(remind); } } } } return id; }