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); }
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 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 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)); }