private RigOapChecklist CreateFSOChecklist(int OwnerId, string Title, DateTime ChecklistDateTime) { OapChecklist oapChecklist = OapChecklistClient.GetByNameAsync("FSO Checklist").Result?.Result?.Data; if (oapChecklist == null) { ViewData["UpdateError"] = true; return(null); } RigOapChecklist checklist = new RigOapChecklist(); checklist.CreatedBy = UtilitySystem.CurrentUserName; checklist.OwnerId = OwnerId; //UtilitySystem.CurrentUserId; checklist.CreatedDateTime = DateTime.UtcNow; checklist.ChecklistDateTime = ChecklistDateTime; //DateTime.UtcNow; checklist.Title = Title; checklist.UpdatedDateTime = DateTime.UtcNow; checklist.Status = "Open"; checklist.OapchecklistId = oapChecklist.Id; var newChecklist = RigOapChecklistClient.AddRigChecklistAsync(checklist).Result?.Result?.Data; return(newChecklist); }
public async Task <ActionResult> AddScheduledChecklist(int numberOfDays, DateTime StartingAt, string title, string description) { if (StartingAt != null && numberOfDays > 0) { var lifeSaverChecklist = OapChecklistClient.GetByNameAsync("Life Savers").Result?.Result?.Data; if (lifeSaverChecklist == null) { throw new Exception("The life savers checklist was not found. Please contact the development support team"); } for (int i = 0; i < numberOfDays; i++) { var checklistDate = StartingAt.AddDays(i); RigOapChecklist checklist = new RigOapChecklist() { Status = "Open", ChecklistDateTime = checklistDate, OapchecklistId = lifeSaverChecklist.Id, IsAutoScheduled = true, //RigId = UtilitySystem.Settings.RigId.ToString(), Title = title, Description = description, CreatedDateTime = DateTime.UtcNow }; await RigOapChecklistClient.AddRigChecklistAsync(checklist); } } return(DisplayLifeSaverScheduleAbdJobs()); }
private OapChecklist GetCorporateFSOChecklist() { if (corpFSOChecklist == null) { corpFSOChecklist = OapChecklistClient.GetByNameAsync("FSO Checklist").Result?.Result?.Data; } return(corpFSOChecklist); }