Exemple #1
0
        private void SaveOrder(bool printMessage)
        {
            // save new order
            JQManager jqm = new JQManager();


            // For Issue 991 - To avoid updating while in view mode
            if (CurrentNavMode != enumNavigationMode.View)
            {
                jqm.UpdateOrder(base.CurrentJQID, this.Factors, this.CurrentUserID);
            }


            // clear all collections
            this.Factors.Clear();

            // re-bind grid
            this.Factors = jqm.GetJQFactorCollectionByJQID(base.CurrentJQID);
            bindData(this.Factors);

            // disable save/order button
            //this.toggleButtons(false);

            // show system message
            if (printMessage)
            {
                base.PrintSystemMessage(GetLocalResourceObject("OrderUpdatedMessage").ToString(), true);
            }
        }
Exemple #2
0
        public void BuildPage()
        {
            try
            {
                if (base.CurrentJQID == -1)
                {
                    base.PrintErrorMessage(GetGlobalResourceObject("JNPMessages", "JQNotAvailable").ToString(), false);
                }
                else
                {
                    JQManager        jm    = new JQManager();
                    JobQuestionnaire jqDoc = jm.GetJobQuestionnaire(base.CurrentJQID);

                    if (jqDoc == null || jqDoc.JQID == -1)
                    {
                        // Non-existent JQ
                        base.PrintSystemMessage(GetLocalResourceObject("JQIDNotFoundMessage").ToString(), false);
                    }
                    else
                    {
                        // load Factors
                        JQFactorCollection listFactors = jm.GetJQFactorCollectionByJQID(base.CurrentJQID);

                        this.Factors = listFactors;
                        //Added this because factor numbers are not aligned properly.
                        SaveOrder(false);
                        //this method will be called from SaveOrder()
                        //bindData(listFactors);
                        SetControls();
                    }
                }
            }
            catch (Exception ex)
            {
                base.HandleException(ex);
            }
        }
