コード例 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            JQFactorItemEntity entity = new JQFactorItemEntity();

            AssignValues(entity);
            string ratingScaleInstruction = txtInstruction.Text;

            try
            {
                if (base.CurrentJQFactorID > 0)
                {
                    if (CurrentMode == eMode.Insert)
                    {
                        //JA issue id 455: JQ Qualification/KSA: Adding question and selecting custom instruction, selecting save overrides custom instructions to defaul instruction
                        base.CurrentJQFactorItemID = JQFactorItemID = entity.ID = jqm.AddQuestionWithRatingScale(entity, ratingScaleInstruction, this.CurrentUserID);
                        if (entity.ID > 0)
                        {
                            lblmsg.Text         = "Task Statement added successfully.";
                            CurrentMode         = eMode.Edit;
                            base.CurrentNavMode = enumNavigationMode.Edit;
                            BindData();
                            this.questionDetail.Visible = true;
                        }
                        else
                        {
                            base.PrintErrorMessage("Error adding Task Statement.", false);
                        }
                    }
                    else if (CurrentMode == eMode.Edit)
                    {
                        jqm.UpdateJQFactorItem(entity, this.CurrentUserID);

                        // check if rating scale was changed by the user and delete the responses if that is the case
                        if (JQRatingScaleTypeID != entity.RatingScaleTypeID)
                        {
                            jqm.DeleteAllRatingScaleResponses(entity.ID, this.CurrentUserID);
                            this.CurrentRsID = jqm.CopyResponsesFromRatingScaleType(entity.ID, JQRatingScaleTypeID, entity.RatingScaleTypeID, this.CurrentUserID);
                        }

                        // update the instruction - only HR users can edit instructions for custom responses
                        if (!entity.IsDefault && (base.CurrentUser.HasPermission(enumPermission.MaintainHRSection) || base.IsSystemAdministrator))
                        {
                            jqm.UpdateJQRatingScaleInstruction(this.CurrentRsID, txtInstruction.Text, this.CurrentUserID);
                        }

                        BindData();
                        lblmsg.Text = "Task Statement updated successfully.";
                        this.questionDetail.Visible = true;
                    }
                }
                else
                {
                    base.PrintErrorMessage("Current Job Questionnaire Factor is not set", false);
                }
            }
            catch (Exception ex)
            {
                base.HandleException(ex);
            }
        }
コード例 #2
0
        private void BindData()
        {
            gridResponses.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;

            if (JQFactorItemID == -1)
            {
                if (NonExistentJQFactorItemEncountered != null)
                {
                    NonExistentJQFactorItemEncountered();
                }
            }
            else
            {
                JQFactorItemEntity entity = jqm.GetJQFactorItemByID(JQFactorItemID);
                txtQuestion.Text = entity.ItemText;
                rcbRatingScaleType.SelectedValue = entity.RatingScaleTypeID.ToString();
                JQRatingScaleTypeID    = entity.RatingScaleTypeID;
                this.CurrentRsID       = entity.RatingScaleID;
                JQFactorID             = entity.FactorID;
                this.CurrentJQFactorID = entity.FactorID;
                JQRatingScaleEntity ratingScaleEntity = jqm.GetJQRatingScaleByID(this.CurrentRsID);
                txtInstruction.Text = ratingScaleEntity.RatingScaleInstruction;

                // only HR users can edit instructions for existing custom responses and also create new custom responses
                if (!entity.IsDefault && (base.CurrentUser.HasPermission(enumPermission.MaintainHRSection) || base.IsSystemAdministrator))
                {
                    txtInstruction.ReadOnly = false;

                    gridResponses.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
                }
                else
                {
                    txtInstruction.ReadOnly = true;
                }


                gridResponses.Rebind();
                gridResponses.Columns[0].Display = isDisplayCRUDColumns; //edit column

                if (gridResponses.MasterTableView.Items.Count == 2)
                {
                    gridResponses.Columns[1].Display = false;
                }
                else
                {
                    gridResponses.Columns[1].Display = isDisplayCRUDColumns; //delete column
                }
            }
        }
