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 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> AddChecklist(RigOapChecklist model) { //model.RigId = OapUtilities.GetRigId(); model.CreatedDateTime = DateTime.UtcNow; var response = await RigOapChecklistClient.AddRigChecklistAsync(model); return(RigChecklists()); }
public virtual async Task <ActionResult> CreateRigChecklist(RigOapChecklist model) { // TODO: Add insert logic here model.RigId = "0"; var response = await RigOapChecklistClient.AddRigChecklistAsync(model); if (ModelState.ContainsKey("RigChecklistUniqueId")) // Handled in the API { ModelState["RigChecklistUniqueId"].Errors.Clear(); } return(RigChecklists()); }