public static bool HasComments(this OapGenericCheckListFlatModel question, RigOapChecklist rigOapChecklist) { IOAPServiceDataModel dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Comment); IEnumerable <CommentModel> comments = dataModel.GetItems(string.Format("QuestionId=\"{0}\" AND SourceFormId=\"{1}\"", question.QuestionId, rigOapChecklist.Id.ToString()), "Id").Cast <CommentModel>(); return(comments.Count() > 0); }
private void LessonLearnedViewBag(dynamic viewBag) { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearnedType); IEnumerable <LessonLearnedType> types = dataModel.GetAllItems().Cast <LessonLearnedType>(); viewBag.LessonTypes = types; }
// GET: IRMA/LessonsLearned public ActionResult Index() { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); var lessonsLearned = dataModel.GetAllItems().Cast <LessonLearnedModel>().ToList(); return(View(lessonsLearned)); }
public ActionResult ApprovalProcessApproval(int Id, int ApprovalId, int Approver, int Status, string Comment) { string comment = (Comment == "null") ? "" : Comment; // DevExpress sending the 'null' string when textbox is empty LessonLearnedModel lessonLearned = (LessonLearnedModel)Session["LessonLearnedModel"]; IIrmaServiceDataModel serviceSystem = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); ApprovalModel approval = serviceSystem.GetItem(string.Format("Id={0}", ApprovalId), "Id"); approval.ApprovedDate = DateTime.Now; approval.ApproverComments = Comment; approval.Status = Status; lessonLearned.Approvals.FirstOrDefault(a => a.Id == ApprovalId).Status = Status; switch (Status) { case (int)IrmaConstants.ApprovalStatus.Approved: var approvedCount = lessonLearned.GetApprovals().Where(a => a.Status == (int)IrmaConstants.ApprovalStatus.Approved).Count(); var totalCount = lessonLearned.GetApprovals().Count(); if (approvedCount == totalCount) // Proceeds with the workflow / auto close { lessonLearned.Status = "Closed"; } break; case (int)IrmaConstants.ApprovalStatus.Rejected: lessonLearned.Status = "Rejected"; approval.ApproverComments = Comment; break; } dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); dataModel.Update(lessonLearned); serviceSystem.Update(approval); return(RedirectToAction("Edit", new { Id = Id })); }
public ActionResult ControlAddReview(ReviewModel reviewModel, string SourceForm, string SourceFormId) { if (ModelState.IsValid) { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Review); BusinessUnitModel businessUnit = ServiceSystem.GetBusinessUnitByRigId(UtilitySystem.Settings.RigId); ReviewModel newReview = new ReviewModel() { RigId = UtilitySystem.Settings.RigId, Comment = reviewModel.Comment, ReviewerPassportId = reviewModel.ReviewerPassportId, RequestedBy = UtilitySystem.CurrentUserId, SourceBU = businessUnit.Id, SourceForm = SourceForm, SourceFormId = SourceFormId.ToString(), DateCreated = DateTimeOffset.Now }; dataModel.Add(newReview); ServiceSystem.AddTask(sourceForm: "Review", sourceFormId: SourceFormId, assigneeUserId: newReview.ReviewerPassportId, dueDate: reviewModel.DueDate, sourceFormUrl: Request.UrlReferrer.PathAndQuery); } else { ViewData["UpdateError"] = true; } return(Control(SourceForm, SourceFormId)); }
public ActionResult InlineControlAdd(CommentModel rowModel, string SourceForm, string SourceFormId, string QuestionId, string QuestionText) { if (ModelState.IsValid) { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Comment); CommentModel newComment = new CommentModel() { SourceForm = SourceForm, SourceFormId = SourceFormId, QuestionId = QuestionId, CommentDate = DateTimeOffset.Now, CommenterPassport = GetUserPassportId(), QuestionText = QuestionText, Comment = rowModel.Comment, Rig = UtilitySystem.Settings.RigId }; newComment = dataModel.Add(newComment); } else { ViewData["UpdateError"] = true; } return(InlineControl(SourceForm, SourceFormId, QuestionId, QuestionText)); }
public ActionResult LessonsLearnedAddOriginatorsPartial(LL_EditOriginatorsGridRowModel rowModel) { // Add Originator logic var lessonLearnedModel = (LessonLearnedModel)Session["LessonLearnedModel"]; List <LessonLearnedOriginatorModel> originators = lessonLearnedModel.Originators; if (ModelState.IsValid) { LessonLearnedOriginatorModel newOriginator = new LessonLearnedOriginatorModel() { LessonId = lessonLearnedModel.Id, PassportId = rowModel.PassportId, RigFacility = rowModel.RigFacility }; var user = ServiceSystem.GetUser(rowModel.PassportId); newOriginator.Position = (int)user.Position; if (Ensco.Utilities.UtilitySystem.Settings.RigId != 1) { newOriginator.RigFacility = Ensco.Utilities.UtilitySystem.Settings.RigId; } dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearnedOriginator); newOriginator = dataModel.Add(newOriginator); originators.Add(newOriginator); } else { ViewData["UpdateError"] = true; } return(LessonsLearnedOriginatorsPartial()); //return PartialView("LessonLearnedOriginatorsPartial", originators); }
public ActionResult ControlAddRow(CommentModel commentModel, string sourceForm, string sourceFormId) { ViewBag.SouceForm = sourceForm; ViewBag.SourceFormId = sourceFormId; if (ModelState.IsValid) { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Comment); string key = HttpContext.Session.SessionID + "_UserSessionInfo"; UserSession userSession = (UserSession)HttpContext.Session[key]; CommentModel newComment = new CommentModel { Comment = commentModel.Comment, CommentDate = DateTimeOffset.Now, CommenterPassport = userSession.UserId, Rig = UtilitySystem.Settings.RigId, SourceForm = sourceForm, SourceFormId = sourceFormId }; newComment = dataModel.Add(newComment); } else { ViewData["UpdateError"] = true; } return(Control(sourceForm, sourceFormId)); }
public PartialViewResult IndexLessonsAddGridView(LL_IndexGridRowModel rowModel) { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); BusinessUnitModel objBU = ServiceSystem.GetBusinessUnitByRigId(UtilitySystem.Settings.RigId); if (ModelState.IsValid) { var newLesson = new LessonLearnedModel() { DateStarted = DateTimeOffset.Now, Title = rowModel.Title, ImpactLevel = rowModel.ImpactLevel, Status = LessonsLearnedStatus.Open.ToString(), SourceForm = "Lessons Learned", SourceRigFacility = UtilitySystem.Settings.RigId, SourceBU = objBU.Id, TypeId = rowModel.TypeId }; dataModel.Add(newLesson); } else { ViewData["UpdateError"] = true; } return(IndexLessonsGridView()); }
public ActionResult Edit([Bind(Include = "Id,Comment")] ReviewModel model) { ReviewModel review = OAPServiceSystem.GetReview(model.Id); review.Comment = model.Comment; OAPServiceSystem.UpdateReview(review); return(Edit(model.Id)); }
public ActionResult Cancel(int id) { LessonLearnedModel lessonLearned = OAPServiceSystem.GetLessonLearned(id); lessonLearned.Status = "Canceled"; dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); dataModel.Update(lessonLearned); return(RedirectToAction("Index")); }
public ActionResult ControlDeleteRow(int Id, string sourceForm, string sourceFormId) { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Comment); CommentModel comment = dataModel.GetItem(string.Format("Id={0}", Id), "Id"); if (comment != null) { dataModel.Delete(comment); } return(Control(sourceForm, sourceFormId)); }
public ActionResult ControlSignReview(int Id, string Comment, string returnUrl = null) { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Review); ReviewModel review = dataModel.GetItem(string.Format("Id={0}", Id), "Id"); review.ReviewDate = DateTimeOffset.Now; review.Comment = Comment; dataModel.Update(review); return(Redirect(returnUrl ?? "Index")); }
public ActionResult InlineControlDelete(int Id, string SourceForm, string SourceFormId, string QuestionId, string QuestionText) { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Comment); CommentModel comment = dataModel.GetItem(string.Format("Id={0}", Id), "Id"); if (comment != null) { dataModel.Delete(comment); } return(InlineControl(SourceForm, SourceFormId, QuestionId, QuestionText)); }
// GET: IRMA/Comments public ActionResult GetAllComments() { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Comment); IEnumerable <CommentModel> comments = dataModel.GetAllItems().Cast <CommentModel>(); foreach (CommentModel comment in comments) { UserModel user = ServiceSystem.GetUser((int)comment.CommenterPassport); // Populates position field comment.Position = (int)user.Position; } return(PartialView("GetAllComments", comments)); }
public ActionResult GetAllReviews() { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Review); IEnumerable <ReviewModel> reviews = dataModel.GetAllItems().Cast <ReviewModel>(); foreach (ReviewModel review in reviews) { review.Attachments = ServiceSystem.GetAttachments("Review", review.Id.ToString()); } return(PartialView("GetAllReviews", reviews)); }
public ActionResult LessonsLearnedApprovalAddPartial(ApprovalModel rowModel) { if (ModelState.IsValid) { var lessonModel = (LessonLearnedModel)Session["LessonLearnedModel"]; rowModel.RequestInfo = Url.Action("ApprovalProcessApproval"); OAPServiceSystem.AddApprover(rowModel, lessonModel); } else { ViewData["UpdateError"] = true; } return(LessonsLearnedApprovalPartial()); }
public ActionResult Control(string SourceForm, string SourceFormId) { ViewBag.SourceForm = SourceForm; ViewBag.SourceFormId = SourceFormId; dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Review); IEnumerable <ReviewModel> reviews = dataModel.GetItems(string.Format("SourceForm=\"{0}\" AND SourceFormId=\"{1}\"", SourceForm, SourceFormId), "Id").Cast <ReviewModel>(); foreach (ReviewModel review in reviews) { review.Attachments = ServiceSystem.GetAttachments("Review", review.Id.ToString()); } return(PartialView("Control", reviews)); }
public ActionResult LessonsLearnedDeleteOriginatorsPartial(int Id) { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearnedOriginator); var originator = (LessonLearnedOriginatorModel)dataModel.GetItem(string.Format("Id={0}", Id), "Id"); if (originator != null) { dataModel.Delete(originator); var lessonLearnedModel = (LessonLearnedModel)Session["LessonLearnedModel"]; lessonLearnedModel.Originators.RemoveAll(o => o.Id == originator.Id); } return(LessonsLearnedOriginatorsPartial()); }
public ActionResult InlineControlUpdate(CommentModel rowModel, string SourceForm, string SourceFormId, string QuestionId, string QuestionText) { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Comment); CommentModel comment = dataModel.GetItem(string.Format("Id={0}", rowModel.Id), "Id"); if (comment != null) { comment.Comment = rowModel.Comment; comment.CommentDate = DateTimeOffset.Now; comment.CommenterPassport = GetUserPassportId(); dataModel.Update(comment); } return(InlineControl(SourceForm, SourceFormId, QuestionId, QuestionText)); }
public ActionResult Close(int?id) { if (!id.HasValue) { return(RedirectToAction("Index")); } dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); LessonLearnedModel lessonLearned = OAPServiceSystem.GetLessonLearned(id.Value); lessonLearned.Status = "Closed"; Session["LessonLearnedModel"] = lessonLearned; dataModel.Update(lessonLearned); return(RedirectToAction("Index")); }
public PartialViewResult IndexLessonsGridView() { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); var lessonsLearned = dataModel.GetAllItems().Cast <LessonLearnedModel>().ToList(); dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearnedType); LessonLearnedViewBag(ViewBag); foreach (var lesson in lessonsLearned) { if (lesson.TypeId != null) { lesson.Type = dataModel.GetItem(string.Format("Id={0}", lesson.TypeId), "Id"); } } return(PartialView("IndexLessonsGridView", lessonsLearned)); }
public ActionResult Control(string sourceForm, string sourceFormId, bool readOnly = false) { // This will return records with QuestionId = null dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Comment); IEnumerable <CommentModel> comments = dataModel.GetItems(string.Format("SourceForm=\"{0}\" AND SourceFormId=\"{1}\" AND QuestionId=null", sourceForm, sourceFormId), "Id").Cast <CommentModel>(); foreach (CommentModel comment in comments) { UserModel user = ServiceSystem.GetUser((int)comment.CommenterPassport); // Populates position field comment.Position = (int)user.Position; } ViewBag.SourceForm = sourceForm; ViewBag.SourceFormId = sourceFormId; ViewBag.ReadOnly = readOnly; return(PartialView("Control", comments)); }
public ActionResult Edit(int id) { LessonLearnedModel lessonLearned = OAPServiceSystem.GetLessonLearned(id); Session["LessonLearnedModel"] = lessonLearned; ViewBag.LessonStatus = lessonLearned.Status; LessonLearnedViewBag(ViewBag); ViewBag.IsEditable = lessonLearned.IsEditable; ViewBag.ImpactLevels = Enum.GetNames(typeof(LessonsLearnedImpact)).ToList(); if (lessonLearned != null) { return(View("LessonForm", lessonLearned)); } return(RedirectToAction("Index")); }
public ActionResult InlineControl(string SourceForm, string SourceFormId, string QuestionId, string QuestionText, bool readOnly = false) { ViewBag.ReadOnly = readOnly; ViewBag.SourceForm = SourceForm; ViewBag.SourceFormId = SourceFormId; ViewBag.QuestionId = QuestionId; ViewBag.QuestionText = QuestionText; dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.Comment); IEnumerable <CommentModel> comments = dataModel.GetItems(string.Format("SourceFormId=\"{0}\" AND QuestionId=\"{1}\"", SourceFormId, QuestionId), "Id").Cast <CommentModel>(); foreach (CommentModel comment in comments) { UserModel user = ServiceSystem.GetUser(comment.CommenterPassport); // Populates position field comment.Position = (int)user.Position; } return(PartialView("InlineControl", comments)); }
public PartialViewResult Control(string SourceForm, int SourceFormId) { ViewBag.SourceForm = SourceForm; ViewBag.SourceFormId = SourceFormId; dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); var lessonsLearned = dataModel.GetItems(string.Format("SourceForm=\"{0}\" AND SourceFormId={1}", SourceForm, SourceFormId), "Id").Cast <LessonLearnedModel>().ToList(); dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearnedType); LessonLearnedViewBag(ViewBag); foreach (var lesson in lessonsLearned) { if (lesson.TypeId != null) { lesson.Type = dataModel.GetItem(string.Format("Id={0}", lesson.TypeId), "Id"); } } return(PartialView("Control", lessonsLearned)); }
public ActionResult SubmitForApproval() { LessonLearnedModel lessonLearned = (LessonLearnedModel)Session["LessonLearnedModel"]; if (lessonLearned == null) { return(RedirectToAction("Index")); } var approvals = lessonLearned.Approvals.Where(a => a.Type == (int)ApprovalModel.ApprovalType.LessonsLearnedApproval); var approvalDataModel = IrmaServiceSystem.GetServiceModel(IrmaConstants.IrmaPobModels.Approval); foreach (var approval in approvals) { approval.Status = (int)IrmaConstants.ApprovalStatus.PendingApproval; approvalDataModel.Update(approval); } lessonLearned.Status = "Pending Approval"; dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); dataModel.Update(lessonLearned); return(RedirectToAction("Edit", new { Id = lessonLearned.Id })); }
public PartialViewResult ControlAddGridRow(LL_IndexGridRowModel rowModel, string SourceForm, int SourceFormId) { dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); BusinessUnitModel objBU = ServiceSystem.GetBusinessUnitByRigId(UtilitySystem.Settings.RigId); if (ModelState.IsValid) { var newLesson = new LessonLearnedModel() { DateStarted = DateTimeOffset.Now, Title = rowModel.Title, ImpactLevel = rowModel.ImpactLevel, SourceRigFacility = UtilitySystem.Settings.RigId, SourceBU = objBU.Id, TypeId = rowModel.TypeId, Status = LessonsLearnedStatus.Open.ToString(), SourceForm = SourceForm, SourceFormId = SourceFormId, SourceFormURL = Request.UrlReferrer.AbsoluteUri }; newLesson = dataModel.Add(newLesson); dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearnedOriginator); LessonLearnedOriginatorModel originator = new LessonLearnedOriginatorModel(); originator.LessonId = newLesson.Id; string key = HttpContext.Session.SessionID + "_UserSessionInfo"; UserSession userSession = (UserSession)HttpContext.Session[key]; originator.PassportId = userSession.UserId; originator.RigFacility = UtilitySystem.Settings.RigId; dataModel.Add(originator); } else { ViewBag.UpdateError = string.Join(",", ModelState.Values.SelectMany(e => e.Errors).Select(e => e.ErrorMessage)); } return(Control(SourceForm, SourceFormId)); }
public RedirectToRouteResult Save([ModelBinder(typeof(DevExpressEditorsBinder))] LessonLearnedModel formLessonModel) { LessonLearnedModel lessonLearned = (LessonLearnedModel)Session["LessonLearnedModel"]; List <LessonLearnedOriginatorModel> originators = lessonLearned.Originators; if (originators.Count == 0) { return(RedirectToAction("Edit", new { Id = lessonLearned.Id })); } lessonLearned.TypeId = formLessonModel.TypeId; lessonLearned.Title = formLessonModel.Title; lessonLearned.SourceBU = formLessonModel.SourceBU; lessonLearned.SourceRigFacility = formLessonModel.SourceRigFacility; lessonLearned.Topic = formLessonModel.Topic; lessonLearned.ImpactLevel = formLessonModel.ImpactLevel; lessonLearned.eMocId = formLessonModel.eMocId; lessonLearned.Description = formLessonModel.Description; dataModel = OAPServiceSystem.GetServiceModel(OAPServiceSystem.OAPDataModelType.LessonLearned); dataModel.Update(lessonLearned); return(RedirectToAction("Edit", new { Id = lessonLearned.Id })); }
public ActionResult Edit(int id) { ReviewModel review = OAPServiceSystem.GetReview(id); return(View(review)); }