// Create new events private void AddEventButton_Click(object sender, RoutedEventArgs e) { // Check if all fields are filled if (EventName.Text == "") { MessageBox.Show("Todos los campos son obligatorios."); EventName.BorderBrush = Brushes.Red; return; } else { EventName.BorderBrush = def; } if (EventInfo.Text == "") { MessageBox.Show("Todos los campos son obligatorios."); EventInfo.BorderBrush = Brushes.Red; return; } else { EventInfo.BorderBrush = def; } if (EventDate.SelectedDate == null) { MessageBox.Show("Todos los campos son obligatorios."); EventDate.BorderBrush = Brushes.Red; return; } else { EventDate.BorderBrush = def; } // If all correct create the event and send the request to server AgendaEvent aEvent = new AgendaEvent() { EventInfo = EventInfo.Text, EventName = EventName.Text, Date = EventDate.SelectedDate.Value }; if (!ClientController.client.AddNewAgendaEvent(aEvent, out string message)) { // Error MessageBox.Show(message); return; } else { // Nice MessageBox.Show("Evento añadido correctamente."); } }
public void CheckAgenda() { TimeOfDay timeOfDay = TimeManager.instance.timeOfDay; if (currentEvent.IsFinished(timeOfDay)) { currentEvent = agenda.NextEvent(); } FreeTime = !currentEvent.HasBegun(timeOfDay); }
void Start() { agenda.Initialize(); currentEvent = agenda.NextEvent(); FreeTime = !currentEvent.HasBegun(TimeManager.instance.timeOfDay); if (auto_update) { TimeManager.instance.OnQuarterUpdate += CheckAgenda; } }
public IActionResult Create([FromBody] AgendaEvent item) { if (item == null) { return(BadRequest()); } _context.AgendaEvents.Add(item); _context.SaveChanges(); return(CreatedAtRoute("GetAgendaEvent", new { id = item.ID }, item)); }
// Delete event private void DeleteEvent(AgendaEvent agendaEvent) { if (!ClientController.client.DeleteAgendaEvent(agendaEvent, out string message)) { MessageBox.Show(message); return; } else { MessageBox.Show("Evento eliminado correctamente."); } }
public AgendaEvent NextEvent() { if (nextEventIndex < events.Length) { AgendaEvent curentEvent = events[nextEventIndex]; nextEventIndex++; return(curentEvent); } else { return(new AgendaEvent(new TimeOfDay(0, 0), new TimeOfDay(24, 59), "Doby is free !", Vector3.zero)); } }
public IActionResult Update(int id, [FromBody] AgendaEvent item) { if (item == null || item.ID != id) { return(BadRequest()); } var agendaEvent = _context.AgendaEvents.FirstOrDefault(t => t.ID == id); if (agendaEvent == null) { return(NotFound()); } agendaEvent.Name = item.Name; _context.AgendaEvents.Update(agendaEvent); _context.SaveChanges(); return(new NoContentResult()); }