private async void LoadFinised(object sender, DownloadStringCompletedEventArgs e) { bool scheduleFileExists = await ApplicationData.Current.LocalFolder.FileExists("schedule.txt"); WebSchedule ws = JsonConvert.DeserializeObject <WebSchedule>(e.Result); schedule = Schedule.FromWebSchedule(ws); await schedule.SaveScheduleToFile(); var scheduleTime = DateTime.Now.ToString("dd.MM.yyyy H:mm:ss"); await FileExtensions.WriteDataToFileAsync("scheduleDateTime.txt", scheduleTime); if (!netAvailable) { if (scheduleFileExists) { ShowLoading(); schedule = await Schedule.LoadScheduleFromFile(); } else { mainPivot.Title = "Нет сети"; return; } } ReadyToShow(); SetGroupAndShow(); }
public ActionResult Edit(WebSchedule schedule) { ScheduleDTO scheduleDTO = new ScheduleDTO() { ScheduleID = schedule.ScheduleID, CoursID = schedule.CoursID, StartDate = schedule.StartDate, EndDate = schedule.EndDate }; if (ModelState.IsValid) { scheduleService.AddOrUpdate(scheduleDTO); return(RedirectToAction("Detail", "Course", new { id = scheduleDTO.CoursID })); } //Prepare DropDown list for days ViewBag.DayDDL = new SelectList(getWeekDays(), "DayNumber", "DayName", schedule.DayOfWeek); //Prepare DropDown list for hours ViewBag.HoursSLI = getHours(); //Prepare DropDown list for minutes ViewBag.MinutesSLI = new[] { new SelectListItem { Value = "0", Text = "00" }, new SelectListItem { Value = "15", Text = "15" }, new SelectListItem { Value = "30", Text = "30" }, new SelectListItem { Value = "45", Text = "45" } }; //Information about course ViewBag.Course = courseService.Get(schedule.CoursID); return(View(schedule)); }
public ActionResult Edit(int courseID, int id = 0) { ScheduleDTO schedule = (id == 0) ? new ScheduleDTO() { CoursID = courseID } : scheduleService.Get(id); WebSchedule model = new WebSchedule() { CoursID = schedule.CoursID, EndDate = schedule.EndDate, ScheduleID = schedule.ScheduleID, StartDate = schedule.StartDate }; //Prepare DropDown list for days ViewBag.DayDDL = new SelectList(getWeekDays(), "DayNumber", "DayName", model.DayOfWeek); //Prepare DropDown list for hours ViewBag.HoursSLI = getHours(); //Prepare DropDown list for minutes ViewBag.MinutesSLI = new[] { new SelectListItem { Value = "0", Text = "00" }, new SelectListItem { Value = "15", Text = "15" }, new SelectListItem { Value = "30", Text = "30" }, new SelectListItem { Value = "45", Text = "45" } }; //Information about course ViewBag.Course = courseService.Get(courseID); return(View(model)); }