protected void btnCreate_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }
            try
            {
                if (!EnterpriseStorageHelper.ValidateFolderName(txtFolderName.Text.Trim()))
                {
                    messageBox.ShowErrorMessage("FILES_INCORRECT_FOLDER_NAME");

                    return;
                }

                if (!ES.Services.EnterpriseStorage.CheckEnterpriseStorageInitialization(PanelSecurity.PackageId, PanelRequest.ItemID))
                {
                    ES.Services.EnterpriseStorage.CreateEnterpriseStorage(PanelSecurity.PackageId, PanelRequest.ItemID);
                }

                ResultObject result = ES.Services.EnterpriseStorage.CreateEnterpriseFolder(
                    PanelRequest.ItemID,
                    txtFolderName.Text.Trim(),
                    (int)(decimal.Parse(txtFolderSize.Text) * OneGb),
                    rbtnQuotaSoft.Checked ? QuotaType.Soft : QuotaType.Hard,
                    chkAddDefaultGroup.Checked);

                if (!result.IsSuccess && result.ErrorCodes.Count > 0)
                {
                    messageBox.ShowMessage(result, "ENTERPRISE_STORAGE_CREATE_FOLDER", "Cloud Folders");

                    return;
                }

                Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "enterprisestorage_folder_settings",
                                          "FolderID=" + txtFolderName.Text.Trim(),
                                          "ItemID=" + PanelRequest.ItemID));
            }
            catch (Exception ex)
            {
                messageBox.ShowErrorMessage("ENTERPRISE_STORAGE_CREATE_FOLDER", ex);
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            try
            {
                litFolderName.Text = txtFolderName.Text;

                SystemFile folder = new SystemFile {
                    Name = PanelRequest.FolderID, Url = lblFolderUrl.Text
                };

                if (!ES.Services.EnterpriseStorage.CheckEnterpriseStorageInitialization(PanelSecurity.PackageId, PanelRequest.ItemID))
                {
                    ES.Services.EnterpriseStorage.CreateEnterpriseStorage(PanelSecurity.PackageId, PanelRequest.ItemID);
                }

                //File is renaming
                if (PanelRequest.FolderID != txtFolderName.Text)
                {
                    //check if filename is correct
                    if (!EnterpriseStorageHelper.ValidateFolderName(txtFolderName.Text))
                    {
                        messageBox.ShowErrorMessage("FILES_INCORRECT_FOLDER_NAME");

                        return;
                    }

                    folder = ES.Services.EnterpriseStorage.RenameEnterpriseFolder(PanelRequest.ItemID, PanelRequest.FolderID, txtFolderName.Text);

                    if (folder == null)
                    {
                        messageBox.ShowErrorMessage("FOLDER_ALREADY_EXIST");

                        return;
                    }
                }

                ES.Services.EnterpriseStorage.SetEnterpriseFolderGeneralSettings(
                    PanelRequest.ItemID,
                    folder,
                    false,
                    (int)(decimal.Parse(txtFolderSize.Text) * OneGb),
                    rbtnQuotaSoft.Checked ? QuotaType.Soft : QuotaType.Hard);

                if (edaRow.Visible && abeRow.Visible)
                {
                    ES.Services.EnterpriseStorage.SetEsFolderShareSettings(PanelRequest.ItemID, PanelRequest.FolderID, chkAbe.Checked, chkEda.Checked);
                }

                Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "enterprisestorage_folders",
                                          "ItemID=" + PanelRequest.ItemID));
            }
            catch (Exception ex)
            {
                messageBox.ShowErrorMessage("ENTERPRISE_STORAGE_UPDATE_FOLDER_SETTINGS", ex);
            }
        }