Exemple #3
0
 private void bindData(JQFactorCollection FactorLoadList)
 {
     this.gridJQFactors.DataSource = FactorLoadList;
     this.gridJQFactors.DataBind();
 }
        protected override void Page_Load(object sender, EventArgs e)
        {
            string docFormat = "";

            if (Request.QueryString["documentformat"] != null)
            {
                docFormat = Request.QueryString["documentformat"].ToString();
            }

            if (docFormat == "DOC")
            {
                docFormat = "DOCX";
            }

            if (this.StaffingObjectID > 0 && this.DocumentTypeID > 0)
            {
                string docName = string.Empty;

                switch (DocumentTypeID)
                {
                case enumDocumentType.JNP:
                    JNPReports.JobAnalysis currentJNPWorkflowComments = new JNPReports.JobAnalysis();
                    docName = string.Format("JobAnalysis{0}." + docFormat, StaffingObjectID);
                    currentJNPWorkflowComments.ReportParameters["jNPID"].Value = StaffingObjectID;
                    currentJNPWorkflowComments.ReportParameters["documentObjectTypeId"].Value = Request.QueryString["typeid"];
                    currentJNPWorkflowComments.ReportParameters["jAID"].Value = Request.QueryString["jaid"];

                    if (docFormat == enumDocumentFormat.DOCX.ToString())
                    {
                        ControlUtility.ExportToDoc(docName, currentJNPWorkflowComments);
                    }
                    if (docFormat == enumDocumentFormat.PDF.ToString())
                    {
                        ControlUtility.ExportToPDF(docName, currentJNPWorkflowComments);
                    }

                    break;

                case enumDocumentType.JA:
                    JNPReports.JobAnalysis currentJobAnalysisDoc = new JNPReports.JobAnalysis();
                    docName = string.Format("JobAnalysis{0}." + docFormat, StaffingObjectID);
                    currentJobAnalysisDoc.ReportParameters["jNPID"].Value = StaffingObjectID;
                    currentJobAnalysisDoc.ReportParameters["documentObjectTypeId"].Value = Request.QueryString["typeid"];
                    currentJobAnalysisDoc.ReportParameters["jAID"].Value = Request.QueryString["jaid"];


                    if (docFormat == enumDocumentFormat.DOCX.ToString())
                    {
                        ControlUtility.ExportToDoc(docName, currentJobAnalysisDoc);
                    }
                    if (docFormat == enumDocumentFormat.PDF.ToString())
                    {
                        ControlUtility.ExportToPDF(docName, currentJobAnalysisDoc);
                    }

                    break;

                case enumDocumentType.CR:
                    JNPReports.CategoryRating currentCategoryRatingdoc = new JNPReports.CategoryRating();
                    docName = string.Format("CategoryRating{0}." + docFormat, StaffingObjectID);
                    currentCategoryRatingdoc.ReportParameters["jNPID"].Value = StaffingObjectID;
                    currentCategoryRatingdoc.ReportParameters["documentObjectTypeId"].Value = Request.QueryString["typeid"];
                    currentCategoryRatingdoc.ReportParameters["jAID"].Value = Request.QueryString["jaid"];
                    currentCategoryRatingdoc.ReportParameters["cRID"].Value = Request.QueryString["crid"];

                    if (docFormat == enumDocumentFormat.DOCX.ToString())
                    {
                        ControlUtility.ExportToDoc(docName, currentCategoryRatingdoc);
                    }
                    if (docFormat == enumDocumentFormat.PDF.ToString())
                    {
                        ControlUtility.ExportToPDF(docName, currentCategoryRatingdoc);
                    }

                    break;

                case enumDocumentType.JQ:
                    if ((DocumentFormat == enumDocumentFormat.PDF) || (DocumentFormat == enumDocumentFormat.DOCX))
                    {
                        JNPReports.JobQuestionaire currentJobQuestionairePDFDoc = new JNPReports.JobQuestionaire();
                        docName = string.Format("JobQuestionaire{0}." + docFormat, StaffingObjectID);
                        currentJobQuestionairePDFDoc.ReportParameters["jNPID"].Value = StaffingObjectID;
                        currentJobQuestionairePDFDoc.ReportParameters["documentObjectTypeId"].Value = Request.QueryString["typeid"];

                        if (docFormat == enumDocumentFormat.DOCX.ToString())
                        {
                            ControlUtility.ExportToDoc(docName, currentJobQuestionairePDFDoc);
                        }
                        if (docFormat == enumDocumentFormat.PDF.ToString())
                        {
                            ControlUtility.ExportToPDF(docName, currentJobQuestionairePDFDoc);
                        }
                    }
                    else if (DocumentFormat == enumDocumentFormat.UTF8)
                    {
                        JQManager jqManager = new JQManager();
                        docName = string.Format("JobQuestionaire{0}.txt", StaffingObjectID);
                        string jobQuestionnaireUTF8Doc = jqManager.CreateUTF8JobQuestionnaireReport(StaffingObjectID);
                        ControlUtility.ExportToUTF8(docName, jobQuestionnaireUTF8Doc);
                    }
                    break;

                case enumDocumentType.Comments:
                    JNPReports.JNPComments jnpWorkflowComments = new JNPReports.JNPComments();
                    docName = string.Format("JAXComments{0}." + docFormat, StaffingObjectID);
                    jnpWorkflowComments.ReportParameters["jNPID"].Value = StaffingObjectID;
                    jnpWorkflowComments.ReportParameters["documentObjectTypeId"].Value = Request.QueryString["typeid"];

                    if (docFormat == enumDocumentFormat.DOCX.ToString())
                    {
                        ControlUtility.ExportToDoc(docName, jnpWorkflowComments);
                    }
                    if (docFormat == enumDocumentFormat.PDF.ToString())
                    {
                        ControlUtility.ExportToPDF(docName, jnpWorkflowComments);
                    }

                    break;

                case enumDocumentType.All:
                    bool CRActive = false;
                    long crid     = Convert.ToInt64(Request.QueryString["crid"]);
                    if (CurrentPackage != null)
                    {
                        CRActive = CurrentPackage.HasActiveCR();

                        //updating order if printing in edit mode by clicking Print All button from within the package
                        if (CurrentNavMode != enumNavigationMode.View)
                        {
                            JQManager jm = new JQManager();
                            // load Factors
                            JQFactorCollection listFactors = jm.GetJQFactorCollectionByJQID(CurrentPackage.JQID);
                            jm.UpdateOrder(CurrentPackage.JQID, listFactors, CurrentUser.UserID);
                        }
                    }
                    else
                    {
                        if (crid > 0)
                        {
                            HCMS.Business.CR.CategoryRating categoryRating = HCMS.Business.CR.CategoryRatingManager.GetByID(crid);
                            CRActive = (bool)categoryRating.IsActive;
                        }
                        else
                        {
                            CRActive = false;
                        }
                    }
                    JNPReports.JNPReport JNPReportAllDoc = new JNPReports.JNPReport();
                    docName = string.Format("JNPReportAll{0}." + docFormat, StaffingObjectID);

                    if (!CRActive)
                    {
                        JNPReportAllDoc.subReportCR.Visible         = false;
                        JNPReportAllDoc.groupHeaderSection3.Visible = false;
                    }

                    JNPReportAllDoc.ReportParameters["jNPID"].Value = StaffingObjectID;
                    JNPReportAllDoc.ReportParameters["documentObjectTypeId"].Value = enumDocumentType.All;
                    JNPReportAllDoc.ReportParameters["jAID"].Value = Request.QueryString["jaid"];
                    JNPReportAllDoc.ReportParameters["cRID"].Value = crid;

                    if (docFormat == enumDocumentFormat.DOCX.ToString())
                    {
                        ControlUtility.ExportToDoc(docName, JNPReportAllDoc);
                    }
                    if (docFormat == enumDocumentFormat.PDF.ToString())
                    {
                        ControlUtility.ExportToPDF(docName, JNPReportAllDoc);
                    }

                    break;

                default:
                    break;
                }
            }

            base.Page_Load(sender, e);
        }