Exemplo n.º 1
0
        public async Task <IHttpActionResult> RepeatSubCalendarEvent([FromBody] getEventModel repeatSubEventRequestData)
        {
            this.authenticateUser(repeatSubEventRequestData);
            UserAccount retrievedUser = await repeatSubEventRequestData.getUserAccount(db);

            await retrievedUser.Login();

            retrievedUser.getTilerUser().updateTimeZoneTimeSpan(repeatSubEventRequestData.getTimeSpan);
            PostBackData    retValue = new PostBackData("", 1);
            DateTimeOffset  refNow   = repeatSubEventRequestData.getRefNow();
            DB_UserActivity activity = new DB_UserActivity(refNow, UserActivity.ActivityType.Repeat);
            JObject         json     = JObject.FromObject(repeatSubEventRequestData);

            activity.updateMiscelaneousInfo(json.ToString());
            if (retrievedUser.Status)
            {
                string CalendarType = repeatSubEventRequestData.ThirdPartyType.ToLower();

                switch (CalendarType)
                {
                case "google":
                {
                    CustomErrors error = new CustomErrors(CustomErrors.Errors.TilerConfig_Repeat_Third_Party);
                    retValue = new PostBackData(error);
                }
                break;

                case "tiler":
                {
                    HashSet <string> calendarIds = new HashSet <string>()
                    {
                        repeatSubEventRequestData.EventID
                    };
                    Task <Tuple <ThirdPartyControl.CalendarTool, IEnumerable <CalendarEvent> > > thirdPartyDataTask = ScheduleController.updatemyScheduleWithGoogleThirdpartyCalendar(retrievedUser.UserID, db);
                    DB_Schedule schedule = new DB_Schedule(retrievedUser, refNow, repeatSubEventRequestData.getCurrentLocation(), retrievalOptions: DataRetrievalSet.scheduleManipulationWithUpdateHistory, calendarIds: calendarIds);
                    schedule.CurrentLocation = repeatSubEventRequestData.getCurrentLocation();
                    var thirdPartyData = await thirdPartyDataTask.ConfigureAwait(false);

                    schedule.updateDataSetWithThirdPartyData(thirdPartyData);
                    activity.eventIds.Add(repeatSubEventRequestData.EventID);
                    retrievedUser.ScheduleLogControl.updateUserActivty(activity);
                    schedule.RepeatEvent(repeatSubEventRequestData.EventID, schedule.CurrentLocation);
                    await schedule.WriteFullScheduleToLog().ConfigureAwait(false);

                    retValue = new PostBackData("\"Success\"", 0);
                }
                break;

                default:
                    break;
                }
            }

            await AnalysisController.updateSuggestionAnalysis(retrievedUser.ScheduleLogControl).ConfigureAwait(false);

            TilerFront.SocketHubs.ScheduleChange scheduleChangeSocket = new TilerFront.SocketHubs.ScheduleChange();
            scheduleChangeSocket.triggerRefreshData(retrievedUser.getTilerUser());
            return(Ok(retValue.getPostBack));
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> Now([FromBody] NowEventModel nowEvent)
        {
            this.authenticateUser(nowEvent);
            UserAccount retrievedUser = await nowEvent.getUserAccount(db); //new UserAccountDirect(myUser.UserName, myUser.UserID);

            await retrievedUser.Login();

            retrievedUser.getTilerUser().updateTimeZoneTimeSpan(nowEvent.getTimeSpan);
            PostBackData retValue;

            if (retrievedUser.Status)
            {
                HashSet <string> calendarIds = new HashSet <string>()
                {
                    nowEvent.ID
                };
                Task <Tuple <ThirdPartyControl.CalendarTool, IEnumerable <CalendarEvent> > > thirdPartyDataTask = ScheduleController.updatemyScheduleWithGoogleThirdpartyCalendar(retrievedUser.UserID, db);
                var retrievalOption = DataRetrievalSet.scheduleManipulation;
                retrievalOption.Add(DataRetrivalOption.TimeLineHistory);
                DB_Schedule schedule = new DB_Schedule(retrievedUser, nowEvent.getRefNow(), nowEvent.getCurrentLocation(), retrievalOptions: retrievalOption, calendarIds: calendarIds);
                schedule.CurrentLocation = nowEvent.getCurrentLocation();
                var thirdPartyData = await thirdPartyDataTask.ConfigureAwait(false);

                schedule.updateDataSetWithThirdPartyData(thirdPartyData);
                var ScheduleUpdateMessage = await schedule.SetCalendarEventAsNow(nowEvent.ID).ConfigureAwait(false);

                DB_UserActivity activity = new DB_UserActivity(nowEvent.getRefNow(), UserActivity.ActivityType.SetAsNowCalendarEvent, new List <String>()
                {
                    nowEvent.ID
                });
                JObject json = JObject.FromObject(nowEvent);
                activity.updateMiscelaneousInfo(json.ToString());
                retrievedUser.ScheduleLogControl.updateUserActivty(activity);
                await schedule.persistToDB().ConfigureAwait(false);

                retValue = new PostBackData(ScheduleUpdateMessage.Item1);
            }
            else
            {
                retValue = new PostBackData("", 1);
            }
            await AnalysisController.updateSuggestionAnalysis(retrievedUser.ScheduleLogControl).ConfigureAwait(false);

            TilerFront.SocketHubs.ScheduleChange scheduleChangeSocket = new TilerFront.SocketHubs.ScheduleChange();
            scheduleChangeSocket.triggerRefreshData(retrievedUser.getTilerUser());
            return(Ok(retValue.getPostBack));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> DeleteCalEvent([FromBody] getEventModel myUser)
        {
            this.authenticateUser(myUser);
            UserAccount retrievedUser = await myUser.getUserAccount(db);// new UserAccount(myUser.UserName, myUser.UserID);

            await retrievedUser.Login();

            retrievedUser.getTilerUser().updateTimeZoneTimeSpan(myUser.getTimeSpan);
            PostBackData retValue;

            if (retrievedUser.Status)
            {
                HashSet <string> calendarIds = new HashSet <string>()
                {
                    myUser.EventID
                };
                Task <Tuple <ThirdPartyControl.CalendarTool, IEnumerable <CalendarEvent> > > thirdPartyDataTask = ScheduleController.updatemyScheduleWithGoogleThirdpartyCalendar(retrievedUser.UserID, db);
                DB_Schedule schedule = new DB_Schedule(retrievedUser, myUser.getRefNow(), myUser.getCurrentLocation(), calendarIds: calendarIds);
                schedule.CurrentLocation = myUser.getCurrentLocation();
                var thirdPartyData = await thirdPartyDataTask.ConfigureAwait(false);

                schedule.updateDataSetWithThirdPartyData(thirdPartyData);
                DB_UserActivity activity = new DB_UserActivity(myUser.getRefNow(), UserActivity.ActivityType.DeleteCalendarEvent, new List <String>()
                {
                    myUser.EventID
                });
                JObject json = JObject.FromObject(myUser);
                activity.updateMiscelaneousInfo(json.ToString());
                retrievedUser.ScheduleLogControl.updateUserActivty(activity);
                CustomErrors messageReturned = await schedule.deleteCalendarEventAndReadjust(myUser.EventID).ConfigureAwait(false);

                await schedule.WriteFullScheduleToLog().ConfigureAwait(false);

                int errorCode = messageReturned?.Code ?? 0;
                retValue = new PostBackData(messageReturned, errorCode);
            }
            else
            {
                retValue = new PostBackData("", 1);
            }

            TilerFront.SocketHubs.ScheduleChange scheduleChangeSocket = new TilerFront.SocketHubs.ScheduleChange();
            await AnalysisController.updateSuggestionAnalysis(retrievedUser.ScheduleLogControl).ConfigureAwait(false);

            scheduleChangeSocket.triggerRefreshData(retrievedUser.getTilerUser());
            return(Ok(retValue.getPostBack));
        }
Exemplo n.º 4
0
        public async Task <IHttpActionResult> SetAsNow([FromBody] WhatIfModel SetAsNowData)
        {
            AuthorizedUser myAuthorizedUser = SetAsNowData.User;
            UserAccount    retrievedUser    = await SetAsNowData.getUserAccount(db);

            await retrievedUser.Login();

            retrievedUser.getTilerUser().updateTimeZoneTimeSpan(SetAsNowData.getTimeSpan);
            PostBackData returnPostBack;

            if (retrievedUser.Status)
            {
                Task <Tuple <ThirdPartyControl.CalendarTool, IEnumerable <CalendarEvent> > > thirdPartyDataTask = ScheduleController.updatemyScheduleWithGoogleThirdpartyCalendar(retrievedUser.UserID, db);
                var retrievalOption = DataRetrievalSet.scheduleManipulation;
                retrievalOption.Add(DataRetrivalOption.TimeLineHistory);
                DB_Schedule schedule       = new DB_Schedule(retrievedUser, myAuthorizedUser.getRefNow(), SetAsNowData.getCurrentLocation(), retrievalOptions: retrievalOption);
                var         thirdPartyData = await thirdPartyDataTask.ConfigureAwait(false);

                schedule.updateDataSetWithThirdPartyData(thirdPartyData);
                schedule.CurrentLocation = myAuthorizedUser.getCurrentLocation();

                var evaluation = await schedule.TimeStone.WhatIfSetAsNow(SetAsNowData.EventId);

                JObject before     = evaluation.Item1.ToJson();
                JObject after      = evaluation.Item2.ToJson();
                JObject resultData = new JObject();
                resultData.Add("before", before);
                resultData.Add("after", after);
                returnPostBack = new PostBackData(resultData, 0);
                return(Ok(returnPostBack.getPostBack));
            }
            else
            {
                returnPostBack = new PostBackData("", 1);
            }

            return(Ok(returnPostBack.getPostBack));
        }
Exemplo n.º 5
0
        public async Task <IHttpActionResult> pushed([FromBody] WhatIfModel UserData)
        {
            AuthorizedUser myAuthorizedUser = UserData.User;
            UserAccount    retrievedUser    = await UserData.getUserAccount(db);

            await retrievedUser.Login();

            retrievedUser.getTilerUser().updateTimeZoneTimeSpan(UserData.getTimeSpan);
            PostBackData returnPostBack;

            if (retrievedUser.Status)
            {
                Task <Tuple <ThirdPartyControl.CalendarTool, IEnumerable <CalendarEvent> > > thirdPartyDataTask = ScheduleController.updatemyScheduleWithGoogleThirdpartyCalendar(retrievedUser.UserID, db);
                DB_Schedule schedule       = new DB_Schedule(retrievedUser, myAuthorizedUser.getRefNow(), myAuthorizedUser.getCurrentLocation());
                var         thirdPartyData = await thirdPartyDataTask.ConfigureAwait(false);

                schedule.updateDataSetWithThirdPartyData(thirdPartyData);
                schedule.CurrentLocation = myAuthorizedUser.getCurrentLocation();
                Tuple <Health, Health> evaluation;
                evaluation = await schedule.TimeStone.PushedAll(UserData.Duration, null);

                JObject before     = evaluation.Item1.ToJson();
                JObject after      = evaluation.Item2.ToJson();
                JObject resultData = new JObject();
                resultData.Add("before", before);
                resultData.Add("after", after);
                returnPostBack = new PostBackData(resultData, 0);
                return(Ok(returnPostBack.getPostBack));
            }
            else
            {
                returnPostBack = new PostBackData("", 1);
            }

            return(Ok(returnPostBack.getPostBack));
        }
Exemplo n.º 6
0
        public async Task <IHttpActionResult> UpdateCalEvent([FromBody] EditSubCalEventModel editSubEventRequest)
        {
            this.authenticateUser(editSubEventRequest);
            UserAccount retrievedUser = await editSubEventRequest.getUserAccount(db);

            await retrievedUser.Login();

            retrievedUser.getTilerUser().updateTimeZoneTimeSpan(editSubEventRequest.getTimeSpan);
            PostBackData retValue = new PostBackData("", 1);

            if (retrievedUser.Status)
            {
                string CalendarType = editSubEventRequest.ThirdPartyType.ToLower();
                switch (CalendarType)
                {
                case "google":
                {
                    DateTimeOffset myNow           = editSubEventRequest.getRefNow();
                    var            retrievalOption = DataRetrievalSet.scheduleManipulation;
                    retrievalOption.Add(DataRetrivalOption.TimeLineHistory);
                    DB_Schedule NewSchedule = new DB_Schedule(retrievedUser, myNow, editSubEventRequest.getCurrentLocation(), retrievalOption);
                    NewSchedule.CurrentLocation = editSubEventRequest.getCurrentLocation();
                    Models.ThirdPartyCalendarAuthenticationModel AllIndexedThirdParty = await ScheduleController.getThirdPartyAuthentication(retrievedUser.UserID, editSubEventRequest.ThirdPartyUserID, "Google", db);

                    GoogleTilerEventControl googleControl = new GoogleTilerEventControl(AllIndexedThirdParty, db);
                    await googleControl.updateSubEvent(editSubEventRequest).ConfigureAwait(false);

                    Dictionary <string, CalendarEvent> AllCalendarEvents = (await googleControl.getCalendarEvents(null, true).ConfigureAwait(false)).ToDictionary(obj => obj.getId, obj => obj);
                    GoogleThirdPartyControl            googleEvents      = new GoogleThirdPartyControl(AllCalendarEvents, AllIndexedThirdParty.getTilerUser());
                    DB_UserActivity activity = new DB_UserActivity(myNow, UserActivity.ActivityType.ThirdPartyUpdate);
                    retrievedUser.ScheduleLogControl.updateUserActivty(activity);

                    await NewSchedule.updateDataSetWithThirdPartyDataAndTriggerNewAddition(new Tuple <ThirdPartyControl.CalendarTool, IEnumerable <CalendarEvent> >(ThirdPartyControl.CalendarTool.google, new List <CalendarEvent> {
                            googleEvents.getThirdpartyCalendarEvent()
                        })).ConfigureAwait(false);

                    retValue = new PostBackData("\"Success\"", 0);
                }
                break;

                case "tiler":
                {
                    DateTimeOffset myNow = editSubEventRequest.getRefNow();
                    myNow = editSubEventRequest.getRefNow();
                    HashSet <string> calendarIds = new HashSet <string>()
                    {
                        editSubEventRequest.EventID
                    };
                    Task <Tuple <ThirdPartyControl.CalendarTool, IEnumerable <CalendarEvent> > > thirdPartyDataTask = ScheduleController.updatemyScheduleWithGoogleThirdpartyCalendar(retrievedUser.UserID, db);
                    DB_Schedule schedule = new DB_Schedule(retrievedUser, myNow, editSubEventRequest.getCurrentLocation(), retrievalOptions: DataRetrievalSet.scheduleManipulationWithUpdateHistory, calendarIds: calendarIds);
                    schedule.CurrentLocation = editSubEventRequest.getCurrentLocation();
                    var thirdPartyData = await thirdPartyDataTask.ConfigureAwait(false);

                    schedule.updateDataSetWithThirdPartyData(thirdPartyData);

                    long           StartLong    = Convert.ToInt64(editSubEventRequest.Start);
                    long           EndLong      = Convert.ToInt64(editSubEventRequest.End);
                    long           LongBegin    = Convert.ToInt64(editSubEventRequest.CalStart);
                    long           LongDeadline = Convert.ToInt64(editSubEventRequest.CalEnd);
                    DateTimeOffset newStart     = TilerElementExtension.JSStartTime.AddMilliseconds(StartLong);
                    DateTimeOffset newEnd       = TilerElementExtension.JSStartTime.AddMilliseconds(EndLong);
                    DateTimeOffset Begin        = TilerElementExtension.JSStartTime.AddMilliseconds(LongBegin);
                    if (LongBegin == 0)
                    {
                        Begin = Utility.BeginningOfTime;
                    }

                    DateTimeOffset Deadline = TilerElementExtension.JSStartTime.AddMilliseconds(LongDeadline);
                    if (LongDeadline == 0)
                    {
                        Deadline = Utility.BeginningOfTime;
                    }
                    int SplitCount = (int)editSubEventRequest.Split;
                    if (SplitCount >= 1)
                    {
                        SubCalendarEvent subEventedited = schedule.getSubCalendarEvent(editSubEventRequest.EventID);
                        Tuple <CustomErrors, Dictionary <string, CalendarEvent> > ScheduleUpdateMessage = await schedule.BundleChangeUpdate(editSubEventRequest.EventID, new EventName(retrievedUser.getTilerUser(), subEventedited, editSubEventRequest.EventName), newStart, newEnd, Begin, Deadline, SplitCount, editSubEventRequest.EscapedNotes).ConfigureAwait(false);

                        DB_UserActivity activity = new DB_UserActivity(myNow, UserActivity.ActivityType.InternalUpdate, new List <String>()
                            {
                                editSubEventRequest.EventID
                            });
                        retrievedUser.ScheduleLogControl.updateUserActivty(activity);
                        await schedule.persistToDB().ConfigureAwait(false);

                        //EventID eventId = new EventID(myUser.EventID);
                        //CalendarEvent calendarEvent = schedule.getCalendarEvent(eventId);
                        //SubCalendarEvent subEvent = calendarEvent.ActiveSubEvents.FirstOrDefault();
                        //SubCalEvent subCalEvent = subEvent.ToSubCalEvent(calendarEvent);
                        //JObject retSubEvent = new JObject();
                        //retSubEvent.Add("subEvent", JObject.FromObject(subCalEvent));
                        //retValue = new PostBackData(retSubEvent, 0);
                        retValue = new PostBackData();
                    }
                    else
                    {
                        CustomErrors error = new CustomErrors(CustomErrors.Errors.TilerConfig_Zero_SplitCount);
                        retValue = new PostBackData(error);
                    }
                }
                break;

                default:
                    break;
                }
            }
            await AnalysisController.updateSuggestionAnalysis(retrievedUser.ScheduleLogControl).ConfigureAwait(false);

            TilerFront.SocketHubs.ScheduleChange scheduleChangeSocket = new TilerFront.SocketHubs.ScheduleChange();
            scheduleChangeSocket.triggerRefreshData(retrievedUser.getTilerUser());
            return(Ok(retValue.getPostBack));
        }
Exemplo n.º 7
0
        public async Task <IHttpActionResult> pushedEvent([FromBody] WhatIfModel UserData)
        {
            AuthorizedUser myAuthorizedUser = UserData.User;
            UserAccount    retrievedUser    = await UserData.getUserAccount(db);

            await retrievedUser.Login();

            retrievedUser.getTilerUser().updateTimeZoneTimeSpan(UserData.getTimeSpan);
            PostBackData returnPostBack;

            if (retrievedUser.Status)
            {
                Task <Tuple <ThirdPartyControl.CalendarTool, IEnumerable <CalendarEvent> > > thirdPartyDataTask = ScheduleController.updatemyScheduleWithGoogleThirdpartyCalendar(retrievedUser.UserID, db);
                DB_Schedule schedule       = new DB_Schedule(retrievedUser, myAuthorizedUser.getRefNow(), UserData.getCurrentLocation());
                var         thirdPartyData = await thirdPartyDataTask.ConfigureAwait(false);

                schedule.updateDataSetWithThirdPartyData(thirdPartyData);
                schedule.CurrentLocation = myAuthorizedUser.getCurrentLocation();
                Tuple <Health, Health> evaluation;

                SubCalendarEvent subEvent = null;
                try
                {
                    if (String.IsNullOrEmpty(UserData.EventId))
                    {
                        var calEventAndSubEvent = schedule.getNearestEventToNow();
                        subEvent = calEventAndSubEvent.Item2;
                        EventID eventId = new EventID(calEventAndSubEvent.Item2.getId);
                        evaluation = await schedule.TimeStone.PushSingleEvent(UserData.Duration, eventId, null);
                    }
                    else
                    {
                        evaluation = await schedule.TimeStone.PushSingleEvent(UserData.Duration, new EventID(UserData.EventId), null);
                    }

                    JObject before     = evaluation.Item1.ToJson();
                    JObject after      = evaluation.Item2.ToJson();
                    JObject resultData = new JObject();
                    if (subEvent != null)
                    {
                        SubCalEvent subcalevent = subEvent.ToSubCalEvent();
                        JObject     jsonSubcal  = JObject.FromObject(subcalevent);
                        resultData.Add("subEvent", jsonSubcal);
                    }

                    resultData.Add("before", before);
                    resultData.Add("after", after);
                    returnPostBack = new PostBackData(resultData, 0);
                    return(Ok(returnPostBack.getPostBack));
                }
                catch (CustomErrors error)
                {
                    returnPostBack = new PostBackData(error);
                    return(Ok(returnPostBack.getPostBack));
                }
            }
            else
            {
                returnPostBack = new PostBackData("", 1);
            }

            return(Ok(returnPostBack.getPostBack));
        }
Exemplo n.º 8
0
        public async Task <IHttpActionResult> SubeventEdit([FromBody] EditSubEventWhatIfModel SubEventEdit)
        {
            UserAccount retrievedUser = await SubEventEdit.getUserAccount(db);

            await retrievedUser.Login();

            retrievedUser.getTilerUser().updateTimeZoneTimeSpan(SubEventEdit.getTimeSpan);
            PostBackData returnPostBack;

            if (retrievedUser.Status)
            {
                int            SplitCount   = (int)SubEventEdit.Split;
                long           StartLong    = Convert.ToInt64(SubEventEdit.Start);
                long           EndLong      = Convert.ToInt64(SubEventEdit.End);
                long           LongBegin    = Convert.ToInt64(SubEventEdit.CalStart);
                long           LongDeadline = Convert.ToInt64(SubEventEdit.CalEnd);
                DateTimeOffset newStart     = TilerElementExtension.JSStartTime.AddMilliseconds(StartLong);
                DateTimeOffset newEnd       = TilerElementExtension.JSStartTime.AddMilliseconds(EndLong);
                DateTimeOffset Begin        = TilerElementExtension.JSStartTime.AddMilliseconds(LongBegin);
                if (LongBegin == 0)
                {
                    Begin = Utility.BeginningOfTime;
                }

                DateTimeOffset Deadline = TilerElementExtension.JSStartTime.AddMilliseconds(LongDeadline);
                if (LongDeadline == 0)
                {
                    Deadline = Utility.BeginningOfTime;
                }


                DateTimeOffset         now = SubEventEdit.getRefNow();
                DB_Schedule            schedule;
                Tuple <Health, Health> evaluation;

                string CalendarType = SubEventEdit.ThirdPartyType.ToLower();
                switch (CalendarType)
                {
                case "google":
                {
                    Models.ThirdPartyCalendarAuthenticationModel AllIndexedThirdParty = await ScheduleController.getThirdPartyAuthentication(retrievedUser.UserID, SubEventEdit.ThirdPartyUserID, "Google", db);

                    GoogleTilerEventControl googleControl = new GoogleTilerEventControl(AllIndexedThirdParty, db);
                    await googleControl.updateSubEvent(SubEventEdit).ConfigureAwait(false);

                    Dictionary <string, CalendarEvent> AllCalendarEvents = (await googleControl.getCalendarEvents(null, true).ConfigureAwait(false)).ToDictionary(obj => obj.getId, obj => obj);
                    GoogleThirdPartyControl            googleEvents      = new GoogleThirdPartyControl(AllCalendarEvents, AllIndexedThirdParty.getTilerUser());
                    DB_UserActivity activity = new DB_UserActivity(now, UserActivity.ActivityType.ThirdPartyUpdate);
                    retrievedUser.ScheduleLogControl.updateUserActivty(activity);
                    Task <Tuple <ThirdPartyControl.CalendarTool, IEnumerable <CalendarEvent> > > thirdPartyDataTask = ScheduleController.updatemyScheduleWithGoogleThirdpartyCalendar(retrievedUser.UserID, db);
                    schedule = new DB_Schedule(retrievedUser, now, SubEventEdit.getCurrentLocation());
                    var thirdPartyData = await thirdPartyDataTask.ConfigureAwait(false);

                    schedule.updateDataSetWithThirdPartyData(thirdPartyData);
                    evaluation = await schedule.TimeStone.EventUpdate().ConfigureAwait(false);
                }
                break;

                case "tiler":
                {
                    HashSet <string> calendarIds = new HashSet <string>()
                    {
                        SubEventEdit.EventID
                    };
                    Task <Tuple <ThirdPartyControl.CalendarTool, IEnumerable <CalendarEvent> > > thirdPartyDataTask = ScheduleController.updatemyScheduleWithGoogleThirdpartyCalendar(retrievedUser.UserID, db);
                    var retrievalOption = DataRetrievalSet.scheduleManipulation;
                    retrievalOption.Add(DataRetrivalOption.TimeLineHistory);

                    schedule = new DB_Schedule(retrievedUser, now, SubEventEdit.getCurrentLocation(), calendarIds: calendarIds, retrievalOptions: retrievalOption);
                    var thirdPartyData = await thirdPartyDataTask.ConfigureAwait(false);

                    schedule.updateDataSetWithThirdPartyData(thirdPartyData);
                    schedule.CurrentLocation = SubEventEdit.getCurrentLocation();
                    evaluation = await schedule.TimeStone.EventUpdate(
                        newStart,
                        newEnd,
                        Begin,
                        Deadline,
                        SplitCount,
                        SubEventEdit.EventID
                        ).ConfigureAwait(false);
                }
                break;

                default:
                    CustomErrors error = new CustomErrors(CustomErrors.Errors.Preview_Calendar_Type_Not_Supported);
                    returnPostBack = new PostBackData(error);
                    return(Ok(returnPostBack.getPostBack));
                }



                JObject before = evaluation.Item1.ToJson();
                JObject after  = evaluation.Item2.ToJson();

                HealthComparison healthComparison = new HealthComparison(evaluation.Item1, evaluation.Item2);
                var     delta     = healthComparison.delta();
                JObject deltaJson = new JObject();
                deltaJson.Add("conflictDeltaCount", delta.Item1);
                deltaJson.Add("tardyDeltaCount", delta.Item2);

                JObject resultData = new JObject();
                resultData.Add("before", before);
                resultData.Add("after", after);
                resultData.Add("delta", deltaJson);
                returnPostBack = new PostBackData(resultData, 0);
                return(Ok(returnPostBack.getPostBack));
            }
            else
            {
                returnPostBack = new PostBackData("", 1);
            }

            return(Ok(returnPostBack.getPostBack));
        }