public JsonResult NotifyAboutMissingEditionImages(string key, string connectionId) { if (key == WebConfigHelper.TaskSchedulerSecretKey) { try { var editions = TaskServices.GetEditionsWithMissingImages(); var pattern = "<a href='{0}'>{1}</a>"; var body = "<table>"; for (var i = 0; i < editions.Count; i++) { var edition = editions[i]; var url = _editionHelper.GetEditionUrl(new EditionEntity { EditionId = edition.EditionId, EditionName = edition.EventName, Status = edition.Status.ToEnum <EditionStatusType>() }); body += "<tr><td class='font-lato' style='font-size: 14px; color: #888794'>" + string.Format(pattern, url, edition.EventName); body += edition.EventBackGroundImage == null ? " [People Image] " : ""; body += edition.EventImage == null ? " [Web Logo] " : ""; body += edition.IconFileName == null ? " [Icon] " : ""; body += edition.MasterLogoFileName == null ? " [Master Logo] " : ""; body += edition.ProductImageFileName == null ? " [Product Image] " : ""; body += "</td></tr>"; if (!string.IsNullOrWhiteSpace(connectionId)) { ProgressHub.SendProgress(connectionId, "Detecting missing images...", i + 1, editions.Count, TaskType.NotifyAboutMissingEditionImages.GetHashCode()); } } body += "</table>"; var subject = "Events with Missing Images"; var recipients = WebConfigHelper.MarketingAdminEmails; _emailNotificationHelper.Send(NotificationType.MissingEditionImages, subject, body, recipients); var log = CreateInternalLog("The task NotifyAboutMissingEditionImages completed.", AutoIntegrationUser); ExternalLogHelper.Log(log, LoggingEventType.Information); return(Json("", JsonRequestBehavior.AllowGet)); } catch (Exception exc) { var message = "The task NotifyAboutMissingEditionImages failed! " + exc.GetFullMessage(); ExternalLogHelper.Log(message, LoggingEventType.Error); return(Json(false, JsonRequestBehavior.AllowGet)); } } return(Json(false, JsonRequestBehavior.AllowGet)); }
public HttpResponseMessage UpdateUserTask([FromBody] UserTask uTask) { try { var lstTaskPreviousData = new List <UserTaskEmail>(); if (uTask.TaskID > 0) { lstTaskPreviousData = TaskServices.GetTaskDetailsForSendingEmail(uTask.TaskID.ToString(), uTask.SiteID, uTask.ProgramID, uTask.UpdatedByUserID, true); } var lstTask = TaskServices.UpdateUserTask(uTask.TaskID, uTask.TaskName, uTask.TaskTypeID, uTask.SiteID, uTask.ProgramID, uTask.AssignedDate, uTask.AssignedToUserID, uTask.AssignedByUserID, uTask.TaskDetails, uTask.CCUserIDs, uTask.DueDate, uTask.TaskStatus, uTask.UpdatedByUserID, uTask.CreatedByUserID, uTask.TracerCustomID, uTask.TracerResponseID, uTask.TracerQuestionID, uTask.TracerQuestionAnswerID, uTask.EPTextID, uTask.CMSStandardID, uTask.ReminderEmailRequired, uTask.TaskResolution, uTask.CompleteDate, uTask.LstUsers); Task.Factory.StartNew(() => TaskServices.SendTaskEmailAfterSave(lstTask, uTask.SiteID, uTask.ProgramID, uTask.UpdatedByUserID, lstTaskPreviousData, uTask.ObservationTitle)); if (uTask.TaskID > 0) { Task.Factory.StartNew(() => TaskServices.DisableTaskNotificationScheduleType(DisableTaskNotificationScheduleType.TaskChanged, uTask.SiteID, uTask.UpdatedByUserID, lstTask)); } return(Request.CreateResponse(HttpStatusCode.OK, lstTask)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/UpdateUserTask"); WebExceptionHelper.LogException(ex, null); return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, ex.ToString())); } }
string currentPatch = string.Empty; //current patch; // Use this for initialization IEnumerator Start() { ICharacterSystem sys = new CharacterSystem(); yield return(StartCoroutine(sys.Initialize())); clothData = ClothModel.GetData(); IniClothType(); playerParent = GameObject.Find("Stage/playerRoot"); EventTriggerListener.Get(male).onClicks.Add(male_Click); EventTriggerListener.Get(female).onClicks.Add(female_Click); EventTriggerListener.Get(lod1).onClicks.Add(delegate() { TaskServices.CreateTask(lod_Click(1)).Start(); }); EventTriggerListener.Get(lod2).onClicks.Add(delegate() { TaskServices.CreateTask(lod_Click(2)).Start(); }); EventTriggerListener.Get(lod3).onClicks.Add(delegate() { TaskServices.CreateTask(lod_Click(3)).Start(); }); EventTriggerListener.Get(lod4).onClicks.Add(delegate() { TaskServices.CreateTask(lod_Click(4)).Start(); }); EventTriggerListener.Get(lod5).onClicks.Add(delegate() { TaskServices.CreateTask(lod_Click(5)).Start(); }); EventTriggerListener.Get(lod6).onClicks.Add(delegate() { TaskServices.CreateTask(lod_Click(0)).Start(); }); EventTriggerListener.Get(tempBtn).onClicks.Add(tempBtn_Click); female_Click(); //male_Click(); UseTimeAlphaManager.StartTimeAlpha(UseTimeAlphaManager.LoadRole); }
public void TestGetAllTasks_WithSingleTask() { try { var data = new List <TaskManager.DataModel.Task>() { new DataModel.Task { TaskId = 1, TaskName = "SampleTask", ParentTaskName = "Myparent", StartDate = DateTime.Now, EndDate = DateTime.Now, IsCompleted = false } }.AsQueryable(); var mockSet = new Mock <DbSet <TaskManager.DataModel.Task> >(); mockSet.As <IQueryable <TaskManager.DataModel.Task> >().Setup(m => m.Provider).Returns(data.Provider); mockSet.As <IQueryable <TaskManager.DataModel.Task> >().Setup(m => m.Expression).Returns(data.Expression); mockSet.As <IQueryable <TaskManager.DataModel.Task> >().Setup(m => m.ElementType).Returns(data.ElementType); mockSet.As <IQueryable <TaskManager.DataModel.Task> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator()); mockSet.As <IQueryable <TaskManager.DataModel.Task> >().Setup(m => m.Provider).Returns(data.Provider); var mockContext = new Mock <TaskManagerContext>(); mockContext.Setup(m => m.tasks).Returns(mockSet.Object); var service = new TaskServices(mockContext.Object); List <TaskDTO> taskList = service.GetTasks(); Assert.That(taskList.Count == 1); } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.That(1 == 0); } }
public HttpResponseMessage GetTaskList(string standardEffDate, int?siteId, int?programId, int?assignedToUserId, int?assignedByUserId) { try { var taskList = TaskServices.GetTaskList(standardEffDate, siteId, programId, assignedToUserId, assignedByUserId); if (taskList != null) { taskList.ForEach(m => { m.TaskName = (m.TaskName.Length > 25 ? m.TaskName.Substring(0, 24) + "...." : m.TaskName); m.TracerName = (m.TracerName.Trim().EndsWith("-") ? m.TracerName.Trim().Replace("-", "") : m.TracerName); m.Std = m.TaskTypeID == 5 & m.TracerResponseID > 0 ? TracerService.GetAllsStdsByTracerQuestion(m.TracerCustomID, m.TracerResponseID, m.TracerQuestionID, false) : m.Std; }); return(Request.CreateResponse(HttpStatusCode.OK, taskList)); } return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Tasks Found")); } catch (Exception ex) { ex.Data.Add("SiteID", siteId); ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/GetTaskList"); WebExceptionHelper.LogException(ex, null); return(null); } }
public void TestGetAllTask_Empty() { try { var data = new List <TaskManager.DataModel.Task>() { }.AsQueryable(); var mockSet = new Mock <DbSet <TaskManager.DataModel.Task> >(); mockSet.As <IQueryable <TaskManager.DataModel.Task> >().Setup(m => m.Provider).Returns(data.Provider); mockSet.As <IQueryable <TaskManager.DataModel.Task> >().Setup(m => m.Expression).Returns(data.Expression); mockSet.As <IQueryable <TaskManager.DataModel.Task> >().Setup(m => m.ElementType).Returns(data.ElementType); mockSet.As <IQueryable <TaskManager.DataModel.Task> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator()); mockSet.As <IQueryable <TaskManager.DataModel.Task> >().Setup(m => m.Provider).Returns(data.Provider); var mockContext = new Mock <TaskManagerContext>(); mockContext.Setup(m => m.tasks).Returns(mockSet.Object); var service = new TaskServices(mockContext.Object); List <TaskDTO> taskList = service.GetTasks(); Assert.That(taskList.Count == 0); } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.That(1 == 0); } }
/// <summary>Downloads the resource with the specified URI as a byte array, asynchronously.</summary> /// <param name="webClient">The WebClient.</param> /// <param name="address">The URI from which to download data.</param> /// <returns>A Task that contains the downloaded data.</returns> public static Task <byte[]> DownloadDataTaskAsync(this WebClient webClient, Uri address) { // Create the task to be returned var tcs = new TaskCompletionSource <byte[]>(address); // Setup the callback event handler DownloadDataCompletedEventHandler completedHandler = null; completedHandler = (sender, e) => TaskServices.HandleEapCompletion(tcs, true, e, () => e.Result, () => webClient.DownloadDataCompleted -= completedHandler); webClient.DownloadDataCompleted += completedHandler; // Start the async operation. try { webClient.DownloadDataAsync(address, tcs); } catch { webClient.DownloadDataCompleted -= completedHandler; throw; } // Return the task that represents the async operation return(tcs.Task); }
/// <summary>Downloads the resource with the specified URI to a local file, asynchronously.</summary> /// <param name="webClient">The WebClient.</param> /// <param name="address">The URI from which to download data.</param> /// <param name="fileName">The name of the local file that is to receive the data.</param> /// <returns>A Task that contains the downloaded data.</returns> public static Task DownloadFileTaskAsync(this WebClient webClient, Uri address, string fileName) { // Create the task to be returned var tcs = new TaskCompletionSource <object>(address); // Setup the callback event handler AsyncCompletedEventHandler completedHandler = null; completedHandler = (sender, e) => TaskServices.HandleEapCompletion(tcs, true, e, () => null, () => { webClient.DownloadFileCompleted -= completedHandler; }); webClient.DownloadFileCompleted += completedHandler; // Start the async operation. try { webClient.DownloadFileAsync(address, fileName, tcs); } catch { webClient.DownloadFileCompleted -= completedHandler; throw; } // Return the task that represents the async operation return(tcs.Task); }
///<summary> ///Flushes asynchronously the current stream. ///</summary> ///<returns>A Task that represents the asynchronous flush.</returns> public static Task FlushAsync(this System.IO.Stream source, System.Threading.CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return(TaskServices.FromCancellation(cancellationToken)); } return(Task.Factory.StartNew(s => ((System.IO.Stream)s).Flush(), source, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default)); }
///<summary> ///Writes asynchronously a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written. ///</summary> ///<returns>A Task that represents the asynchronous write.</returns> ///<param name="source">The source.</param> ///<param name="buffer">The buffer containing data to write to the current stream.</param> ///<param name="offset">The zero-based byte offset in at which to begin copying bytes to the current stream.</param> ///<param name="count">The maximum number of bytes to write. </param> /// <param name="cancellationToken">The cancellation token.</param> ///<exception cref="T:System.ArgumentException"> length minus <paramref name="offset" /> is less than <paramref name="count" />. </exception> ///<exception cref="T:System.ArgumentNullException"> is null. </exception> ///<exception cref="T:System.ArgumentOutOfRangeException"> or <paramref name="count" /> is negative. </exception> ///<exception cref="T:System.NotSupportedException">The stream does not support writing. </exception> ///<exception cref="T:System.ObjectDisposedException">The stream is closed. </exception> ///<exception cref="T:System.IO.IOException">An I/O error occurred. </exception> public static Task WriteAsync(this System.IO.Stream source, byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return(TaskServices.FromCancellation(cancellationToken)); } return(Task.Factory.FromAsync(source.BeginWrite, source.EndWrite, buffer, offset, count, null)); }
private async void SubmitNewTaskCommandAct() { //TODO API call _ = new TaskServices().AddNewTask(_task, _taskListViewModel.ServiceVisitId); Boolean _result = true; MessagingCenter.Send(this, "TaskSubmitStatus", _result); }
/// Creates a new Task object for the given coroutine. /// /// If autoStart is true (default) the task is automatically started /// upon construction. public Task(IEnumerator c, bool autoStart = true) { state = TaskServices.CreateTask(c); if (autoStart) { Start(); } }
public TestCommentPageViewModel() { ImageUrl = "upload_image"; AddCommentCommand = new Command <Task>(async(Task task) => await AddComment()); UpdateImageCommand = new Command <MediaFile>(async(MediaFile NewImage) => await UpdateImageCommandActAsync(NewImage)); taskService = new TaskServices(); mediaServices = new MediaServices(); IsBusy = false; }
public static TaskState CreateTask(IEnumerator coroutine) { if (singleton == null) { GameObject go = new GameObject("TaskManager"); DontDestroyOnLoad(go); singleton = go.AddComponent <TaskServices>(); } return(new TaskState(coroutine)); }
/// <summary> /// Initializes a new instance of the <see cref="StreakServices"/> class. /// </summary> /// <param name="apiKey">The API key.</param> /// <param name="apiBaseUrl">The API base URL.</param> /// <param name="includeRawResponse">if set to <c>true</c> [include raw JSON response from Streak API].</param> public StreakServices(string apiKey, string apiBaseUrl, bool includeRawResponse) { Users = new UserServices(apiKey, apiBaseUrl, includeRawResponse); Pipelines = new PipelineServices(apiKey, apiBaseUrl, includeRawResponse); Boxes = new BoxServices(apiKey, apiBaseUrl, includeRawResponse); Stages = new StageServices(apiKey, apiBaseUrl, includeRawResponse); Fields = new FieldServices(apiKey, apiBaseUrl, includeRawResponse); Tasks = new TaskServices(apiKey, apiBaseUrl, includeRawResponse); Tasks = new TaskServices(apiKey, apiBaseUrl, includeRawResponse); Files = new FileServices(apiKey, apiBaseUrl, includeRawResponse); Threads = new ThreadServices(apiKey, apiBaseUrl, includeRawResponse); Comments = new CommentServices(apiKey, apiBaseUrl, includeRawResponse); Snippets = new SnippetServices(apiKey, apiBaseUrl, includeRawResponse); }
public HttpResponseMessage GetChapterStandardByEPTextID(string standardEffBeginDate, int epTextID, int programID) { try { var ChapterStandard = TaskServices.GetChapterStandardByEPTextID(standardEffBeginDate, epTextID, programID); return(Request.CreateResponse(HttpStatusCode.OK, ChapterStandard)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/GetChapterStandardByEPTextID"); WebExceptionHelper.LogException(ex, null); return(Request.CreateResponse(HttpStatusCode.OK, string.Empty)); } }
public HttpResponseMessage GetStandardByChapterList(string standardEffBeginDate, int?productType, int?programId, int?chapterId, int?siteId, int?userId, int?serviceProfileTypeId, int?certificationItemId) { try { var StandardList = TaskServices.GetStandardByChapterList(standardEffBeginDate, productType, programId, chapterId, siteId, userId, serviceProfileTypeId, certificationItemId); return(Request.CreateResponse(HttpStatusCode.OK, StandardList)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/GetStandardByChapterList"); WebExceptionHelper.LogException(ex, null); return(Request.CreateResponse(HttpStatusCode.OK, string.Empty)); } }
public HttpResponseMessage ResendTaskEmail([FromBody] ResendTaskEmail resendTaskEmail) { try { Task.Factory.StartNew(() => TaskServices.ResendTaskEmail(resendTaskEmail.TaskIDs, resendTaskEmail.SiteID, resendTaskEmail.ProgramID, resendTaskEmail.UserID)); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/ResendTaskEmail"); WebExceptionHelper.LogException(ex, null); return(Request.CreateResponse(HttpStatusCode.OK, string.Empty)); } }
public HttpResponseMessage GetTagsByCopAndProgramID(int?programId, string copName) { try { var TagList = TaskServices.GetTagsByCopAndProgramID(programId, copName); return(Request.CreateResponse(HttpStatusCode.OK, TagList)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/GetTagsByCopAndProgramID"); WebExceptionHelper.LogException(ex, null); return(Request.CreateResponse(HttpStatusCode.OK, string.Empty)); } }
public HttpResponseMessage GetCOPList(int?siteId, int?programId) { try { var COPList = TaskServices.GetCOPList(siteId, programId); return(Request.CreateResponse(HttpStatusCode.OK, COPList)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/GetCOPList"); WebExceptionHelper.LogException(ex, null); return(Request.CreateResponse(HttpStatusCode.OK, string.Empty)); } }
public HttpResponseMessage GetTracerById(int?tracerCustomId) { try { var _result = TaskServices.GetTracerById(tracerCustomId); return(Request.CreateResponse(HttpStatusCode.OK, _result)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/GetTracerById"); WebExceptionHelper.LogException(ex, null); return(Request.CreateResponse(HttpStatusCode.OK, string.Empty)); } }
public HttpResponseMessage GetCopTagByCmsStandardId(int?programId, int?cmsStandardId) { try { var _result = TaskServices.GetCopTagByCmsStandardId(programId, cmsStandardId); return(Request.CreateResponse(HttpStatusCode.OK, _result)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/GetCopTagByCmsStandardId"); WebExceptionHelper.LogException(ex, null); return(Request.CreateResponse(HttpStatusCode.OK, string.Empty)); } }
public HttpResponseMessage GetMaxTaskAssignedDate(string taskIds) { try { var MaxAssignedDate = TaskServices.GetMaxTaskAssignedDate(taskIds); return(Request.CreateResponse(HttpStatusCode.OK, MaxAssignedDate)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/GetMaxTaskAssignedDate"); WebExceptionHelper.LogException(ex, null); return(Request.CreateResponse(HttpStatusCode.OK, string.Empty)); } }
public HttpResponseMessage GetTaskDetails(int?taskId, string standardEffBeginDate, int?programId) { try { var TaskDetails = TaskServices.GetTaskDetails(taskId, standardEffBeginDate, programId); return(Request.CreateResponse(HttpStatusCode.OK, TaskDetails)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/GetTaskDetails"); WebExceptionHelper.LogException(ex, null); return(Request.CreateResponse(HttpStatusCode.OK, string.Empty)); } }
public HttpResponseMessage DeleteTasks([FromBody] string taskIds) { try { TaskServices.DeleteTasks(taskIds); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/DeleteTasks"); WebExceptionHelper.LogException(ex, null); return(null); } }
public HttpResponseMessage UpdateTaskObservationAssoc([FromBody] TaskObservationAssociation tskObsObj) { try { TaskServices.UpdateTaskObservationAssoc(tskObsObj.TracerResponseId, tskObsObj.TaskIDs); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { ex.Data.Add("tracerResponseId", tskObsObj.TracerResponseId); ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/UpdateTaskObservationAssoc"); WebExceptionHelper.LogException(ex, null); return(null); } }
public void ResetEditionStartDateDifferences(string key) { if (key == WebConfigHelper.TaskSchedulerSecretKey) { try { TaskServices.ResetEditionStartDateDifferences(); var log = CreateInternalLog("One-time task ResetEditionStartDateDifferences completed.", AutoIntegrationUser); ExternalLogHelper.Log(log, LoggingEventType.Information); } catch (Exception exc) { var message = "One-time task ResetEditionStartDateDifferences failed! " + exc.GetFullMessage(); ExternalLogHelper.Log(message, LoggingEventType.Error); } } }
public HttpResponseMessage ReAssignTask([FromBody] ReAssignTasks raTasks) { try { var lstPreviousTasks = TaskServices.GetTaskDetailsForSendingEmail(raTasks.LstTaskIDs.ToString(), raTasks.SiteID, raTasks.ProgramID, raTasks.UpdatedByUserID); TaskServices.ReAssignTask(raTasks); Task.Factory.StartNew(() => TaskServices.SendTaskReassignedEmail(raTasks.LstTaskIDs, raTasks.SiteID, raTasks.ProgramID, raTasks.UpdatedByUserID, lstPreviousTasks)); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/ReAssignTask"); WebExceptionHelper.LogException(ex, null); return(Request.CreateResponse(HttpStatusCode.OK, string.Empty)); } }
public HttpResponseMessage UpdateSiteEmailNotificationSettings([FromBody] SiteEmailNotificationSetting siteEmailNotificationSetting) { try { TaskServices.UpdateSiteEmailNotificationSettings(siteEmailNotificationSetting.SiteID, siteEmailNotificationSetting.SendEmailOnTaskCreation, siteEmailNotificationSetting.SendEmailBeforeTaskDue, siteEmailNotificationSetting.DaysBeforeTaskDue, siteEmailNotificationSetting.SendEmailsAfterTaskDue, siteEmailNotificationSetting.DaysAfterTaskDue , siteEmailNotificationSetting.SendRemainderEmailAfterTaskDue, siteEmailNotificationSetting.SendTaskReportToCC, siteEmailNotificationSetting.TaskReportToCCScheduleTypeID, siteEmailNotificationSetting.SendTaskReportToUsers, siteEmailNotificationSetting.TaskReportToUsersScheduleTypeID, siteEmailNotificationSetting.TaskReportRecipients , siteEmailNotificationSetting.SendEmailOnAssigningEP, siteEmailNotificationSetting.TaskDueRecipientType, siteEmailNotificationSetting.UpdatedBy); Task.Factory.StartNew(() => TaskServices.DisableTaskNotificationScheduleType(DisableTaskNotificationScheduleType.EmailSetting, siteEmailNotificationSetting.SiteID, siteEmailNotificationSetting.UpdatedBy)); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception ex) { ex.Data.Add("siteID", siteEmailNotificationSetting.SiteID); ex.Data.Add("HTTPReferrer", "JCRAPI/TaskInfo/UpdateSiteEmailNotificationSettings"); WebExceptionHelper.LogException(ex, null); return(null); } }
public TestListPageViewModel(List <CheckItemViewModel> checkItems, List <CommentViewModel> comments, TaskResultStatus?lastResult, TaskResultStatus thisResult, int serviceVisitId, int serviceVisitItemNumber) { CheckItems = new ObservableCollection <CheckItemViewModel>(); Comments = new ObservableCollection <CommentViewModel>(comments); LastResult = lastResult; ThisResult = thisResult; _serviceVisitId = serviceVisitId; _serviceVisitItemNumber = serviceVisitItemNumber; //need to create each one so that if user click back without saving, the changes are not saved foreach (CheckItemViewModel item in checkItems) { CheckItemViewModel tempItem = new CheckItemViewModel(); tempItem.Id = item.Id; tempItem.StepNumber = item.StepNumber; tempItem.Description = item.Description; tempItem.Status = item.Status; tempItem.Comment = item.Comment; tempItem.Fields = new ObservableCollection <CheckItemFieldViewModel>(); if (item.Fields != null) { foreach (CheckItemFieldViewModel field in item.Fields) { CheckItemFieldViewModel tempField = new CheckItemFieldViewModel(); tempField.Description = field.Description; tempField.Value = field.Value; tempField.FieldType = field.FieldType; tempItem.Fields.Add(tempField); } } CheckItems.Add(tempItem); } _taskServices = new TaskServices(); //instantiate commands NavigateToAddCommentCommand = new Command(NavigateToAddComment); ChangePassStatusCommand = new Command(ChangePassStatus); ChangeFailStatusCommand = new Command(ChangeFailStatus); SaveTaskTestCommand = new Command <Task>(async(Task task) => await SaveTaskTest()); }