Exemplo n.º 1
0
        protected void ProcessButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (InviteCommentsRadioButton.Checked)
                {
                    WorkflowManager.InviteUserToWorkflow(AssetWorkflowUser, InviteCommentsTextBox.Text, ResponseTextArea.Text);
                    MessageLabel.SetSuccessMessage("Invitation sent successfully");
                }
                else
                {
                    AssetWorkflowUserStatus assetWorkflowUserStatus;

                    if (ApproveRadioButton.Checked)
                    {
                        assetWorkflowUserStatus = AssetWorkflowUserStatus.Approved;
                    }
                    else if (RejectRadioButton.Checked)
                    {
                        assetWorkflowUserStatus = AssetWorkflowUserStatus.Rejected;
                    }
                    else
                    {
                        assetWorkflowUserStatus = AssetWorkflowUserStatus.Pending;
                    }

                    AssetWorkflowUser.AssetWorkflowUserStatus = assetWorkflowUserStatus;
                    AssetWorkflowUser.Comments   = ResponseTextArea.Text.Trim();
                    AssetWorkflowUser.LastUpdate = DateTime.Now;

                    WorkflowManager.SaveWorkflowUserAndAdvance(AssetWorkflowUser);

                    switch (assetWorkflowUserStatus)
                    {
                    case (AssetWorkflowUserStatus.Approved):
                    case (AssetWorkflowUserStatus.Rejected):

                        MessageLabel.SetSuccessMessage("Your comments have been saved.");
                        DisableUI();
                        break;

                    case (AssetWorkflowUserStatus.Pending):

                        MessageLabel.SetSuccessMessage("Comments saved. Please approve or reject this asset to advance the workflow.");
                        break;
                    }
                }

                AssetWorkflowLog.Bind(AssetWorkflow.Asset);
            }
            catch (BaseException bex)
            {
                MessageLabel.SetErrorMessage(bex.Message);
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (AssetWorkflowCommenter.IsNull)
                {
                    Response.Redirect("~/Admin/Assets/AssetList.aspx");
                }

                if (!StringUtils.IsBlank(AssetWorkflowCommenter.Comments))
                {
                    MessageLabel.SetErrorMessage("You have already commented on this workflow");
                    MessageLabel.Pinned = true;
                    DisableUI();
                }

                if (AssetWorkflow.IsComplete)
                {
                    MessageLabel.SetErrorMessage("Asset workflow is complete and comments have been disabled");
                    MessageLabel.Pinned = true;
                    DisableUI();
                }

                AssetWorkflowUserList.Repeater.DataSource = AssetWorkflow.AssetWorkflowUserList;
                AssetWorkflowUserList.Repeater.DataBind();

                Asset asset = AssetWorkflow.Asset;

                AssetReferenceLiteral.Text = asset.AssetId.ToString();
                UploadUserEmailHyperLink.SetNameEmail(asset.UploadedByUser.FullName, asset.UploadedByUser.Email);
                PublicationDateLiteral.Text        = asset.PublishDate.ToString(Global.DateFormat);
                DownloadAssetHyperLink.NavigateUrl = AssetFileUrlHelper.GetDownloadUrl(asset.AssetId);
                AssetThumbnail.Initialise(asset);
                AssetButtons1.Initialise(asset);
                AssetTypeCell.InnerText           = asset.AssetType.Name;
                BrandCell.InnerText               = asset.BrandName;
                ShortDescriptionCell.InnerHtml    = SiteUtils.ConvertTextToHtml(asset.Description);
                UsageRestrictionsCell.InnerText   = asset.UsageRestrictions;
                InvitingUserName.Text             = AssetWorkflowCommenter.InvitingUser.FullName;
                InvitingUserMessageCell.InnerText = AssetWorkflowCommenter.InvitingUserMessage;
                ResponseTextArea.Text             = AssetWorkflowCommenter.Comments;

                SiteUtils.SetHyperLink("Assets.AssetForm", string.Format("?assetId={0}", asset.AssetId), EditAssetHyperLink);

                AssetWorkflowLog.Bind(AssetWorkflow.Asset);
            }
        }
