コード例 #1
0
        public PartialViewResult Output(VTOutputModel model)
        {
            if (ModelState.IsValid)
            {
                // Determine Which ID to use depending on the settings.
                string EmployeeID = "";
                if (VT.Properties.Settings.Default.UsingBinaryBadgeID)
                {
                    try
                    {
                        EmployeeID = helper.VTIDtoEMPID(model.EmployeeID);
                    }
                    catch
                    {
                        model.DisplayMessage = "Please Scan your VT ID";
                        return(PartialView(model));
                    }
                }
                else
                {
                    EmployeeID = model.EmployeeID;
                }

                List <VTFormObject> list_HeaderForm = new List <VTFormObject>(); // [i] Title, [i+1] Token

                list_HeaderForm = logic.getSummaryInfo(model.SerialNumber, "0", "1");

                if (list_HeaderForm[0].return_num == "0")
                {
                    model.Go = true;
                    int i = 0;

                    for (; i < list_HeaderForm.Count; i++)
                    {
                        if (list_HeaderForm[i].FieldList == null)
                        {
                            model.DisplayMessage = "Error, Tube has not been finished";
                            break;
                        }

                        // Checks if the work flow is completed
                        if (i == list_HeaderForm.Count - 1)
                        {
                            // Will need to switch back to correct employeeID variable later
                            if (logic.getFormInfo(model.SerialNumber, EmployeeID)[0].return_num == "51020")
                            {
                                model.CompletedWorkflow = true;
                            }
                        }
                    }
                    model.ListForm = list_HeaderForm;
                    //string check = helper.BuildDocument(Properties.Settings.Default.FilePathOutput + model.SerialNumber + "_output.docx", model.SerialNumber, model.ListForm);

                    model.OutputLocation = Properties.Settings.Default.FilePathOutput;
                    String pdf_path = model.OutputLocation + model.SerialNumber + "_output.pdf";
                    string check    = helper.iTextBuildDocument(model.SerialNumber, model.ListForm, pdf_path);


                    model.DisplayMessage = check;
                    return(PartialView("OutputPartialView", model));
                }
                else
                {
                    model.DisplayMessage = helper.checkErrors(list_HeaderForm[0].return_num, list_HeaderForm[0].error_message);
                    return(PartialView(model));
                }
            }
            else
            {
                return(PartialView(model));
            }
        }
コード例 #2
0
        public ActionResult Output()
        {
            VTOutputModel model = new VTOutputModel();

            return(View(model));
        }