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); } }
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); } }
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); } }
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); } }
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); } }