protected void bntAddTag_Click(object sender, EventArgs e)
        {
            int addTagId;

            if (!int.TryParse(ddTags.SelectedValue, out addTagId))
            {
                return;
            }

            Providers.HostedSolution.ExchangeRetentionPolicyTag tag = ES.Services.ExchangeServer.GetExchangeRetentionPolicyTag(PanelRequest.ItemID, addTagId);
            if (tag == null)
            {
                return;
            }

            List <ExchangeMailboxPlanRetentionPolicyTag> res = ViewState["Tags"] as List <ExchangeMailboxPlanRetentionPolicyTag>;

            if (res == null)
            {
                res = new List <ExchangeMailboxPlanRetentionPolicyTag>();
            }

            ExchangeMailboxPlanRetentionPolicyTag add = new ExchangeMailboxPlanRetentionPolicyTag();

            add.MailboxPlanId = PanelRequest.GetInt("MailboxPlanId");
            add.TagID         = tag.TagID;
            add.TagName       = tag.TagName;

            res.Add(add);

            ViewState["Tags"] = res;

            gvPolicy.DataSource = res;
            gvPolicy.DataBind();

            UpdateTags();
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);

            if (!IsPostBack)
            {
                string[] archivePolicy = ES.Services.SfB.GetPolicyList(PanelRequest.ItemID, SfBPolicyType.Archiving, null);
                if (archivePolicy != null)
                {
                    foreach (string policy in archivePolicy)
                    {
                        if (policy.ToLower() == "global")
                        {
                            continue;
                        }
                        string txt = policy.Replace("Tag:", "");
                        ddArchivingPolicy.Items.Add(new System.Web.UI.WebControls.ListItem(txt, policy));
                    }
                }

                if (PanelRequest.GetInt("SfBUserPlanId") != 0)
                {
                    Providers.HostedSolution.SfBUserPlan plan = ES.Services.SfB.GetSfBUserPlan(PanelRequest.ItemID, PanelRequest.GetInt("SfBUserPlanId"));

                    txtPlan.Text               = plan.SfBUserPlanName;
                    chkIM.Checked              = plan.IM;
                    chkIM.Enabled              = false;
                    chkFederation.Checked      = plan.Federation;
                    chkConferencing.Checked    = plan.Conferencing;
                    chkMobility.Checked        = plan.Mobility;
                    chkEnterpriseVoice.Checked = plan.EnterpriseVoice;

                    /* because not used
                     * switch (plan.VoicePolicy)
                     * {
                     *  case SfBVoicePolicyType.None:
                     *      break;
                     *  case SfBVoicePolicyType.Emergency:
                     *      chkEmergency.Checked = true;
                     *      break;
                     *  case SfBVoicePolicyType.National:
                     *      chkNational.Checked = true;
                     *      break;
                     *  case SfBVoicePolicyType.Mobile:
                     *      chkMobile.Checked = true;
                     *      break;
                     *  case SfBVoicePolicyType.International:
                     *      chkInternational.Checked = true;
                     *      break;
                     *  default:
                     *      chkNone.Checked = true;
                     *      break;
                     * }
                     */

                    chkRemoteUserAccess.Checked = plan.RemoteUserAccess;
                    chkAllowOrganizeMeetingsWithExternalAnonymous.Checked = plan.AllowOrganizeMeetingsWithExternalAnonymous;

                    Utils.SelectListItem(ddTelephony, plan.Telephony);

                    tbServerURI.Text = plan.ServerURI;

                    string planArchivePolicy = "";              if (plan.ArchivePolicy != null)
                    {
                        planArchivePolicy = plan.ArchivePolicy;
                    }
                    string planTelephonyDialPlanPolicy = "";    if (plan.TelephonyDialPlanPolicy != null)
                    {
                        planTelephonyDialPlanPolicy = plan.TelephonyDialPlanPolicy;
                    }
                    string planTelephonyVoicePolicy = "";       if (plan.TelephonyVoicePolicy != null)
                    {
                        planTelephonyVoicePolicy = plan.TelephonyVoicePolicy;
                    }

                    ddArchivingPolicy.Items.Clear();
                    ddArchivingPolicy.Items.Add(new System.Web.UI.WebControls.ListItem(planArchivePolicy.Replace("Tag:", ""), planArchivePolicy));
                    ddTelephonyDialPlanPolicy.Items.Clear();
                    ddTelephonyDialPlanPolicy.Items.Add(new System.Web.UI.WebControls.ListItem(planTelephonyDialPlanPolicy.Replace("Tag:", ""), planTelephonyDialPlanPolicy));
                    ddTelephonyVoicePolicy.Items.Clear();
                    ddTelephonyVoicePolicy.Items.Add(new System.Web.UI.WebControls.ListItem(planTelephonyVoicePolicy.Replace("Tag:", ""), planTelephonyVoicePolicy));

                    locTitle.Text        = plan.SfBUserPlanName;
                    this.DisableControls = true;
                }
                else
                {
                    chkIM.Checked = true;
                    chkIM.Enabled = false;

                    // chkNone.Checked = true; because not used

                    if (cntx != null)
                    {
                        foreach (QuotaValueInfo quota in cntx.QuotasArray)
                        {
                            switch (quota.QuotaId)
                            {
                            case 371:
                                chkFederation.Checked = Convert.ToBoolean(quota.QuotaAllocatedValue);
                                chkFederation.Enabled = Convert.ToBoolean(quota.QuotaAllocatedValue);
                                break;

                            case 372:
                                chkConferencing.Checked = Convert.ToBoolean(quota.QuotaAllocatedValue);
                                chkConferencing.Enabled = Convert.ToBoolean(quota.QuotaAllocatedValue);
                                break;
                            }
                        }
                    }
                    else
                    {
                        this.DisableControls = true;
                    }
                }
            }

            bool enterpriseVoiceQuota = Utils.CheckQouta(Quotas.SFB_ENTERPRISEVOICE, cntx);

            PlanFeaturesTelephony.Visible    = enterpriseVoiceQuota;
            secPlanFeaturesTelephony.Visible = enterpriseVoiceQuota;
            if (!enterpriseVoiceQuota)
            {
                Utils.SelectListItem(ddTelephony, "0");
            }

            bool enterpriseVoice = enterpriseVoiceQuota && (ddTelephony.SelectedValue == "2");

            chkEnterpriseVoice.Enabled = false;
            chkEnterpriseVoice.Checked = enterpriseVoice;
            pnEnterpriseVoice.Visible  = enterpriseVoice;

            switch (ddTelephony.SelectedValue)
            {
            case "3":
            case "4":
                pnServerURI.Visible = true;
                break;

            default:
                pnServerURI.Visible = false;
                break;
            }
        }
        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;
            }
        }
        /// <summary>
        /// 创建面板,请求资源管理器
        /// </summary>
        /// <param name="type"></param>
        public void CreatePanel(string name, PanelType type = PanelType.Type0, LuaFunction func = null, Action <UObject> sharpFunc = null)
        {
            //logger.debug(@"创建面板,请求资源管理器");
            string assetName = name + "Panel";
            string abName    = name.ToLower() + AppConst.ExtName;

            logger.debug("CreatePanel  assetName:" + assetName + " abName:" + abName);
            //检查这个界面是不是弹出来了
            if (Parent.FindChild(name) != null)
            {
                return;
            }
            //如果可能检查缓存(现在不做这个)

#if ASYNC_MODE
            ResManager.LoadPrefab(abName, assetName, delegate(UnityEngine.Object[] objs) {
                if (objs.Length == 0)
                {
                    return;
                }
                GameObject prefab = objs[0] as GameObject;
                if (prefab == null)
                {
                    return;
                }
                //成功
                GameObject go = Instantiate(prefab) as GameObject;
                go.name       = assetName;
                go.layer      = LayerMask.NameToLayer("Default");
                go.transform.SetParent(Parent);
                go.transform.localScale    = Vector3.one;
                go.transform.localPosition = Vector3.zero;
                //添加lua代码进入到控制结构
                go.AddComponent <LuaBehaviour>();
                var request       = new PanelRequest();
                request.name      = name;
                request.type      = type;
                request.luaFunc   = func;
                request.sharpFunc = sharpFunc;
                request.obj       = go;
                requestStack.Push(request);
                if (func != null)
                {
                    func.Call(go);
                }
                if (sharpFunc != null)
                {
                    sharpFunc(go);
                }
                logger.warn("CreatePanel::>> " + name + " " + prefab + " count:" + count + " requestStack.count:" + requestStack.Count);
                count++;
            });
#else
            GameObject prefab = ResManager.LoadAsset <GameObject>(name, assetName);
            if (prefab == null)
            {
                return;
            }

            GameObject go = Instantiate(prefab) as GameObject;
            go.name  = assetName;
            go.layer = LayerMask.NameToLayer("Default");
            go.transform.SetParent(Parent);
            go.transform.localScale    = Vector3.one;
            go.transform.localPosition = Vector3.zero;
            go.AddComponent <LuaBehaviour>();
            //成功
            if (func != null)
            {
                func.Call(go);
            }
            logger.warn("CreatePanel::>> " + name + " " + prefab);
            count++;
#endif
        }