public async Task <ActionResult> Create(FormCollection collection) { String newEventID = await _calenderOperations.AddCalendarEventAsync(collection["Location"], collection["Body"], collection["Attendees"], collection["Subject"], DateTimeOffset.Parse(collection["StartDate"]), DateTimeOffset.Parse(collection["EndDate"])); return(RedirectToAction("Index", new { newid = newEventID })); }
/// <summary> /// Saves changes to a calendar event on the Exchange service and /// updates the local collection of calendar events. /// </summary> public async void ExecuteSaveChangesCommandAsync() { string operationType = string.Empty; try { if (!String.IsNullOrEmpty(this.Id)) { LoggingViewModel.Instance.Information = "Updating event ..."; operationType = "update"; //Send changes to Exchange _serverEventData = await _calenderOperations.UpdateCalendarEventAsync( this.Id, this.LocationName, this.BodyContent, this.Attendees, this.Subject, this.Start, this.End, this.StartTime, this.EndTime); this.IsNewOrDirty = false; LoggingViewModel.Instance.Information = "The event was updated in your calendar"; } else { LoggingViewModel.Instance.Information = "Adding event ..."; operationType = "save"; //Add the event //Send the add request to Exchange service with new event properties this.Id = await _calenderOperations.AddCalendarEventAsync( this.LocationName, this.BodyContent, this.Attendees, this.Subject, this.Start, this.End, this.StartTime, this.EndTime); this.IsNewOrDirty = false; LoggingViewModel.Instance.Information = "The event was added to your calendar"; } } catch (Exception) { LoggingViewModel.Instance.Information = string.Format("We could not {0} your calendar event in your calendar", operationType); } }
public async Task <ActionResult> Create(FormCollection collection) { _O365ServiceOperationFailed = false; String newEventID = ""; try { newEventID = await _calenderOperations.AddCalendarEventAsync(collection["Location"], collection["Body"], collection["Attendees"], collection["Subject"], DateTimeOffset.Parse(collection["StartDate"]), DateTimeOffset.Parse(collection["EndDate"])); } catch (Exception) { _O365ServiceOperationFailed = true; } return(RedirectToAction("Index", new { newid = newEventID })); }
//[Authorize] public async Task <ActionResult> New(NieuweAfspraakPM a) { string verplaatsing = Request.Form["Afspraak.Verplaatsing"]; string soloduo = Request.Form["Afspraak.SoloDuo"]; if (verplaatsing != null && verplaatsing.Equals("on")) { a.Afspraak.Verplaatsing = true; } else { a.Afspraak.Verplaatsing = false; } if (soloduo != null && soloduo.Equals("on")) { a.Afspraak.SoloDuo = true; } else { a.Afspraak.SoloDuo = false; } if (a.Afspraak.Klant.ID != 0) { a.Afspraak.Klant = ks.GetKlantByID(a.Afspraak.Klant.ID); } a.Afspraak.Masseur = afs.GetMasseurByID(a.Afspraak.Masseur.ID); a.Afspraak.SoortAfspraak = afs.GetMassageByID(a.Afspraak.SoortAfspraak.ID); a.Afspraak.Arrangement = afs.GetArrangementByID(a.Afspraak.Arrangement.ID); a.Afspraak.Extra = afs.GetExtraByID(a.Afspraak.Extra.ID); if (a.Afspraak.Arrangement != null && a.Afspraak.SoortAfspraak != null) { a.Afspraak.Duur = a.Afspraak.SoortAfspraak.Duur + a.Afspraak.Arrangement.Duur; } else if (a.Afspraak.SoortAfspraak != null) { a.Afspraak.Duur = a.Afspraak.SoortAfspraak.Duur; } else if (a.Afspraak.Arrangement != null) { a.Afspraak.Duur = a.Afspraak.Arrangement.Duur; } else { a.Afspraak.Duur = 60; } a.Afspraak.DatumTijdstip = a.Datum.Date + a.Tijdstip.TimeOfDay; if (a.Afspraak.DatumTijdstip == DateTime.MinValue) { a.Afspraak.DatumTijdstip = (DateTime)SqlDateTime.MinValue; } _O365ServiceOperationFailed = false; String newEventID = ""; try { newEventID = await _calenderOperations.AddCalendarEventAsync(a.Afspraak.Klant.Adres.ToString(), a.Afspraak.Klant.ToString(), a.Afspraak.Klant.Naam + " " + a.Afspraak.Klant.Voornaam, a.Afspraak.SoortAfspraak.Naam + " - " + a.Afspraak.Masseur.Naam, DateTimeOffset.Parse(a.Afspraak.DatumTijdstip.ToString()), DateTimeOffset.Parse(a.Afspraak.DatumTijdstip.ToString())); } catch (Exception) { _O365ServiceOperationFailed = true; } if (_O365ServiceOperationFailed) { afs.AddAfspraak(a.Afspraak); if (a.Afspraak.Geannuleerd == false) { return(RedirectToAction("Index")); } else { a.Afspraak.Geannuleerd = false; TempData["error"] = "Er is reeds een afspraak op dit tijdstip gemaakt!"; return(RedirectToAction("New")); //return View(a); } } return(View(a)); /*if (Request.Form["New"] != null) * {*/ // } //NieuweAfspraakPM pm = (NieuweAfspraakPM)a; //pm.Klanten = new SelectList(ks.GetKlanten().Select(u => new { ID = u.ID, Naam = u.Naam + " " + u.Voornaam }), "ID", "Naam"); //return View(pm); }