public async Task UpdateRepairScheduleInfoToIncidentAsync(ScheduleRepairModel model) { ScheduleRepairUpdate updateJson = new ScheduleRepairUpdate(); updateJson.sl_dispatcherComments = model.DispatcherComments; updateJson.sl_repairScheduled = model.TimeSlotsSelectedValue.ToUniversalTime(); updateJson.sl_repairPerson = model.RepairPeopleSelectedValue; updateJson.__metadata = new metadata { type = "SP.Data.IncidentsListItem" }; await SuiteLevelWebApp.Utils.RestHelper.PostRestDataToDemoSiteAsync("/_api/lists/GetByTitle('Incidents')/Items(" + model.IncidentId + ")", JsonConvert.SerializeObject(updateJson), _token); }
public async Task <Event> ScheduleRepair(DashboardInspectionDetailsViewModel model) { DateTime repairDate = DateTime.Parse(model.timeSlotsSelectedValue); ScheduleRepairUpdate updateJson = new ScheduleRepairUpdate(); updateJson.sl_dispatcherComments = model.dispatcherComments; updateJson.sl_repairScheduled = repairDate.ToUniversalTime(); updateJson.sl_repairPerson = model.repairPeopleSelectedValue; updateJson.__metadata = new metadata { type = "SP.Data.IncidentsListItem" }; await SuiteLevelWebApp.Utils.RestHelper.PostRestDataToDemoSite("/_api/lists/GetByTitle('Incidents')/Items(" + model.incidentId + ")", JsonConvert.SerializeObject(updateJson), _token); var incident = await GetIncidentById(model.incidentId); var repairPeople = await GetRepairPeopleByEmailAddress(model.repairPeopleSelectedValue); //create a new event Attendee attendee = new Attendee { EmailAddress = new EmailAddress { Address = repairPeople.sl_emailaddress, Name = repairPeople.Title }, Type = AttendeeType.Required }; Attendee[] attendees = new Attendee[1]; attendees[0] = attendee; Event newEvent = new Event { Subject = "Repair Event", Body = new ItemBody { Content = incident.sl_dispatcherComments, ContentType = BodyType.HTML }, ShowAs = FreeBusyStatus.Busy, Start = repairDate.ToUniversalTime(), End = (repairDate.AddHours(1)).ToUniversalTime(), Location = new Location { DisplayName = incident.sl_roomID.Title }, Attendees = attendees }; return(newEvent); }
public async Task<Event> ScheduleRepair(DashboardInspectionDetailsViewModel model) { DateTime repairDate = DateTime.Parse(model.timeSlotsSelectedValue); ScheduleRepairUpdate updateJson = new ScheduleRepairUpdate(); updateJson.sl_dispatcherComments = model.dispatcherComments; updateJson.sl_repairScheduled = repairDate.ToUniversalTime(); updateJson.sl_repairPerson = model.repairPeopleSelectedValue; updateJson.__metadata = new metadata { type = "SP.Data.IncidentsListItem" }; await SuiteLevelWebApp.Utils.RestHelper.PostRestDataToDemoSite("/_api/lists/GetByTitle('Incidents')/Items(" + model.incidentId + ")", JsonConvert.SerializeObject(updateJson), _token); var incident = await GetIncidentById(model.incidentId); var repairPeople = await GetRepairPeopleByEmailAddress(model.repairPeopleSelectedValue); //create a new event Attendee attendee = new Attendee { EmailAddress = new EmailAddress { Address = repairPeople.sl_emailaddress, Name = repairPeople.Title }, Type = AttendeeType.Required }; Attendee[] attendees = new Attendee[1]; attendees[0] = attendee; Event newEvent = new Event { Subject = "Repair Event", Body = new ItemBody { Content = incident.sl_dispatcherComments, ContentType = BodyType.HTML }, ShowAs = FreeBusyStatus.Busy, Start = repairDate.ToUniversalTime(), End = (repairDate.AddHours(1)).ToUniversalTime(), Location = new Location { DisplayName = incident.sl_roomID.Title }, Attendees = attendees }; return newEvent; }