コード例 #1
0
        /// <summary>
        /// Search the definition of the report and show a search criteria and a grid the columns of the report
        /// </summary>
        /// <param name="inspectionReportName">Inspection report name</param>
        /// <returns></returns>
        public ActionResult ChangeReport(string inspectionReportName)
        {
            if (string.IsNullOrEmpty(inspectionReportName))
            {
                inspectionReportName = Session["InspectionReportName"].ToString();
            }
            else
            {
                Session.Add("InspectionReportName", inspectionReportName);
            }
            bool isClient = User.IsInRole("Client");
            Guid businessApplicationId = new Guid(Convert.ToString(Session["BusinessAplicationId"]));
            Guid serviceOrderReportId = new Guid(Session["serviceOrderReportId"].ToString());

            Form formDefinition = ServiceOrderBusiness.GetServiceOrderForm(businessApplicationId, serviceOrderReportId, isClient, true);
            DynamicDataGrid gridColumns = InspectionReportBusiness.GetInspectionReportGridDefinition(businessApplicationId, isClient, inspectionReportName);
            InspectionReportModel model = new InspectionReportModel();
            _captions = gridColumns.Captions;
            model.GridColumns = gridColumns;
            model.Links = InspectionReportBusiness.GetInspectionReportLinks(serviceOrderReportId, isClient);
            model.ServiceOrderHeader = formDefinition.ServiceOrderHeader;
            model.OrderIdentifier = formDefinition.OrderIdentifier;
            model.InspectionReportName = inspectionReportName;
            model.PrincipalFormName = Session["PrincipalFormName"].ToString();
            model.CaptionBreadcrumbsPrincipal = Session["CaptionBreadcrumbs"].ToString();
            model.CaptionTitlePrincipal = Session["CaptionTitle"].ToString();
            return View("Index", model);
        }
コード例 #2
0
        /// <summary>
        /// Call the service order for view
        /// </summary>
        /// <param name="inspectionReportItemIdView">Id of inspection report item</param>
        /// <param name="isPublished">Is or not published</param>
        /// <returns>View with values of the service order to edit</returns>
        public ViewResult ViewInspectionReport(Guid? inspectionReportItemIdView, bool? isPublished)
        {
            InspectionReportModel model = new InspectionReportModel();
            Guid businessApplicationId = new Guid(Convert.ToString(Session["BusinessAplicationId"]));
            Guid serviceOrderReportId = new Guid(Session["serviceOrderReportId"].ToString());
            string inspectionReportName = Session["InspectionReportName"].ToString();
            Form formDefinition = ServiceOrderBusiness.GetServiceOrderForm(businessApplicationId, serviceOrderReportId, User.IsInRole("Client"), true);
            model.Links = InspectionReportBusiness.GetInspectionReportLinks(serviceOrderReportId, User.IsInRole("Client"));
            model.ServiceOrderHeader = formDefinition.ServiceOrderHeader;
            model.OrderIdentifier = formDefinition.OrderIdentifier;
            DynamicDataGrid gridColumns = InspectionReportBusiness.GetInspectionReportGridDefinition(businessApplicationId, false, inspectionReportName);
            _captions = gridColumns.Captions;
            model.GridColumns = gridColumns;

            formDefinition = InspectionReportBusiness.GetInspectionReportDefinition(businessApplicationId, serviceOrderReportId, inspectionReportName, User.IsInRole("Client"), inspectionReportItemIdView);
            model.FormDefinition = formDefinition;

            gridColumns.DataRows = Session["DataRowsInspectionReport"] as IList<DynamicDataRow>;
            DynamicDataRow actualDataRow = gridColumns.DataRows.FirstOrDefault(datarow => datarow.RowIdentifier == inspectionReportItemIdView.GetValueOrDefault());
            model.CanPublish = actualDataRow.CanPublish;
            model.CanValidate = actualDataRow.CanValidate;
            model.ServiceOrderId = serviceOrderReportId;
            model.ScreenOpenMode = ScreenOpenMode.View;
            model.InspectionReportItemId = inspectionReportItemIdView.GetValueOrDefault();
            model.IsPublished = isPublished.GetValueOrDefault();
            model.ApprovalStatus = InspectionReportBusiness.GetCurrentApprovalStatus(Roles.GetRolesForUser(UserName).ToList(), inspectionReportItemIdView.GetValueOrDefault());

            int rowSize = Properties.Settings.Default.PageSizePicture;
            ViewBag.PageSizePicture = rowSize;
            model.PictureModel.PictureList = PictureDocumentBusiness.SearchPicturesInspectionReport(serviceOrderReportId, rowSize, inspectionReportItemIdView.GetValueOrDefault());
            model.PictureModel.ScreenOpenMode = ScreenOpenMode.View;
            model.PrincipalFormName = Session["PrincipalFormName"].ToString();
            model.CaptionBreadcrumbsPrincipal = Session["CaptionBreadcrumbs"].ToString();
            model.CaptionTitlePrincipal = Session["CaptionTitle"].ToString();
            Session.Add("frmNewInspection", model);
            Session.Add("inspectionReportItemId", inspectionReportItemIdView.Value);

            return View("InspectionReport", model);
        }
コード例 #3
0
        /// <summary>
        /// Call to InspectionReport for create a new inspection report
        /// </summary>
        /// <returns>ActionResult</returns>
        public ActionResult NewInspectionReport()
        {
            InspectionReportModel model = new InspectionReportModel();
            Guid businessApplicationId = new Guid(Convert.ToString(Session["BusinessAplicationId"]));
            Guid serviceOrderReportId = new Guid(Session["serviceOrderReportId"].ToString());
            string inspectionReportName = Session["InspectionReportName"].ToString();
            Form formDefinition = ServiceOrderBusiness.GetServiceOrderForm(businessApplicationId, serviceOrderReportId, User.IsInRole("Client"), true);
            model.Links = InspectionReportBusiness.GetInspectionReportLinks(serviceOrderReportId, User.IsInRole("Client"));
            model.ServiceOrderHeader = formDefinition.ServiceOrderHeader;
            model.OrderIdentifier = formDefinition.OrderIdentifier;
            formDefinition = InspectionReportBusiness.GetInspectionReportDefinition(businessApplicationId, serviceOrderReportId, inspectionReportName, User.IsInRole("Client"));

            DynamicDataGrid gridColumns = InspectionReportBusiness.GetInspectionReportGridDefinition(businessApplicationId, false, inspectionReportName);
            _captions = gridColumns.Captions;
            model.GridColumns = gridColumns;
            model.FormDefinition = formDefinition;
            model.ServiceOrderId = serviceOrderReportId;
            model.ScreenOpenMode = ScreenOpenMode.Add;
            model.PrincipalFormName = Session["PrincipalFormName"].ToString();
            model.CaptionBreadcrumbsPrincipal = Session["CaptionBreadcrumbs"].ToString();
            model.CaptionTitlePrincipal = Session["CaptionTitle"].ToString();

            if(formDefinition.HasPictures)
                SetupUploader(System.Web.HttpContext.Current,false);

            Session.Add("frmNewInspection", model);
            return View("InspectionReport", model);
        }