protected void btnUpdatePlan_Click(object sender, EventArgs e) { if (ViewState["LyncUserPlanID"] == null) { return; } int planId = (int)ViewState["LyncUserPlanID"]; Providers.HostedSolution.Organization[] orgs = null; Providers.HostedSolution.LyncUserPlan plan; if (PanelSecurity.SelectedUserId != 1) { PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId); if ((Packages != null) & (Packages.GetLength(0) > 0)) { orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false); } } else { orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false); } plan = ES.Services.Lync.GetLyncUserPlan(orgs[0].Id, planId); if (plan.ItemId != orgs[0].Id) { messageBox.ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN"); BindPlans(); return; } plan = new Providers.HostedSolution.LyncUserPlan(); plan.LyncUserPlanId = (int)ViewState["LyncUserPlanID"]; plan.LyncUserPlanName = txtPlan.Text; plan.IsDefault = false; plan.IM = true; plan.Mobility = chkMobility.Checked; plan.Federation = chkFederation.Checked; plan.Conferencing = chkConferencing.Checked; plan.EnterpriseVoice = chkEnterpriseVoice.Checked; plan.VoicePolicy = LyncVoicePolicyType.None; plan.RemoteUserAccess = chkRemoteUserAccess.Checked; plan.AllowOrganizeMeetingsWithExternalAnonymous = chkAllowOrganizeMeetingsWithExternalAnonymous.Checked; plan.Telephony = ddTelephony.SelectedIndex; plan.ServerURI = tbServerURI.Text; plan.ArchivePolicy = ddArchivingPolicy.SelectedValue; plan.TelephonyDialPlanPolicy = ddTelephonyDialPlanPolicy.SelectedValue; plan.TelephonyVoicePolicy = ddTelephonyVoicePolicy.SelectedValue; if (PanelSecurity.SelectedUser.Role == UserRole.Administrator) { plan.LyncUserPlanType = (int)LyncUserPlanType.Administrator; } else if (PanelSecurity.SelectedUser.Role == UserRole.Reseller) { plan.LyncUserPlanType = (int)LyncUserPlanType.Reseller; } if ((orgs != null) & (orgs.GetLength(0) > 0)) { int result = ES.Services.Lync.UpdateLyncUserPlan(orgs[0].Id, plan); if (result < 0) { messageBox.ShowErrorMessage("LYNC_UPDATEPLANS"); } else { messageBox.ShowSuccessMessage("LYNC_UPDATEPLANS"); } } BindPlans(); }
public void btnAddPlan_Click(object sender, EventArgs e) { int count = 0; if (list != null) { foreach (LyncUserPlan p in list) { p.LyncUserPlanId = count; count++; } } Providers.HostedSolution.LyncUserPlan plan = new Providers.HostedSolution.LyncUserPlan(); plan.LyncUserPlanName = txtPlan.Text; plan.IsDefault = false; plan.IM = true; plan.Mobility = chkMobility.Checked; plan.Federation = chkFederation.Checked; plan.Conferencing = chkConferencing.Checked; plan.EnterpriseVoice = chkEnterpriseVoice.Checked; plan.VoicePolicy = LyncVoicePolicyType.None; plan.RemoteUserAccess = chkRemoteUserAccess.Checked; plan.AllowOrganizeMeetingsWithExternalAnonymous = chkAllowOrganizeMeetingsWithExternalAnonymous.Checked; plan.Telephony = ddTelephony.SelectedIndex; plan.ServerURI = tbServerURI.Text; plan.ArchivePolicy = ddArchivingPolicy.SelectedValue; plan.TelephonyDialPlanPolicy = ddTelephonyDialPlanPolicy.SelectedValue; plan.TelephonyVoicePolicy = ddTelephonyVoicePolicy.SelectedValue; if (PanelSecurity.SelectedUser.Role == UserRole.Administrator) { plan.LyncUserPlanType = (int)LyncUserPlanType.Administrator; } else if (PanelSecurity.SelectedUser.Role == UserRole.Reseller) { plan.LyncUserPlanType = (int)LyncUserPlanType.Reseller; } Providers.HostedSolution.Organization[] orgs = null; if (PanelSecurity.SelectedUserId != 1) { PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId); if ((Packages != null) & (Packages.GetLength(0) > 0)) { orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false); } } else { orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false); } if ((orgs != null) & (orgs.GetLength(0) > 0)) { int result = ES.Services.Lync.AddLyncUserPlan(orgs[0].Id, plan); if (result < 0) { messageBox.ShowResultMessage(result); return; } } BindPlans(); }
protected void Page_Load(object sender, EventArgs e) { PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); if (!IsPostBack) { string[] archivePolicy = ES.Services.Lync.GetPolicyList(PanelRequest.ItemID, LyncPolicyType.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("LyncUserPlanId") != 0) { Providers.HostedSolution.LyncUserPlan plan = ES.Services.Lync.GetLyncUserPlan(PanelRequest.ItemID, PanelRequest.GetInt("LyncUserPlanId")); txtPlan.Text = plan.LyncUserPlanName; 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 LyncVoicePolicyType.None: * break; * case LyncVoicePolicyType.Emergency: * chkEmergency.Checked = true; * break; * case LyncVoicePolicyType.National: * chkNational.Checked = true; * break; * case LyncVoicePolicyType.Mobile: * chkMobile.Checked = true; * break; * case LyncVoicePolicyType.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.LyncUserPlanName; 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.LYNC_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; } }
private void AddPlan() { try { PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); Providers.HostedSolution.LyncUserPlan plan = new Providers.HostedSolution.LyncUserPlan(); plan.LyncUserPlanName = txtPlan.Text; plan.IsDefault = false; plan.IM = true; plan.Mobility = chkMobility.Checked; plan.Federation = chkFederation.Checked; plan.Conferencing = chkConferencing.Checked; bool enterpriseVoiceQuota = Utils.CheckQouta(Quotas.LYNC_ENTERPRISEVOICE, cntx); bool enterpriseVoice = enterpriseVoiceQuota && (ddTelephony.SelectedValue == "2"); plan.EnterpriseVoice = enterpriseVoice; plan.VoicePolicy = LyncVoicePolicyType.None; /* because not used * if (!plan.EnterpriseVoice) * { * plan.VoicePolicy = LyncVoicePolicyType.None; * } * else * { * if (chkEmergency.Checked) * plan.VoicePolicy = LyncVoicePolicyType.Emergency; * else if (chkNational.Checked) * plan.VoicePolicy = LyncVoicePolicyType.National; * else if (chkMobile.Checked) * plan.VoicePolicy = LyncVoicePolicyType.Mobile; * else if (chkInternational.Checked) * plan.VoicePolicy = LyncVoicePolicyType.International; * else * plan.VoicePolicy = LyncVoicePolicyType.None; * * } */ plan.RemoteUserAccess = chkRemoteUserAccess.Checked; plan.AllowOrganizeMeetingsWithExternalAnonymous = chkAllowOrganizeMeetingsWithExternalAnonymous.Checked; int telephonyId = -1; int.TryParse(ddTelephony.SelectedValue, out telephonyId); plan.Telephony = telephonyId; plan.ServerURI = tbServerURI.Text; plan.ArchivePolicy = ddArchivingPolicy.SelectedValue; plan.TelephonyDialPlanPolicy = ddTelephonyDialPlanPolicy.SelectedValue; plan.TelephonyVoicePolicy = ddTelephonyVoicePolicy.SelectedValue; int result = ES.Services.Lync.AddLyncUserPlan(PanelRequest.ItemID, plan); if (result < 0) { messageBox.ShowResultMessage(result); messageBox.ShowErrorMessage("LYNC_UNABLE_TO_ADD_PLAN"); return; } Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "lync_userplans", "SpaceID=" + PanelSecurity.PackageId)); } catch (Exception ex) { messageBox.ShowErrorMessage("LYNC_ADD_PLAN", ex); } }
protected void btnUpdatePlan_Click(object sender, EventArgs e) { if (ViewState["LyncUserPlanID"] == null) return; int planId = (int)ViewState["LyncUserPlanID"]; Providers.HostedSolution.Organization[] orgs = null; Providers.HostedSolution.LyncUserPlan plan; if (PanelSecurity.SelectedUserId != 1) { PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId); if ((Packages != null) & (Packages.GetLength(0) > 0)) { orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false); } } else { orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false); } plan = ES.Services.Lync.GetLyncUserPlan(orgs[0].Id, planId); if (plan.ItemId != orgs[0].Id) { messageBox.ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN"); BindPlans(); return; } plan = new Providers.HostedSolution.LyncUserPlan(); plan.LyncUserPlanId = (int)ViewState["LyncUserPlanID"]; plan.LyncUserPlanName = txtPlan.Text; plan.IsDefault = false; plan.IM = true; plan.Mobility = chkMobility.Checked; plan.Federation = chkFederation.Checked; plan.Conferencing = chkConferencing.Checked; plan.EnterpriseVoice = chkEnterpriseVoice.Checked; plan.VoicePolicy = LyncVoicePolicyType.None; plan.RemoteUserAccess = chkRemoteUserAccess.Checked; plan.AllowOrganizeMeetingsWithExternalAnonymous = chkAllowOrganizeMeetingsWithExternalAnonymous.Checked; plan.Telephony = ddTelephony.SelectedIndex; plan.ServerURI = tbServerURI.Text; plan.ArchivePolicy = ddArchivingPolicy.SelectedValue; plan.TelephonyDialPlanPolicy = ddTelephonyDialPlanPolicy.SelectedValue; plan.TelephonyVoicePolicy = ddTelephonyVoicePolicy.SelectedValue; if (PanelSecurity.SelectedUser.Role == UserRole.Administrator) plan.LyncUserPlanType = (int)LyncUserPlanType.Administrator; else if (PanelSecurity.SelectedUser.Role == UserRole.Reseller) plan.LyncUserPlanType = (int)LyncUserPlanType.Reseller; if ((orgs != null) & (orgs.GetLength(0) > 0)) { int result = ES.Services.Lync.UpdateLyncUserPlan(orgs[0].Id, plan); if (result < 0) { messageBox.ShowErrorMessage("LYNC_UPDATEPLANS"); } else { messageBox.ShowSuccessMessage("LYNC_UPDATEPLANS"); } } BindPlans(); }
public void btnAddPlan_Click(object sender, EventArgs e) { int count = 0; if (list != null) { foreach (LyncUserPlan p in list) { p.LyncUserPlanId = count; count++; } } Providers.HostedSolution.LyncUserPlan plan = new Providers.HostedSolution.LyncUserPlan(); plan.LyncUserPlanName = txtPlan.Text; plan.IsDefault = false; plan.IM = true; plan.Mobility = chkMobility.Checked; plan.Federation = chkFederation.Checked; plan.Conferencing = chkConferencing.Checked; plan.EnterpriseVoice = chkEnterpriseVoice.Checked; plan.VoicePolicy = LyncVoicePolicyType.None; plan.RemoteUserAccess = chkRemoteUserAccess.Checked; plan.AllowOrganizeMeetingsWithExternalAnonymous = chkAllowOrganizeMeetingsWithExternalAnonymous.Checked; plan.Telephony = ddTelephony.SelectedIndex; plan.ServerURI = tbServerURI.Text; plan.ArchivePolicy = ddArchivingPolicy.SelectedValue; plan.TelephonyDialPlanPolicy = ddTelephonyDialPlanPolicy.SelectedValue; plan.TelephonyVoicePolicy = ddTelephonyVoicePolicy.SelectedValue; if (PanelSecurity.SelectedUser.Role == UserRole.Administrator) plan.LyncUserPlanType = (int)LyncUserPlanType.Administrator; else if (PanelSecurity.SelectedUser.Role == UserRole.Reseller) plan.LyncUserPlanType = (int)LyncUserPlanType.Reseller; Providers.HostedSolution.Organization[] orgs = null; if (PanelSecurity.SelectedUserId != 1) { PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId); if ((Packages != null) & (Packages.GetLength(0) > 0)) { orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false); } } else { orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false); } if ((orgs != null) & (orgs.GetLength(0) > 0)) { int result = ES.Services.Lync.AddLyncUserPlan(orgs[0].Id, plan); if (result < 0) { messageBox.ShowResultMessage(result); return; } } BindPlans(); }