Beispiel #1
0
        protected void DuplicateButton_Click(object sender, EventArgs e)
        {
            AssetTypeFileExtension atfe = SaveATFE();

            if (!atfe.IsNull)
            {
                string ext = atfe.Extension;
                AssetTypeFileExtensionManager.Duplicate(atfe);
                AuditLogManager.LogUserAction(SessionInfo.Current.User, AuditUserAction.DuplicateFileExtension, string.Format("File Extension: {0} (temp ext: {1}), ID: {2}", ext, atfe.Extension, atfe.AssetTypeFileExtensionId));
                Response.Redirect("ManageFileExtensionsForm.aspx?Action=Duplicate&AssetTypeFileExtensionId=" + atfe.AssetTypeFileExtensionId);
            }
        }
Beispiel #2
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            // Get the ID of the extension to be deleted
            int id = WebUtils.GetIntRequestParam("AssetTypeFileExtensionId", 0);

            // Get the file extension to be deleted
            AssetTypeFileExtension atfe = AssetTypeFileExtension.Get(id);

            // Now actually delete it
            AssetTypeFileExtensionManager.Delete(atfe);

            // Update audit log
            AuditLogManager.LogUserAction(SessionInfo.Current.User, AuditUserAction.DeleteFileExtension, string.Format("File Extension: {0}, ID: {1}", atfe.Extension, atfe.AssetTypeFileExtensionId));

            // Update UI
            FormPanel.Visible    = false;
            SuccessPanel.Visible = true;
            MessageLabel2.SetSuccessMessage("File extension deleted successfully");
        }
Beispiel #3
0
        private AssetTypeFileExtension SaveATFE()
        {
            AssetTypeFileExtension atfe = GetATFEFromForm();
            BinaryFile             file = new BinaryFile(IconFileUpload.PostedFile);

            try
            {
                AssetTypeFileExtensionManager.Save(atfe, file);
                FormPanel.Visible    = false;
                SuccessPanel.Visible = true;

                return(atfe);
            }
            catch (AssetTypeFileExtensionException ex)
            {
                MessageLabel1.SetErrorMessage("Error saving file extension", ex.Errors);
            }

            return(AssetTypeFileExtension.Empty);
        }