Ejemplo n.º 1
0
        /// <summary>
        /// Handles the Click event of the CommentButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void CommentButton_Click(object sender, EventArgs e)
        {
            //// this.CommentButtonClick(this, new DataEventArgs<string>(string.Empty));

            try
            {
                this.Cursor = Cursors.WaitCursor;
                object[] optionalParameter;
                int      currentCommentForm;
                if (this.commentFormIdDiffers)
                {
                    currentCommentForm = this.commentFormId;
                }
                else
                {
                    currentCommentForm = this.currentFormId;
                }

                if (Convert.ToBoolean(TerraScanCommon.GetFormInfo(currentCommentForm).openPermission))
                {
                    optionalParameter = new object[] { currentCommentForm, this.keyId, this.parentFormId };

                    Form commentForm = new Form();
                    commentForm     = TerraScanCommon.GetForm(9075, optionalParameter, this.ParentWorkItem);
                    commentForm.Tag = currentCommentForm;

                    if (commentForm != null)
                    {
                        commentForm.ShowDialog();

                        // Code Need to be Modified to Set the Text For Attachmnent/Comment Button (Get the Count,Flag From Attachment/Comment Form Makin Public Propertis.
                        AdditionalOperationCountEntity additionalOperationCountEnt;
                        additionalOperationCountEnt = new AdditionalOperationCountEntity(-999, -999, false);
                        additionalOperationCountEnt.CommentCount = Convert.ToInt16(TerraScanCommon.GetValue(commentForm, "CommentCount"));
                        additionalOperationCountEnt.HighPriority = Convert.ToBoolean(TerraScanCommon.GetValue(commentForm, "HighPriorityFlag"));
                        this.SetText(additionalOperationCountEnt);
                    }
                }
                else
                {
                    MessageBox.Show(SharedFunctions.GetResourceString("OpenPermission"), ConfigurationWrapper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.ManageException(ex, ExceptionManager.ActionType.Display, this.ParentForm);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the text.
        /// </summary>
        /// <param name="additionalOperationCountEntity">The additional operation count entity.</param>
        private void SetText(AdditionalOperationCountEntity additionalOperationCountEntity)
        {
            ////if not -999 reset text
            if (additionalOperationCountEntity.AttachmentCount != -999)
            {
                if (additionalOperationCountEntity.AttachmentCount <= 0)
                {
                    this.AttachmentButton.Text = "Attachment";
                }
                else
                {
                    this.AttachmentButton.Text = "Attachment" + "(" + additionalOperationCountEntity.AttachmentCount + ")";
                }
            }

            if (additionalOperationCountEntity.CommentCount != -999)
            {
                if (additionalOperationCountEntity.CommentCount <= 0)
                {
                    this.CommentButton.Text = "Comment";
                }
                else
                {
                    this.CommentButton.Text = "Comment" + "(" + additionalOperationCountEntity.CommentCount + ")";
                }

                if (additionalOperationCountEntity.HighPriority)
                {
                    this.CommentButton.BackColor       = this.highPriorityCommentColor;
                    this.CommentButton.CommentPriority = true;
                }
                else
                {
                    this.CommentButton.BackColor       = this.defaultCommentButtonBackColor;
                    this.CommentButton.CommentPriority = false;
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the Click event of the AttachmentButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void AttachmentButton_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                object[] optionalParameter = new object[] { this.currentFormId, this.keyId, this.parentFormId };

                Form attachmentForm = new Form();
                //attachmentForm.Icon = @"D:\Workarea\TerraScan-T.ico";
                if (Convert.ToBoolean(TerraScanCommon.GetFormInfo(this.currentFormId).openPermission))
                {
                    attachmentForm     = TerraScanCommon.GetForm(9005, optionalParameter, this.ParentWorkItem);
                    attachmentForm.Tag = this.currentFormId;
                    if (attachmentForm != null)
                    {
                        attachmentForm.ShowDialog();

                        // Code Need to be Modified to Set the Text For Attachmnent/Comment Button (Get the Count,Flag From Attachment/Comment Form Makin Public Propertis.
                        AdditionalOperationCountEntity additionalOperationCountEnt;
                        additionalOperationCountEnt = new AdditionalOperationCountEntity(-999, -999, false);
                        additionalOperationCountEnt.AttachmentCount = Convert.ToInt16(TerraScanCommon.GetValue(attachmentForm, "AttachmentCount"));
                        this.SetText(additionalOperationCountEnt);
                    }
                }
                else
                {
                    MessageBox.Show(SharedFunctions.GetResourceString("OpenPermission"), ConfigurationWrapper.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.ManageException(ex, ExceptionManager.ActionType.Display, this.ParentForm);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }