Пример #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);
            }
        }
Пример #2
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);
            }
        }
Пример #3
0
        protected void AddLinkButton_Command(object sender, CommandEventArgs e)
        {
            try
            {
                AssetButtonAction action;

                int assetId    = Convert.ToInt32(e.CommandArgument);
                int lightboxId = Lightbox.LightboxId.GetValueOrDefault();

                switch (e.CommandName.ToLower())
                {
                case "lightbox":

                    if (EntitySecurityManager.CanManageLightbox(CurrentUser, Lightbox))
                    {
                        if (ContextInfo.LightboxManager.LightboxContainsAsset(Lightbox, assetId))
                        {
                            ContextInfo.LightboxManager.RemoveAssetFromLightbox(lightboxId, assetId);
                            MessageLabel.SetSuccessMessage("asset removed from lightbox");
                            action = AssetButtonAction.AssetRemoved;
                        }
                        else
                        {
                            ContextInfo.LightboxManager.AddAssetToLightbox(lightboxId, assetId);
                            MessageLabel.SetSuccessMessage("asset added to lightbox");
                            action = AssetButtonAction.AssetAdded;
                        }

                        InitialiseLightboxButton(assetId);

                        if (SessionInfo.Current.UserSessionInfo.PersistentLightboxCartInfo.SelectedLightboxId == lightboxId)
                        {
                            switch (action)
                            {
                            case (AssetButtonAction.AssetAdded):

                                // Set the offset to Int32.Max to force the persistent lightbox to the last page
                                SessionInfo.Current.UserSessionInfo.PersistentLightboxCartInfo.LightboxOffSet = Int32.MaxValue;
                                break;

                            case (AssetButtonAction.AssetRemoved):
                                SessionInfo.Current.UserSessionInfo.PersistentLightboxCartInfo.LightboxOffSet--;
                                break;
                            }
                        }

                        if (LightboxButtonClicked != null)
                        {
                            LightboxButtonClicked(this, new AssetButtonEventArgs(assetId, action));
                        }
                    }
                    else
                    {
                        MessageLabel.SetErrorMessage("you do not have permission to add/remove assets for this lightbox");
                        m_Logger.DebugFormat("User: {0} (UserId: {1}) tried to add/remove AssetId: {2} to/from LightboxId: {3} but was denied permission", CurrentUser.FullName, CurrentUser.UserId, assetId, lightboxId);
                    }

                    break;

                case "cart":

                    if (ContextInfo.CartManager.CartContainsAsset(assetId))
                    {
                        ContextInfo.CartManager.RemoveAssetFromCart(assetId);
                        MessageLabel.SetSuccessMessage("asset removed from cart");
                        action = AssetButtonAction.AssetRemoved;
                    }
                    else
                    {
                        ContextInfo.CartManager.AddAssetToCart(assetId);
                        MessageLabel.SetSuccessMessage("asset added to cart");
                        action = AssetButtonAction.AssetAdded;
                    }

                    InitialiseCartButton(assetId);

                    switch (action)
                    {
                    case (AssetButtonAction.AssetAdded):

                        // Set the offset to Int32.Max to force the persistent cart to the last page
                        SessionInfo.Current.UserSessionInfo.PersistentLightboxCartInfo.CartOffSet = Int32.MaxValue;
                        break;

                    case (AssetButtonAction.AssetRemoved):
                        SessionInfo.Current.UserSessionInfo.PersistentLightboxCartInfo.CartOffSet--;
                        break;
                    }

                    if (CartButtonClicked != null)
                    {
                        CartButtonClicked(this, new AssetButtonEventArgs(assetId, action));
                    }

                    break;
                }
            }
            catch (InvalidLightboxException lex)
            {
                MessageLabel.SetErrorMessage(lex.Message);
            }
        }