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 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 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 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 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 IEnumerable<CommentModel> GetComments(Guid guid) //{ //} #endregion #region Reviews logics public static ReviewModel AddReview(ReviewModel model) { IOAPServiceDataModel dataModel = GetServiceModel(OAPDataModelType.Review); model.DateCreated = DateTimeOffset.UtcNow; model.RigId = UtilitySystem.CurrentRigId; model.RequestedBy = UtilitySystem.CurrentUserId; return(dataModel.Add(model)); }
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)); }