async Task ToggleAppointmentImportant(SchedulerAppointment appt) { appt.IsImportant = !appt.IsImportant; await ApptService.UpdateAsync(appt); await GetAppointments(); }
public async Task <SchedulerAppointment> GetAppointmentDetails(int apptId) { EnsureAppointments(); SchedulerAppointment appt = _appointments.Where(appt => appt.Id == apptId).FirstOrDefault(); return(await Task.FromResult(appt)); }
// Method that transform JSON data from client to Scheduler data private void InitializeSchedulerData(Input input) { appointmentsNumber = 0; appointments = new List <SchedulerAppointment>(); studyingSystem = input.StudyingSystem; lessonsPerDay = studyingSystem == 6 ? 6 : 7; foreach (Record record in input.Records) { int grade = (record.ClassName[1] >= '0' && record.ClassName[1] <= '1') ? Int32.Parse(record.ClassName.Substring(0, 2)) : Int32.Parse(record.ClassName.Substring(0, 1)); string className = grade > 9 ? record.ClassName.Substring(2) : record.ClassName.Substring(1); foreach (Appointment appointment in record.Appointments) { string subject = appointment.Subject; string teacher = appointment.Teacher; SchedulerAppointment schedulerAppointment = new SchedulerAppointment { Grade = grade, ClassName = className, Subject = subject, Teacher = teacher }; for (int i = 0; i < appointment.NumOfHours; i++) { appointmentsNumber++; appointments.Add(schedulerAppointment); } } } }
public async Task UpdateAsync(SchedulerAppointment apptToUpdate) { var index = _appointments.FindIndex(i => i.Id == apptToUpdate.Id); if (index != -1) { _appointments[index] = apptToUpdate; } }
async Task DeleteAppt(SchedulerAppointment appt) { if (appt.IsImportant) { return; } await ApptService.DeleteAsync(appt); await GetAppointments(); }
protected void LoadNewValues(SchedulerAppointment newItem, SchedulerAppointment postedItem) { newItem.Label = postedItem.Label; newItem.EndDate = postedItem.EndDate; newItem.MyRecurrenceInfo = postedItem.MyRecurrenceInfo; newItem.ResourceID = postedItem.ResourceID; newItem.StartDate = postedItem.StartDate; newItem.Status = postedItem.Status; newItem.Title = postedItem.Title; newItem.Type = postedItem.Type; newItem.Description = postedItem.Description; }
public int Create(SchedulerAppointment postedItem) { Console.WriteLine(postedItem.ResourceID); int newID = 0; foreach (SchedulerAppointment item in AppointmentsData) { if (newID < item.ID) { newID = item.ID; } } newID = newID + 1; AppointmentsData[AppointmentsData.Count - 1].ID = newID; return(newID); }
void PrepareMenuItems(SchedulerAppointment appt) { // disable one item, you can make bigger changes here too MenuItems[0].Disabled = appt.IsImportant; }
async Task ShowContextMenu(MouseEventArgs e, SchedulerAppointment appt) { LastClickedAppointment = appt; PrepareMenuItems(LastClickedAppointment); await TheContextMenu.ShowAsync(e.ClientX, e.ClientY); }
public ActionResult SchedulerPartialEditAppointment(SchedulerAppointment appointment) { SafeExecute(() => SchedulerHelper.UpdateSchedulerDataSource()); return(SchedulerPartial()); }
public void Delete(SchedulerAppointment deletedItem) { var item = AppointmentsData.First(i => i.ID == deletedItem.ID); AppointmentsData.Remove(item); }
public void Update(SchedulerAppointment postedItem) { var editedItem = AppointmentsData.First(i => i.ID == postedItem.ID); LoadNewValues(editedItem, postedItem); }
public async Task DeleteAsync(SchedulerAppointment apptToDelete) { // if you have recurrences and exceptions you may want to clean them up here too // see https://docs.telerik.com/blazor-ui/components/scheduler/edit-appointments#example _appointments.Remove(apptToDelete); }