protected void Page_Load(object sender, EventArgs e) { locTitle.Text = RetentionPolicy ? GetLocalizedString("locTitleRetentionPolicy.Text") : GetLocalizedString("locTitle.Text"); UserSpaceBreadcrumb bc = FindControlRecursive(Page, "breadcrumb") as UserSpaceBreadcrumb; if (bc != null) { Label lbOrgCurPage = bc.FindControl("lbOrgCurPage") as Label; if (lbOrgCurPage != null) { lbOrgCurPage.Text = GetLocalizedString(RetentionPolicy ? "Text.PageRetentionPolicyName" : "Text.PageName"); } } gvMailboxPlans.Columns[2].Visible = !RetentionPolicy; btnSetDefaultMailboxPlan.Visible = !RetentionPolicy; secMainTools.Visible = !RetentionPolicy; if (!IsPostBack) { // bind mailboxplans BindMailboxPlans(); txtStatus.Visible = false; if (PanelSecurity.LoggedUser.Role == UserRole.User) { PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (!RetentionPolicy) { if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ENABLEDPLANSEDITING)) { if (cntx.Quotas[Quotas.EXCHANGE2007_ENABLEDPLANSEDITING].QuotaAllocatedValue != 1) { gvMailboxPlans.Columns[3].Visible = false; btnAddMailboxPlan.Enabled = btnAddMailboxPlan.Visible = false; } } } else { if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY)) { if (cntx.Quotas[Quotas.EXCHANGE2013_ALLOWRETENTIONPOLICY].QuotaAllocatedValue != 1) { gvMailboxPlans.Columns[3].Visible = false; btnAddMailboxPlan.Enabled = btnAddMailboxPlan.Visible = false; } } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (PanelRequest.GetInt("MailboxPlanId") != 0) { Providers.HostedSolution.ExchangeMailboxPlan plan = ES.Services.ExchangeServer.GetExchangeMailboxPlan(PanelRequest.ItemID, PanelRequest.GetInt("MailboxPlanId")); txtMailboxPlan.Text = plan.MailboxPlan; RetentionPolicy = plan.Archiving; if (RetentionPolicy) { List <ExchangeMailboxPlanRetentionPolicyTag> tags = new List <ExchangeMailboxPlanRetentionPolicyTag>(); tags.AddRange(ES.Services.ExchangeServer.GetExchangeMailboxPlanRetentionPolicyTags(plan.MailboxPlanId)); ViewState["Tags"] = tags; gvPolicy.DataSource = tags; gvPolicy.DataBind(); } else { mailboxSize.QuotaValue = plan.MailboxSizeMB; maxRecipients.QuotaValue = plan.MaxRecipients; maxSendMessageSizeKB.QuotaValue = plan.MaxSendMessageSizeKB; maxReceiveMessageSizeKB.QuotaValue = plan.MaxReceiveMessageSizeKB; chkPOP3.Checked = plan.EnablePOP; chkIMAP.Checked = plan.EnableIMAP; chkOWA.Checked = plan.EnableOWA; chkMAPI.Checked = plan.EnableMAPI; chkActiveSync.Checked = plan.EnableActiveSync; sizeIssueWarning.ValueKB = plan.IssueWarningPct; sizeProhibitSend.ValueKB = plan.ProhibitSendPct; sizeProhibitSendReceive.ValueKB = plan.ProhibitSendReceivePct; daysKeepDeletedItems.ValueDays = plan.KeepDeletedItemsDays; chkHideFromAddressBook.Checked = plan.HideFromAddressBook; chkEnableLitigationHold.Checked = plan.AllowLitigationHold; recoverableItemsSpace.QuotaValue = plan.RecoverableItemsSpace; recoverableItemsWarning.ValueKB = plan.RecoverableItemsWarningPct; txtLitigationHoldMsg.Text = plan.LitigationHoldMsg; txtLitigationHoldUrl.Text = plan.LitigationHoldUrl; chkEnableArchiving.Checked = plan.EnableArchiving; archiveQuota.QuotaValue = plan.ArchiveSizeMB; archiveWarningQuota.ValueKB = plan.ArchiveWarningPct; chkEnableForceArchiveDeletion.Checked = plan.EnableForceArchiveDeletion; } locTitle.Text = plan.MailboxPlan; this.DisableControls = true; } else { if (cntx != null) { foreach (QuotaValueInfo quota in cntx.QuotasArray) { switch (quota.QuotaId) { case 77: break; case 365: if (quota.QuotaAllocatedValue != -1) { maxRecipients.QuotaValue = quota.QuotaAllocatedValue; } break; case 366: if (quota.QuotaAllocatedValue != -1) { maxSendMessageSizeKB.QuotaValue = quota.QuotaAllocatedValue; } break; case 367: if (quota.QuotaAllocatedValue != -1) { maxReceiveMessageSizeKB.QuotaValue = quota.QuotaAllocatedValue; } break; case 83: chkPOP3.Checked = Convert.ToBoolean(quota.QuotaAllocatedValue); chkPOP3.Enabled = Convert.ToBoolean(quota.QuotaAllocatedValue); break; case 84: chkIMAP.Checked = Convert.ToBoolean(quota.QuotaAllocatedValue); chkIMAP.Enabled = Convert.ToBoolean(quota.QuotaAllocatedValue); break; case 85: chkOWA.Checked = Convert.ToBoolean(quota.QuotaAllocatedValue); chkOWA.Enabled = Convert.ToBoolean(quota.QuotaAllocatedValue); break; case 86: chkMAPI.Checked = Convert.ToBoolean(quota.QuotaAllocatedValue); chkMAPI.Enabled = Convert.ToBoolean(quota.QuotaAllocatedValue); break; case 87: chkActiveSync.Checked = Convert.ToBoolean(quota.QuotaAllocatedValue); chkActiveSync.Enabled = Convert.ToBoolean(quota.QuotaAllocatedValue); break; case 364: daysKeepDeletedItems.ValueDays = quota.QuotaAllocatedValue; daysKeepDeletedItems.RequireValidatorEnabled = true; break; case 420: chkEnableLitigationHold.Checked = Convert.ToBoolean(quota.QuotaAllocatedValue); chkEnableLitigationHold.Enabled = Convert.ToBoolean(quota.QuotaAllocatedValue); break; } sizeIssueWarning.ValueKB = 95; sizeProhibitSend.ValueKB = 100; sizeProhibitSendReceive.ValueKB = 100; recoverableItemsWarning.ValueKB = 95; RetentionPolicy = PanelRequest.GetBool("archiving", false); if (!RetentionPolicy) { chkEnableArchiving.Checked = true; archiveQuota.QuotaValue = cntx.Quotas[Quotas.EXCHANGE2013_ARCHIVINGSTORAGE].QuotaAllocatedValue; archiveWarningQuota.ValueKB = 95; } } } else { this.DisableControls = true; } } if (RetentionPolicy) { UpdateTags(); } locTitle.Text = RetentionPolicy ? GetLocalizedString("locTitleArchiving.Text") : GetLocalizedString("locTitle.Text"); secMailboxPlan.Text = RetentionPolicy ? GetLocalizedString("secMailboxPlanArchiving.Text") : GetLocalizedString("secMailboxPlan.Text"); UserSpaceBreadcrumb bc = FindControlRecursive(Page, "breadcrumb") as UserSpaceBreadcrumb; if (bc != null) { Label lbOrgCurPage = bc.FindControl("lbOrgCurPage") as Label; if (lbOrgCurPage != null) { lbOrgCurPage.Text = locTitle.Text; } } secMailboxFeatures.Visible = !RetentionPolicy; secMailboxGeneral.Visible = !RetentionPolicy; secStorageQuotas.Visible = !RetentionPolicy; secDeleteRetention.Visible = !RetentionPolicy; secLitigationHold.Visible = !RetentionPolicy; secArchiving.Visible = !RetentionPolicy; secRetentionPolicyTags.Visible = RetentionPolicy; valRequireMailboxPlan.ValidationGroup = MainValidationGroup; btnAdd.ValidationGroup = MainValidationGroup; } }