Exemplo n.º 3
0
        protected void ProcessButton_Click(object sender, EventArgs e)
        {
            AssetWorkflowCommenter.Comments   = ResponseTextArea.Text.Trim();
            AssetWorkflowCommenter.LastUpdate = DateTime.Now;

            try
            {
                WorkflowManager.SaveAssetWorkflowCommenter(AssetWorkflowCommenter);
                MessageLabel.SetSuccessMessage("Comments saved successfully");
                DisableUI();
                AssetWorkflowLog.Bind(AssetWorkflow.Asset);
            }
            catch (ValidationException vex)
            {
                MessageLabel.SetErrorMessage(vex.Message);
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ApproveRadioButton.Attributes.Add("onClick", "checkRadio()");
                RejectRadioButton.Attributes.Add("onClick", "checkRadio()");
                PendingRadioButton.Attributes.Add("onClick", "checkRadio()");
                InviteCommentsRadioButton.Attributes.Add("onClick", "checkRadio()");

                if (AssetWorkflowUser.IsNull)
                {
                    Response.Redirect("~/Admin/Assets/AssetList.aspx");
                }

                if (AssetWorkflow.IsComplete)
                {
                    MessageLabel.SetErrorMessage("Asset workflow is complete and comments have been disabled");
                    MessageLabel.Pinned = true;
                    DisableUI();
                }
                else
                {
                    if (AssetWorkflowUser.AssetWorkflowUserStatus == AssetWorkflowUserStatus.Waiting)
                    {
                        MessageLabel.SetErrorMessage("You do not have permission to action this workflow yet");
                        MessageLabel.Pinned = true;
                        DisableUI();
                    }
                    else if (AssetWorkflowUser.AssetWorkflowUserStatus != AssetWorkflowUserStatus.Pending)
                    {
                        MessageLabel.SetErrorMessage("You have already actioned this workflow");
                        MessageLabel.Pinned = true;
                        DisableUI();
                    }
                }

                AssetWorkflowUserList.Repeater.DataSource = AssetWorkflow.AssetWorkflowUserList;
                AssetWorkflowUserList.Repeater.DataBind();

                Asset asset = AssetWorkflow.Asset;

                AssetReferenceLiteral.Text = asset.AssetId.ToString();
                UploadUserEmailHyperLink.SetNameEmail(asset.UploadedByUser.FullName, asset.UploadedByUser.Email);
                PublicationDateLiteral.Text        = asset.PublishDate.ToString(Global.DateFormat);
                DownloadAssetHyperLink.NavigateUrl = AssetFileUrlHelper.GetDownloadUrl(asset.AssetId);
                AssetThumbnail.Initialise(asset);
                AssetButtons1.Initialise(asset);
                AssetTypeCell.InnerText         = asset.AssetType.Name;
                BrandCell.InnerText             = asset.BrandName;
                ShortDescriptionCell.InnerHtml  = SiteUtils.ConvertTextToHtml(asset.Description);
                UsageRestrictionsCell.InnerText = asset.UsageRestrictions;
                ResponseTextArea.Text           = AssetWorkflowUser.Comments;

                SiteUtils.SetHyperLink("Assets.AssetForm", string.Format("?assetId={0}", asset.AssetId), EditAssetHyperLink);

                switch (AssetWorkflowUser.AssetWorkflowUserStatus)
                {
                case (AssetWorkflowUserStatus.Pending):

                    PendingRadioButton.Checked = true;
                    break;

                case (AssetWorkflowUserStatus.Approved):

                    ApproveRadioButton.Checked = true;
                    break;

                case (AssetWorkflowUserStatus.Rejected):

                    RejectRadioButton.Checked = true;
                    break;
                }

                AssetWorkflowLog.Bind(asset);
            }
        }