コード例 #3
0
        private void AssignValues(JQFactorItemEntity entity)
        {
            int ratingScaleTypeID = int.Parse(rcbRatingScaleType.SelectedValue);

            entity.ID                = JQFactorItemID;
            entity.FactorID          = this.CurrentJQFactorID;
            entity.ParentItemID      = -1;
            entity.ItemTypeID        = (int)enumJQItemType.Question;
            entity.ItemNo            = -1;
            entity.ItemLetter        = string.Empty;
            entity.ItemText          = txtQuestion.Text;
            entity.RatingScaleID     = -1;
            entity.RatingScaleTypeID = ratingScaleTypeID;
            entity.RatingScaleName   = string.Empty;
            entity.IsDefault         = (ratingScaleTypeID == (int)enumRatingScaleType.DefaultYN || ratingScaleTypeID == (int)enumRatingScaleType.DefaultMultiChoice) ? true : false;
        }
コード例 #4
0
        protected void btnAddToLibraryOk_Click(object sender, EventArgs e)
        {
            long returnCode = -1;

            rwAddToLibrary.VisibleOnPageLoad = false;
            JQManager          jqMgr        = new JQManager();
            JQFactorEntity     jqFactor     = jqMgr.GetJQFactorByJQFactorID(this.JQFactorID);
            JQFactorItemEntity jqFactorItem = jqMgr.GetJQFactorItemByID(this.JQFactorItemID);

            if (jqFactor.KSAID == 0)
            {
                returnCode = JQManager.AddKSATaskStatementToLibrary(jqFactor.Title, jqFactorItem.ItemText, jqFactor, jqFactorItem, CurrentJNP.SeriesID, CurrentJNP.HighestAdvertisedGrade, this.CurrentUserID);
                if (returnCode > 0)
                {
                    lblmsg.Text = "Added KSA and Task Statment To Library Sucessfully.";
                }
                else
                {
                    lblmsg.Text = "Sorry, Could Not Add KSA and Task Statment to Library!";
                }
            }
            else
            {
                returnCode = JQManager.AddTaskStatementToLibrary(jqFactorItem.ItemText, jqFactorItem, CurrentJNP.SeriesID, CurrentJNP.HighestAdvertisedGrade, jqFactor.KSAID, this.CurrentUserID);
                if (returnCode > 0)
                {
                    lblmsg.Text = "Added Task Statment To Library Sucessfully.";
                }
                else
                {
                    lblmsg.Text = "Sorry, Could Not Add Task Statment to Library!";
                }
            }

            InitTaskStatements();
            btnAddToLibrary.Visible = false;
        }
コード例 #5
0
        private void BindData()
        {
            gridResponses.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;

            if (JQFactorItemID == -1)
            {
                if (NonExistentJQFactorItemEncountered != null)
                {
                    NonExistentJQFactorItemEncountered();
                }
            }
            else
            {
                JQFactorItemEntity entity = jqm.GetJQFactorItemByID(JQFactorItemID);
                txtQuestion.Text = entity.ItemText;
                rcbRatingScaleType.SelectedValue = entity.RatingScaleTypeID.ToString();
                JQRatingScaleTypeID    = entity.RatingScaleTypeID;
                this.CurrentRsID       = entity.RatingScaleID;
                JQFactorID             = entity.FactorID;
                this.CurrentJQFactorID = entity.FactorID;
                JQRatingScaleEntity ratingScaleEntity = jqm.GetJQRatingScaleByID(this.CurrentRsID);
                txtInstruction.Text = ratingScaleEntity.RatingScaleInstruction;

                // only HR users can edit instructions for existing custom responses and also create new custom responses
                if (!entity.IsDefault && (base.CurrentUser.HasPermission(enumPermission.MaintainHRSection) || base.IsSystemAdministrator))
                {
                    txtInstruction.ReadOnly = false;

                    gridResponses.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
                }
                else
                {
                    txtInstruction.ReadOnly = true;
                }


                gridResponses.Rebind();
                gridResponses.Columns[0].Display = isDisplayCRUDColumns; //edit column
                //if there are only two responses don't display the delete column
                //minimum two responses are required
                if (gridResponses.MasterTableView.Items.Count == 2)
                {
                    gridResponses.Columns[1].Display = false; //delete column
                }
                else
                {
                    gridResponses.Columns[1].Display = isDisplayCRUDColumns; //delete column
                }

                if (CurrentNavMode == enumNavigationMode.Edit)
                {
                    if ((base.HasHRGroupPermission && !CurrentJNP.IsJNPSignedByHR) || base.IsSystemAdministrator)
                    {
                        if (entity.TaskStatementID == 0)
                        {
                            btnAddToLibrary.Visible = true;
                        }
                        else
                        {
                            btnAddToLibrary.Visible = false;
                        }
                    }
                    else
                    {
                        btnAddToLibrary.Visible = false;
                    }
                }
                else
                {
                    btnAddToLibrary.Visible = false;
                }
            }
        }