From c41abafe5d6c0acbd78b29576d9c8b4e1f783c27 Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Wed, 22 May 2013 11:44:40 +0400 Subject: [PATCH 1/8] adding to Lync2010 : Enterprise Voice, Archiving Policy, Dial Plan, Voice Policy --- WebsitePanel/Database/update_db.sql | 321 ++++++++++++++++++ .../LyncProxy.cs | 9 + .../Code/Data/DataProvider.cs | 30 +- .../Code/HostedSolution/LyncController.cs | 78 ++++- .../esLync.asmx.cs | 7 + .../HostedSolution/ILyncServer.cs | 2 + .../HostedSolution/LyncPolicyType.cs | 16 + .../HostedSolution/LyncUser.cs | 2 + .../HostedSolution/LyncUserPlan.cs | 57 ++++ .../WebsitePanel.Providers.Base.csproj | 1 + .../Lync2010.cs | 136 +++++++- .../LyncServerProxy.cs | 10 + .../WebsitePanel.Server/LyncServer.asmx.cs | 18 + .../WebsitePanel_SharedResources.ascx.resx | 6 + .../Lync/LyncAddLyncUserPlan.ascx | 138 +++++++- .../Lync/LyncAddLyncUserPlan.ascx.cs | 114 ++++++- .../Lync/LyncAddLyncUserPlan.ascx.designer.cs | 266 +++++++++++---- .../WebsitePanel/Lync/LyncCreateUser.ascx | 34 +- .../WebsitePanel/Lync/LyncCreateUser.ascx.cs | 42 +++ .../Lync/LyncCreateUser.ascx.designer.cs | 96 ++++-- .../WebsitePanel/Lync/LyncEditUser.ascx | 34 +- .../WebsitePanel/Lync/LyncEditUser.ascx.cs | 37 +- .../Lync/LyncEditUser.ascx.designer.cs | 96 ++++-- .../UserControls/LyncUserPlanSelector.ascx | 2 +- .../UserControls/LyncUserPlanSelector.ascx.cs | 20 +- .../LyncUserPlanSelector.ascx.designer.cs | 32 +- .../SettingsLyncUserPlansPolicy.ascx | 228 ++++++++++--- .../SettingsLyncUserPlansPolicy.ascx.cs | 199 +++++++---- ...ttingsLyncUserPlansPolicy.ascx.designer.cs | 259 +++++++++++--- 29 files changed, 1934 insertions(+), 356 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncPolicyType.cs diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index dc73f195..83559c7b 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -454,3 +454,324 @@ GO -- add Application Pools Restart Quota INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota]) VALUES (411, 2, 13, N'Web.AppPoolsRestart', N'Application Pools Restart', 1, 0, NULL, NULL) GO + +-- Lync Enterprise Voice + +BEGIN +ALTER TABLE [dbo].[LyncUserPlans] ADD + +[RemoteUserAccess] [bit] NOT NULL DEFAULT 0, +[PublicIMConnectivity] [bit] NOT NULL DEFAULT 0, + +[AllowOrganizeMeetingsWithExternalAnonymous] [bit] NOT NULL DEFAULT 0, + +[Telephony] [int] NULL, + +[ServerURI] [nvarchar](300) NULL, + +[ArchivePolicy] [nvarchar](300) NULL, +[TelephonyDialPlanPolicy] [nvarchar](300) NULL, +[TelephonyVoicePolicy] [nvarchar](300) NULL + + +END +Go + +-- + +DROP PROCEDURE GetLyncUserPlan; + +DROP PROCEDURE AddLyncUserPlan; + +DROP PROCEDURE UpdateLyncUserPlan; + +DROP PROCEDURE DeleteLyncUserPlan; + +-- + +IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'DeleteLyncUserPlan') +BEGIN +EXEC sp_executesql N'CREATE PROCEDURE [dbo].[DeleteLyncUserPlan] +( + @LyncUserPlanId int +) +AS + +-- delete lyncuserplan +DELETE FROM LyncUserPlans +WHERE LyncUserPlanId = @LyncUserPlanId + +RETURN' +END +GO + +-- + +IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'UpdateLyncUserPlan') +BEGIN +EXEC sp_executesql N' CREATE PROCEDURE [dbo].[UpdateLyncUserPlan] +( + @LyncUserPlanId int, + @LyncUserPlanName nvarchar(300), + @LyncUserPlanType int, + @IM bit, + @Mobility bit, + @MobilityEnableOutsideVoice bit, + @Federation bit, + @Conferencing bit, + @EnterpriseVoice bit, + @VoicePolicy int, + @IsDefault bit, + + @RemoteUserAccess bit, + @PublicIMConnectivity bit, + + @AllowOrganizeMeetingsWithExternalAnonymous bit, + + @Telephony int, + + @ServerURI nvarchar(300), + + @ArchivePolicy nvarchar(300), + + @TelephonyDialPlanPolicy nvarchar(300), + @TelephonyVoicePolicy nvarchar(300) +) +AS + +UPDATE LyncUserPlans SET + LyncUserPlanName = @LyncUserPlanName, + LyncUserPlanType = @LyncUserPlanType, + IM = @IM, + Mobility = @Mobility, + MobilityEnableOutsideVoice = @MobilityEnableOutsideVoice, + Federation = @Federation, + Conferencing =@Conferencing, + EnterpriseVoice = @EnterpriseVoice, + VoicePolicy = @VoicePolicy, + IsDefault = @IsDefault, + + RemoteUserAccess = @RemoteUserAccess, + PublicIMConnectivity = @PublicIMConnectivity, + + AllowOrganizeMeetingsWithExternalAnonymous = @AllowOrganizeMeetingsWithExternalAnonymous, + + Telephony = @Telephony, + + ServerURI = @ServerURI, + + ArchivePolicy = @ArchivePolicy, + TelephonyDialPlanPolicy = @TelephonyDialPlanPolicy, + TelephonyVoicePolicy = @TelephonyVoicePolicy + +WHERE LyncUserPlanId = @LyncUserPlanId + + +RETURN' +END +GO + +-- + +IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'AddLyncUserPlan') +BEGIN +EXEC sp_executesql N'CREATE PROCEDURE [dbo].[AddLyncUserPlan] +( + @LyncUserPlanId int OUTPUT, + @ItemID int, + @LyncUserPlanName nvarchar(300), + @LyncUserPlanType int, + @IM bit, + @Mobility bit, + @MobilityEnableOutsideVoice bit, + @Federation bit, + @Conferencing bit, + @EnterpriseVoice bit, + @VoicePolicy int, + @IsDefault bit, + + @RemoteUserAccess bit, + @PublicIMConnectivity bit, + + @AllowOrganizeMeetingsWithExternalAnonymous bit, + + @Telephony int, + + @ServerURI nvarchar(300), + + @ArchivePolicy nvarchar(300), + @TelephonyDialPlanPolicy nvarchar(300), + @TelephonyVoicePolicy nvarchar(300) + +) +AS + + + +IF (((SELECT Count(*) FROM LyncUserPlans WHERE ItemId = @ItemID) = 0) AND (@LyncUserPlanType=0)) +BEGIN + SET @IsDefault = 1 +END +ELSE +BEGIN + IF ((@IsDefault = 1) AND (@LyncUserPlanType=0)) + BEGIN + UPDATE LyncUserPlans SET IsDefault = 0 WHERE ItemID = @ItemID + END +END + + +INSERT INTO LyncUserPlans +( + ItemID, + LyncUserPlanName, + LyncUserPlanType, + IM, + Mobility, + MobilityEnableOutsideVoice, + Federation, + Conferencing, + EnterpriseVoice, + VoicePolicy, + IsDefault, + + RemoteUserAccess, + PublicIMConnectivity, + + AllowOrganizeMeetingsWithExternalAnonymous, + + Telephony, + + ServerURI, + + ArchivePolicy, + TelephonyDialPlanPolicy, + TelephonyVoicePolicy + +) +VALUES +( + @ItemID, + @LyncUserPlanName, + @LyncUserPlanType, + @IM, + @Mobility, + @MobilityEnableOutsideVoice, + @Federation, + @Conferencing, + @EnterpriseVoice, + @VoicePolicy, + @IsDefault, + + @RemoteUserAccess, + @PublicIMConnectivity, + + @AllowOrganizeMeetingsWithExternalAnonymous, + + @Telephony, + + @ServerURI, + + @ArchivePolicy, + @TelephonyDialPlanPolicy, + @TelephonyVoicePolicy + +) + +SET @LyncUserPlanId = SCOPE_IDENTITY() + +RETURN' +END +GO + +-- + + +IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'GetLyncUserPlan') +BEGIN +EXEC sp_executesql N'CREATE PROCEDURE [dbo].[GetLyncUserPlan] +( + @LyncUserPlanId int +) +AS +SELECT + LyncUserPlanId, + ItemID, + LyncUserPlanName, + LyncUserPlanType, + IM, + Mobility, + MobilityEnableOutsideVoice, + Federation, + Conferencing, + EnterpriseVoice, + VoicePolicy, + IsDefault, + + RemoteUserAccess, + PublicIMConnectivity, + + AllowOrganizeMeetingsWithExternalAnonymous, + + Telephony, + + ServerURI, + + ArchivePolicy, + TelephonyDialPlanPolicy, + TelephonyVoicePolicy + +FROM + LyncUserPlans +WHERE + LyncUserPlanId = @LyncUserPlanId +RETURN' +END +GO + + + + + +ALTER PROCEDURE [dbo].[GetLyncUserPlan] +( + @LyncUserPlanId int +) +AS +SELECT + LyncUserPlanId, + ItemID, + LyncUserPlanName, + LyncUserPlanType, + IM, + Mobility, + MobilityEnableOutsideVoice, + Federation, + Conferencing, + EnterpriseVoice, + VoicePolicy, + IsDefault, + + RemoteUserAccess, + PublicIMConnectivity, + + AllowOrganizeMeetingsWithExternalAnonymous, + + Telephony, + + ServerURI, + + ArchivePolicy, + TelephonyDialPlanPolicy, + TelephonyVoicePolicy + +FROM + LyncUserPlans +WHERE + LyncUserPlanId = @LyncUserPlanId +RETURN +GO + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/LyncProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/LyncProxy.cs index cce2aeac..952cc22f 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/LyncProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/LyncProxy.cs @@ -912,6 +912,15 @@ namespace WebsitePanel.EnterpriseServer { this.RemoveFederationDomainCompleted(this, new RemoveFederationDomainCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetPolicyList", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string[] GetPolicyList(int itemId, LyncPolicyType type, string name) + { + object[] results = this.Invoke("GetPolicyList", new object[] { + itemId, type, name}); + return ((string[])(results[0])); + } /// public new void CancelAsync(object userState) { diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs index 0aaf98a5..ae5d603b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs @@ -3444,7 +3444,20 @@ namespace WebsitePanel.EnterpriseServer new SqlParameter("@Conferencing", lyncUserPlan.Conferencing), new SqlParameter("@EnterpriseVoice", lyncUserPlan.EnterpriseVoice), new SqlParameter("@VoicePolicy", lyncUserPlan.VoicePolicy), - new SqlParameter("@IsDefault", lyncUserPlan.IsDefault) + new SqlParameter("@IsDefault", lyncUserPlan.IsDefault), + + new SqlParameter("@RemoteUserAccess", lyncUserPlan.RemoteUserAccess), + new SqlParameter("@PublicIMConnectivity", lyncUserPlan.PublicIMConnectivity), + + new SqlParameter("@AllowOrganizeMeetingsWithExternalAnonymous", lyncUserPlan.AllowOrganizeMeetingsWithExternalAnonymous), + + new SqlParameter("@Telephony", lyncUserPlan.Telephony), + + new SqlParameter("@ServerURI", lyncUserPlan.ServerURI), + + new SqlParameter("@ArchivePolicy", lyncUserPlan.ArchivePolicy), + new SqlParameter("@TelephonyDialPlanPolicy", lyncUserPlan.TelephonyDialPlanPolicy), + new SqlParameter("@TelephonyVoicePolicy", lyncUserPlan.TelephonyVoicePolicy) ); return Convert.ToInt32(outParam.Value); @@ -3467,7 +3480,20 @@ namespace WebsitePanel.EnterpriseServer new SqlParameter("@Conferencing", lyncUserPlan.Conferencing), new SqlParameter("@EnterpriseVoice", lyncUserPlan.EnterpriseVoice), new SqlParameter("@VoicePolicy", lyncUserPlan.VoicePolicy), - new SqlParameter("@IsDefault", lyncUserPlan.IsDefault) + new SqlParameter("@IsDefault", lyncUserPlan.IsDefault), + + new SqlParameter("@RemoteUserAccess", lyncUserPlan.RemoteUserAccess), + new SqlParameter("@PublicIMConnectivity", lyncUserPlan.PublicIMConnectivity), + + new SqlParameter("@AllowOrganizeMeetingsWithExternalAnonymous", lyncUserPlan.AllowOrganizeMeetingsWithExternalAnonymous), + + new SqlParameter("@Telephony", lyncUserPlan.Telephony), + + new SqlParameter("@ServerURI", lyncUserPlan.ServerURI), + + new SqlParameter("@ArchivePolicy", lyncUserPlan.ArchivePolicy), + new SqlParameter("@TelephonyDialPlanPolicy", lyncUserPlan.TelephonyDialPlanPolicy), + new SqlParameter("@TelephonyVoicePolicy", lyncUserPlan.TelephonyVoicePolicy) ); } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs index a72d5b59..9652202e 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs @@ -53,8 +53,11 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution List resSettings = new List(lyncSettings); - ExtendLyncSettings(resSettings, "primarydomaincontroller", GetProviderProperty(organizationServiceId, "primarydomaincontroller")); - ExtendLyncSettings(resSettings, "rootou", GetProviderProperty(organizationServiceId, "rootou")); + if (organizationServiceId != -1) + { + ExtendLyncSettings(resSettings, "primarydomaincontroller", GetProviderProperty(organizationServiceId, "primarydomaincontroller")); + ExtendLyncSettings(resSettings, "rootou", GetProviderProperty(organizationServiceId, "rootou")); + } ws.ServiceProviderSettingsSoapHeaderValue.Settings = resSettings.ToArray(); return ws; } @@ -345,6 +348,13 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution { LyncUserResult res = TaskManager.StartResultTask("LYNC", "SET_LYNC_USER_GENERAL_SETTINGS"); + string PIN = ""; + + string[] uriAndPin = ("" + lineUri).Split(':'); + + if (uriAndPin.Length > 0) lineUri = uriAndPin[0]; + if (uriAndPin.Length > 1) PIN = uriAndPin[1]; + LyncUser user = null; try @@ -378,20 +388,22 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution if (!string.IsNullOrEmpty(sipAddress)) { - if (sipAddress != usr.UserPrincipalName) + if (user.SipAddress != sipAddress) { - if (DataProvider.LyncUserExists(accountId, sipAddress)) + if (sipAddress != usr.UserPrincipalName) { - TaskManager.CompleteResultTask(res, LyncErrorCodes.ADDRESS_ALREADY_USED); - return res; + if (DataProvider.LyncUserExists(accountId, sipAddress)) + { + TaskManager.CompleteResultTask(res, LyncErrorCodes.ADDRESS_ALREADY_USED); + return res; + } } + user.SipAddress = sipAddress; } - - user.SipAddress = sipAddress; - } - if (!string.IsNullOrEmpty(lineUri)) user.LineUri = lineUri; + user.LineUri = lineUri; + user.PIN = PIN; lync.SetLyncUserGeneralSettings(org.OrganizationId, usr.UserPrincipalName, user); @@ -411,7 +423,6 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution } - public static int DeleteOrganization(int itemId) { // check account @@ -1011,6 +1022,51 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution #endregion + public static string[] GetPolicyList(int itemId, LyncPolicyType type, string name) + { + string[] ret = null; + try + { + if (itemId == -1) + { + // policy list in all lync servers + List allpolicylist = new List(); + List servers = ServerController.GetAllServers(); + foreach (ServerInfo server in servers) + { + List services = ServerController.GetServicesByServerIdGroupName(server.ServerId, ResourceGroups.Lync); + foreach (ServiceInfo service in services) + { + LyncServer lync = GetLyncServer(service.ServiceId, -1); + string[] values = lync.GetPolicyList(type, name); + foreach (string val in values) + if (allpolicylist.IndexOf(val) == -1) + allpolicylist.Add(val); + } + + } + ret = allpolicylist.ToArray(); + } + else + { + + Organization org = (Organization)PackageController.GetPackageItem(itemId); + + int lyncServiceId = GetLyncServiceID(org.PackageId); + LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId); + + ret = lync.GetPolicyList(type, name); + } + } + catch (Exception ex) + { + } + finally + { + } + + return ret; + } #region Private methods public static UInt64 ConvertPhoneNumberToLong(string ip) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esLync.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esLync.asmx.cs index 8006be54..3b35d88c 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esLync.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esLync.asmx.cs @@ -151,5 +151,12 @@ namespace WebsitePanel.EnterpriseServer } #endregion + + [WebMethod] + public string[] GetPolicyList(int itemId, LyncPolicyType type, string name) + { + return LyncController.GetPolicyList(itemId, type, name); + } + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ILyncServer.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ILyncServer.cs index 16d7e005..39dee306 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ILyncServer.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/ILyncServer.cs @@ -48,5 +48,7 @@ namespace WebsitePanel.Providers.HostedSolution bool RemoveFederationDomain(string organizationId, string domainName); void ReloadConfiguration(); + + string[] GetPolicyList(LyncPolicyType type, string name); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncPolicyType.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncPolicyType.cs new file mode 100644 index 00000000..d1971d37 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncPolicyType.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WebsitePanel.Providers.HostedSolution +{ + public enum LyncPolicyType + { + Archiving = 0, + DialPlan = 1, + Voice = 2, + Pin = 3 + } + +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncUser.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncUser.cs index e95a9436..dc5f7931 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncUser.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncUser.cs @@ -41,5 +41,7 @@ namespace WebsitePanel.Providers.HostedSolution public int AccountID { get; set; } public int LyncUserPlanId { get; set; } public string LyncUserPlanName { get; set; } + + public string PIN { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncUserPlan.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncUserPlan.cs index 75fac709..ea5ea424 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncUserPlan.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncUserPlan.cs @@ -122,6 +122,63 @@ namespace WebsitePanel.Providers.HostedSolution set { this.voicePolicy = value; } } + bool remoteUserAccess; + bool publicIMConnectivity; + bool allowOrganizeMeetingsWithExternalAnonymous; + + int telephony; + + string serverURI; + + string archivePolicy; + string telephonyDialPlanPolicy; + string telephonyVoicePolicy; + + public bool RemoteUserAccess + { + get { return this.remoteUserAccess; } + set { this.remoteUserAccess = value; } + } + public bool PublicIMConnectivity + { + get { return this.publicIMConnectivity; } + set { this.publicIMConnectivity = value; } + } + + public bool AllowOrganizeMeetingsWithExternalAnonymous + { + get { return this.allowOrganizeMeetingsWithExternalAnonymous; } + set { this.allowOrganizeMeetingsWithExternalAnonymous = value; } + } + + public int Telephony + { + get { return this.telephony; } + set { this.telephony = value; } + } + + public string ServerURI + { + get { return this.serverURI; } + set { this.serverURI = value; } + } + + public string ArchivePolicy + { + get { return this.archivePolicy; } + set { this.archivePolicy = value; } + } + + public string TelephonyDialPlanPolicy + { + get { return this.telephonyDialPlanPolicy; } + set { this.telephonyDialPlanPolicy = value; } + } + public string TelephonyVoicePolicy + { + get { return this.telephonyVoicePolicy; } + set { this.telephonyVoicePolicy = value; } + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index 9b6ebfe7..4aa7d9d3 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -92,6 +92,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Lync2010.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Lync2010.cs index be5e9397..9b91a9fe 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Lync2010.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/Lync2010.cs @@ -163,6 +163,11 @@ namespace WebsitePanel.Providers.HostedSolution ReloadConfigurationInternal(); } + public string[] GetPolicyList(LyncPolicyType type, string name) + { + return GetPolicyListInternal(type, name); + } + #endregion #region organization @@ -297,8 +302,8 @@ namespace WebsitePanel.Providers.HostedSolution string path = AddADPrefix(GetOrganizationPath(organizationId)); DirectoryEntry ou = ActiveDirectoryUtils.GetADObject(path); string[] sipDs = (string[])ActiveDirectoryUtils.GetADObjectPropertyMultiValue(ou, "msRTCSIP-Domains"); - - foreach (string sipD in sipDs) + + foreach (string sipD in sipDs) DeleteSipDomain(runSpace, sipD); //clear the msRTCSIP-Domains, TenantID, ObjectID @@ -518,6 +523,8 @@ namespace WebsitePanel.Providers.HostedSolution lyncUser.LineUri = (string)GetPSObjectProperty(user, "LineURI"); lyncUser.SipAddress = lyncUser.SipAddress.ToLower().Replace("sip:", ""); + lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:+", ""); + lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:", ""); } catch (Exception ex) { @@ -611,11 +618,20 @@ namespace WebsitePanel.Providers.HostedSolution cmd = new Command("Set-CsUser"); cmd.Parameters.Add("Identity", userUpn); - if (!string.IsNullOrEmpty(lyncUser.SipAddress)) cmd.Parameters.Add("SipAddress", "SIP:"+lyncUser.SipAddress); - if (!string.IsNullOrEmpty(lyncUser.SipAddress)) cmd.Parameters.Add("LineUri", lyncUser.LineUri); - + if (!string.IsNullOrEmpty(lyncUser.SipAddress)) cmd.Parameters.Add("SipAddress", "SIP:" + lyncUser.SipAddress); + if (!string.IsNullOrEmpty(lyncUser.LineUri)) cmd.Parameters.Add("LineUri", "TEL:+" + lyncUser.LineUri); + else cmd.Parameters.Add("LineUri", null); ExecuteShellCommand(runSpace, cmd, false); + if (!String.IsNullOrEmpty(lyncUser.PIN)) + { + cmd = new Command("Set-CsClientPin"); + cmd.Parameters.Add("Identity", userUpn); + cmd.Parameters.Add("Pin", lyncUser.PIN); + ExecuteShellCommand(runSpace, cmd, false); + } + + //initiate addressbook generation cmd = new Command("Update-CsAddressBook"); ExecuteShellCommand(runSpace, cmd, false); @@ -657,8 +673,14 @@ namespace WebsitePanel.Providers.HostedSolution bCloseRunSpace = true; } + // EnterpriseVoice + Command cmd = new Command("Set-CsUser"); + cmd.Parameters.Add("Identity", userUpn); + cmd.Parameters.Add("EnterpriseVoiceEnabled", plan.EnterpriseVoice); + ExecuteShellCommand(runSpace, cmd, false); + //CsExternalAccessPolicy - Command cmd = new Command("Grant-CsExternalAccessPolicy"); + cmd = new Command("Grant-CsExternalAccessPolicy"); cmd.Parameters.Add("Identity", userUpn); cmd.Parameters.Add("PolicyName", plan.Federation ? organizationId : null); ExecuteShellCommand(runSpace, cmd); @@ -678,6 +700,24 @@ namespace WebsitePanel.Providers.HostedSolution cmd.Parameters.Add("PolicyName", null); ExecuteShellCommand(runSpace, cmd); + // ArchivePolicy + cmd = new Command("Grant-CsArchivingPolicy"); + cmd.Parameters.Add("Identity", userUpn); + cmd.Parameters.Add("PolicyName", string.IsNullOrEmpty(plan.ArchivePolicy) ? null : plan.ArchivePolicy); + ExecuteShellCommand(runSpace, cmd); + + // DialPlan + cmd = new Command("Grant-CsDialPlan"); + cmd.Parameters.Add("Identity", userUpn); + cmd.Parameters.Add("PolicyName", string.IsNullOrEmpty(plan.TelephonyDialPlanPolicy) ? null : plan.TelephonyDialPlanPolicy); + ExecuteShellCommand(runSpace, cmd); + + // VoicePolicy + cmd = new Command("Grant-CsVoicePolicy"); + cmd.Parameters.Add("Identity", userUpn); + cmd.Parameters.Add("PolicyName", string.IsNullOrEmpty(plan.TelephonyVoicePolicy) ? null : plan.TelephonyVoicePolicy); + ExecuteShellCommand(runSpace, cmd); + //initiate user database replication cmd = new Command("Update-CsUserDatabase"); ExecuteShellCommand(runSpace, cmd, false); @@ -887,6 +927,90 @@ namespace WebsitePanel.Providers.HostedSolution HostedSolutionLog.LogEnd("DeleteMobilityPolicy"); } + internal string[] GetPolicyListInternal(LyncPolicyType type, string name) + { + List ret = new List(); + + switch (type) + { + case LyncPolicyType.Archiving: + { + Runspace runSpace = OpenRunspace(); + Command cmd = new Command("Get-CsArchivingPolicy"); + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if ((result != null) && (result.Count > 0)) + { + foreach (PSObject res in result) + { + string Identity = GetPSObjectProperty(res, "Identity").ToString(); + ret.Add(Identity); + } + } + } + break; + case LyncPolicyType.DialPlan: + { + Runspace runSpace = OpenRunspace(); + Command cmd = new Command("Get-CsDialPlan"); + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if ((result != null) && (result.Count > 0)) + { + foreach (PSObject res in result) + { + string Identity = GetPSObjectProperty(res, "Identity").ToString(); + string Description = "" + (string)GetPSObjectProperty(res, "Description"); + if (Description.ToLower().IndexOf(name.ToLower()) == -1) continue; + ret.Add(Identity); + } + + + } + } + break; + case LyncPolicyType.Voice: + { + Runspace runSpace = OpenRunspace(); + Command cmd = new Command("Get-CsVoicePolicy"); + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if ((result != null) && (result.Count > 0)) + { + foreach (PSObject res in result) + { + string Identity = GetPSObjectProperty(res, "Identity").ToString(); + string Description = "" + (string)GetPSObjectProperty(res, "Description"); + if (Description.ToLower().IndexOf(name.ToLower()) == -1) continue; + + ret.Add(Identity); + } + + + } + } + break; + case LyncPolicyType.Pin: + { + Runspace runSpace = OpenRunspace(); + Command cmd = new Command("Get-CsPinPolicy"); + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if ((result != null) && (result.Count > 0)) + { + foreach (PSObject res in result) + { + string Identity = GetPSObjectProperty(res, "Identity").ToString(); + string str = "" + GetPSObjectProperty(res, name); + ret.Add(str); + } + } + } + break; + + } + + + + return ret.ToArray(); + } + #endregion #region Sytsem Related Methods diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/LyncServerProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/LyncServerProxy.cs index 299ccff6..afb3f428 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/LyncServerProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/LyncServerProxy.cs @@ -627,6 +627,16 @@ namespace WebsitePanel.Providers.Lync { this.ReloadConfigurationCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetPolicyList", RequestNamespace = "http://smbsaas/websitepanel/server/", ResponseNamespace = "http://smbsaas/websitepanel/server/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public string[] GetPolicyList(LyncPolicyType type, string name) + { + object[] results = this.Invoke("GetPolicyList", new object[] { + type, name}); + return ((string[])(results[0])); + } /// public new void CancelAsync(object userState) { diff --git a/WebsitePanel/Sources/WebsitePanel.Server/LyncServer.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/LyncServer.asmx.cs index b55428ec..9e0e09e6 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/LyncServer.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/LyncServer.asmx.cs @@ -247,7 +247,25 @@ namespace WebsitePanel.Server } } + [WebMethod, SoapHeader("settings")] + public string[] GetPolicyList(LyncPolicyType type, string name) + { + string[] ret = null; + try + { + Log.WriteStart("{0}.GetPolicyList", ProviderSettings.ProviderName); + ret = Lync.GetPolicyList(type, name); + Log.WriteEnd("{0}.GetPolicyList", ProviderSettings.ProviderName); + } + catch (Exception ex) + { + Log.WriteError(String.Format("Error: {0}.GetPolicyList", ProviderSettings.ProviderName), ex); + throw; + } + + return ret; + } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index ac187873..c51c4818 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5262,6 +5262,12 @@ Mailbox plan updated + + Lync plan update failed + + + Lync plan updated + Failed to apply plans template diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx index e68f1c13..3c9b8873 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx @@ -60,11 +60,6 @@ - - - - - @@ -78,7 +73,136 @@
- + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+
+ + + + + + + + + +
+ + + +
+
+
+ + + + + + + + +
+ +
+
+
+ + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + +
+ + + +
+
+ + + + + + + +
+ + + +
+
+ +
+
+ + + <%-- Disable because not used @@ -115,7 +239,7 @@
- + --%>
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs index 58072ca2..2bc16610 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs @@ -40,9 +40,19 @@ namespace WebsitePanel.Portal.Lync if (!IsPostBack) { - PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId); + 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")); @@ -54,6 +64,8 @@ namespace WebsitePanel.Portal.Lync chkConferencing.Checked = plan.Conferencing; chkMobility.Checked = plan.Mobility; chkEnterpriseVoice.Checked = plan.EnterpriseVoice; + + /* because not used switch (plan.VoicePolicy) { case LyncVoicePolicyType.None: @@ -74,16 +86,40 @@ namespace WebsitePanel.Portal.Lync chkNone.Checked = true; break; } + */ + + chkRemoteUserAccess.Checked = plan.RemoteUserAccess; + chkPublicIMConnectivity.Checked = plan.PublicIMConnectivity; + + chkAllowOrganizeMeetingsWithExternalAnonymous.Checked = plan.AllowOrganizeMeetingsWithExternalAnonymous; + + ddTelephony.SelectedIndex = plan.Telephony; + + tbServerURI.Text = plan.ServerURI; locTitle.Text = plan.LyncUserPlanName; this.DisableControls = true; + 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)); + } else { chkIM.Checked = true; chkIM.Enabled = false; - chkNone.Checked = true; + // chkNone.Checked = true; because not used if (cntx != null) { foreach (QuotaValueInfo quota in cntx.QuotasArray) @@ -110,6 +146,29 @@ namespace WebsitePanel.Portal.Lync } } + chkEnterpriseVoice.Enabled = false; + chkEnterpriseVoice.Checked = false; + + pnEnterpriseVoice.Visible = false; + pnServerURI.Visible = false; + + switch (ddTelephony.SelectedIndex) + { + case 1: + break; + case 2: + pnEnterpriseVoice.Visible = true; + chkEnterpriseVoice.Checked = true; + break; + case 3: + pnServerURI.Visible = true; + break; + case 4: + pnServerURI.Visible = true; + break; + + } + } protected void btnAdd_Click(object sender, EventArgs e) @@ -117,6 +176,37 @@ namespace WebsitePanel.Portal.Lync AddPlan(); } + protected void btnAccept_Click(object sender, EventArgs e) + { + string name = tbTelephoneProvider.Text; + + if (string.IsNullOrEmpty(name)) return; + + ddTelephonyDialPlanPolicy.Items.Clear(); + string[] dialPlan = ES.Services.Lync.GetPolicyList(PanelRequest.ItemID, LyncPolicyType.DialPlan, name); + if (dialPlan != null) + { + foreach (string policy in dialPlan) + { + if (policy.ToLower() == "global") continue; + string txt = policy.Replace("Tag:", ""); + ddTelephonyDialPlanPolicy.Items.Add(new System.Web.UI.WebControls.ListItem(txt, policy)); + } + } + + ddTelephonyVoicePolicy.Items.Clear(); + string[] voicePolicy = ES.Services.Lync.GetPolicyList(PanelRequest.ItemID, LyncPolicyType.Voice, name); + if (voicePolicy != null) + { + foreach (string policy in voicePolicy) + { + if (policy.ToLower() == "global") continue; + string txt = policy.Replace("Tag:", ""); + ddTelephonyVoicePolicy.Items.Add(new System.Web.UI.WebControls.ListItem(txt, policy)); + } + } + } + private void AddPlan() { try @@ -132,6 +222,10 @@ namespace WebsitePanel.Portal.Lync plan.EnterpriseVoice = chkEnterpriseVoice.Checked; + + plan.VoicePolicy = LyncVoicePolicyType.None; + + /* because not used if (!plan.EnterpriseVoice) { plan.VoicePolicy = LyncVoicePolicyType.None; @@ -149,7 +243,21 @@ namespace WebsitePanel.Portal.Lync else plan.VoicePolicy = LyncVoicePolicyType.None; - } + } + */ + + plan.RemoteUserAccess = chkRemoteUserAccess.Checked; + plan.PublicIMConnectivity = chkPublicIMConnectivity.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; int result = ES.Services.Lync.AddLyncUserPlan(PanelRequest.ItemID, plan); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs index d3a71282..2b9ef0b7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs @@ -1,40 +1,11 @@ -// Copyright (c) 2012, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - //------------------------------------------------------------------------------ // // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ - namespace WebsitePanel.Portal.Lync { @@ -166,15 +137,6 @@ namespace WebsitePanel.Portal.Lync { /// protected global::System.Web.UI.WebControls.CheckBox chkMobility; - /// - /// chkFederation control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.CheckBox chkFederation; - /// /// chkConferencing control. /// @@ -194,67 +156,256 @@ namespace WebsitePanel.Portal.Lync { protected global::System.Web.UI.WebControls.CheckBox chkEnterpriseVoice; /// - /// secEnterpriseVoice control. + /// secPlanFeaturesFederation control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.CollapsiblePanel secEnterpriseVoice; + protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesFederation; /// - /// EnterpriseVoice control. + /// PlanFeaturesFederation control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Panel EnterpriseVoice; + protected global::System.Web.UI.WebControls.Panel PlanFeaturesFederation; /// - /// chkNone control. + /// chkFederation control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RadioButton chkNone; + protected global::System.Web.UI.WebControls.CheckBox chkFederation; /// - /// chkEmergency control. + /// chkRemoteUserAccess control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RadioButton chkEmergency; + protected global::System.Web.UI.WebControls.CheckBox chkRemoteUserAccess; /// - /// chkNational control. + /// chkPublicIMConnectivity control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RadioButton chkNational; + protected global::System.Web.UI.WebControls.CheckBox chkPublicIMConnectivity; /// - /// chkMobile control. + /// secPlanFeaturesArchiving control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RadioButton chkMobile; + protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesArchiving; /// - /// chkInternational control. + /// PlanFeaturesArchiving control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RadioButton chkInternational; + protected global::System.Web.UI.WebControls.Panel PlanFeaturesArchiving; + + /// + /// locArchivingPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locArchivingPolicy; + + /// + /// ddArchivingPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddArchivingPolicy; + + /// + /// secPlanFeaturesMeeting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesMeeting; + + /// + /// PlanFeaturesMeeting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel PlanFeaturesMeeting; + + /// + /// chkAllowOrganizeMeetingsWithExternalAnonymous control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkAllowOrganizeMeetingsWithExternalAnonymous; + + /// + /// secPlanFeaturesTelephony control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesTelephony; + + /// + /// PlanFeaturesTelephony control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel PlanFeaturesTelephony; + + /// + /// locTelephony control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTelephony; + + /// + /// ddTelephony control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddTelephony; + + /// + /// pnEnterpriseVoice control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel pnEnterpriseVoice; + + /// + /// locTelephonyProvider control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTelephonyProvider; + + /// + /// tbTelephoneProvider control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tbTelephoneProvider; + + /// + /// btnAccept control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAccept; + + /// + /// AcceptRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator AcceptRequiredValidator; + + /// + /// locDialPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locDialPlan; + + /// + /// ddTelephonyDialPlanPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddTelephonyDialPlanPolicy; + + /// + /// locVoicePolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locVoicePolicy; + + /// + /// ddTelephonyVoicePolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddTelephonyVoicePolicy; + + /// + /// pnServerURI control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel pnServerURI; + + /// + /// locServerURI control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locServerURI; + + /// + /// tbServerURI control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tbServerURI; /// /// btnAdd control. @@ -273,14 +424,5 @@ namespace WebsitePanel.Portal.Lync { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1; - - /// - /// FormComments control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize FormComments; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx index 4d36dcf4..92d9ad13 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx @@ -43,11 +43,41 @@ - + + + + + + + + + + + +
+ + + + + +
+ + + + + +
+
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs index eabe3e15..24e9e225 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs @@ -30,6 +30,9 @@ using WebsitePanel.Providers.ResultObjects; using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.HostedSolution; + + namespace WebsitePanel.Portal.Lync { public partial class CreateLyncUser : WebsitePanelModuleBase @@ -43,8 +46,42 @@ namespace WebsitePanel.Portal.Lync if (plans.Length == 0) btnCreate.Enabled = false; } + } + protected void Page_PreRender(object sender, EventArgs e) + { + bool EnterpriseVoice = false; + + WebsitePanel.Providers.HostedSolution.LyncUserPlan plan = planSelector.plan; + if (plan != null) + EnterpriseVoice = plan.EnterpriseVoice; + + pnEnterpriseVoice.Visible = EnterpriseVoice; + + if (!EnterpriseVoice) + { + tbPhoneNumber.Text = ""; + tbPin.Text = ""; + } + + if (EnterpriseVoice) + { + string[] pinPolicy = ES.Services.Lync.GetPolicyList(PanelRequest.ItemID, LyncPolicyType.Pin, "MinPasswordLength"); + if (pinPolicy != null) + { + if (pinPolicy.Length > 0) + { + int MinPasswordLength = -1; + if (int.TryParse(pinPolicy[0], out MinPasswordLength)) + { + PinRegularExpressionValidator.ValidationExpression = "^([0-9]){" + MinPasswordLength.ToString() + ",}$"; + PinRegularExpressionValidator.ErrorMessage = "Must contain only numbers. Min. length " + MinPasswordLength.ToString(); + } + } + } + } + } protected void btnCreate_Click(object sender, EventArgs e) @@ -53,6 +90,11 @@ namespace WebsitePanel.Portal.Lync LyncUserResult res = ES.Services.Lync.CreateLyncUser(PanelRequest.ItemID, accountId, Convert.ToInt32(planSelector.planId)); if (res.IsSuccess && res.ErrorCodes.Count == 0) { + + //#1 + LyncUser lyncUser = ES.Services.Lync.GetLyncUserGeneralSettings(PanelRequest.ItemID, accountId); + ES.Services.Lync.SetLyncUserGeneralSettings(PanelRequest.ItemID, accountId, lyncUser.SipAddress, tbPhoneNumber.Text + ":" + tbPin.Text); + Response.Redirect(EditUrl("AccountID", accountId.ToString(), "edit_lync_user", "SpaceID=" + PanelSecurity.PackageId, "ItemID=" + PanelRequest.ItemID)); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.designer.cs index af2c5bee..507fa043 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.designer.cs @@ -1,40 +1,11 @@ -// Copyright (c) 2012, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ - namespace WebsitePanel.Portal.Lync { @@ -139,6 +110,69 @@ namespace WebsitePanel.Portal.Lync { /// protected global::WebsitePanel.Portal.Lync.UserControls.LyncUserPlanSelector planSelector; + /// + /// pnEnterpriseVoice control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel pnEnterpriseVoice; + + /// + /// locPhoneNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPhoneNumber; + + /// + /// tbPhoneNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tbPhoneNumber; + + /// + /// PhoneFormatValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RegularExpressionValidator PhoneFormatValidator; + + /// + /// locLyncPin control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locLyncPin; + + /// + /// tbPin control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tbPin; + + /// + /// PinRegularExpressionValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RegularExpressionValidator PinRegularExpressionValidator; + /// /// btnCreate control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx index 64305427..d2866e5e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx @@ -47,11 +47,41 @@ - + + + + + + + + + + + +
+ + + + + +
+ + + + + +
+
-
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs index b3b2782b..820c2c3e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.cs @@ -40,6 +40,40 @@ namespace WebsitePanel.Portal.Lync { if (!IsPostBack) BindItems(); + } + + protected void Page_PreRender(object sender, EventArgs e) + { + bool EnterpriseVoice = false; + + WebsitePanel.Providers.HostedSolution.LyncUserPlan plan = planSelector.plan; + if (plan != null) + EnterpriseVoice = plan.EnterpriseVoice; + + pnEnterpriseVoice.Visible = EnterpriseVoice; + + if (!EnterpriseVoice) + { + tbPhoneNumber.Text = ""; + tbPin.Text = ""; + } + + if (EnterpriseVoice) + { + string[] pinPolicy = ES.Services.Lync.GetPolicyList(PanelRequest.ItemID, LyncPolicyType.Pin, "MinPasswordLength"); + if (pinPolicy != null) + { + if (pinPolicy.Length > 0) + { + int MinPasswordLength = -1; + if (int.TryParse(pinPolicy[0], out MinPasswordLength)) + { + PinRegularExpressionValidator.ValidationExpression = "^([0-9]){" + MinPasswordLength.ToString() + ",}$"; + PinRegularExpressionValidator.ErrorMessage = "Must contain only numbers. Min. length " + MinPasswordLength.ToString(); + } + } + } + } } @@ -54,6 +88,7 @@ namespace WebsitePanel.Portal.Lync planSelector.planId = lyncUser.LyncUserPlanId.ToString(); lyncUserSettings.sipAddress = lyncUser.SipAddress; + tbPhoneNumber.Text = lyncUser.LineUri; } protected void btnSave_Click(object sender, EventArgs e) @@ -65,7 +100,7 @@ namespace WebsitePanel.Portal.Lync LyncUserResult res = ES.Services.Lync.SetUserLyncPlan(PanelRequest.ItemID, PanelRequest.AccountID, Convert.ToInt32(planSelector.planId)); if (res.IsSuccess && res.ErrorCodes.Count == 0) { - res = ES.Services.Lync.SetLyncUserGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID, lyncUserSettings.sipAddress, string.Empty); + res = ES.Services.Lync.SetLyncUserGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID, lyncUserSettings.sipAddress, tbPhoneNumber.Text + ":" + tbPin.Text); } if (res.IsSuccess && res.ErrorCodes.Count == 0) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs index 52aaa081..3598ce62 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs @@ -1,40 +1,11 @@ -// Copyright (c) 2011, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ - namespace WebsitePanel.Portal.Lync { @@ -139,6 +110,69 @@ namespace WebsitePanel.Portal.Lync { ///
protected global::WebsitePanel.Portal.Lync.UserControls.LyncUserSettings lyncUserSettings; + /// + /// pnEnterpriseVoice control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel pnEnterpriseVoice; + + /// + /// locPhoneNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPhoneNumber; + + /// + /// tbPhoneNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tbPhoneNumber; + + /// + /// PhoneFormatValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RegularExpressionValidator PhoneFormatValidator; + + /// + /// locLyncPin control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locLyncPin; + + /// + /// tbPin control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tbPin; + + /// + /// PinRegularExpressionValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RegularExpressionValidator PinRegularExpressionValidator; + /// /// btnSave control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx index c6d336f8..a68ff60a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx @@ -1,2 +1,2 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LyncUserPlanSelector.ascx.cs" Inherits="WebsitePanel.Portal.Lync.UserControls.LyncUserPlanSelector" %> - \ No newline at end of file + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.cs index 31ba7eef..5867d11a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.cs @@ -35,11 +35,14 @@ namespace WebsitePanel.Portal.Lync.UserControls { private string planToSelect; - + public string planId { - get { return ddlPlan.SelectedItem.Value; } + get { + if (ddlPlan.Items.Count == 0) return ""; + return ddlPlan.SelectedItem.Value; + } set { planToSelect = value; @@ -72,6 +75,19 @@ namespace WebsitePanel.Portal.Lync.UserControls } } + public WebsitePanel.Providers.HostedSolution.LyncUserPlan plan + { + get + { + WebsitePanel.Providers.HostedSolution.LyncUserPlan[] plans = ES.Services.Lync.GetLyncUserPlans(PanelRequest.ItemID); + foreach (WebsitePanel.Providers.HostedSolution.LyncUserPlan planitem in plans) + { + if (planitem.LyncUserPlanId.ToString() == planId) return planitem; + } + return null; + } + } + private void BindPlans() { WebsitePanel.Providers.HostedSolution.LyncUserPlan[] plans = ES.Services.Lync.GetLyncUserPlans(PanelRequest.ItemID); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.designer.cs index 5f4303c8..00a2ed12 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.designer.cs @@ -1,41 +1,11 @@ -// Copyright (c) 2012, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - //------------------------------------------------------------------------------ // // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ - namespace WebsitePanel.Portal.Lync.UserControls { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx index 55701dac..10eae934 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx @@ -40,58 +40,185 @@
- - - - - - - - -
- - - - -
-
-
- - - - - - - - - - - - - - - - - - - -
- -
- -
- -
- -
- -
-
-
+ + + + + + + + +
+ + + + +
+
+
+ + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + +
+ +
+ +
+ +
+
+
+ + + + + + + + + +
+ + + +
+
+
+ + + + + + + + +
+ +
+
+
+ + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + +
+ + + +
+
+ + + + + + + +
+ + + +
+
+ +
+
+ + +<%-- Disable because not used @@ -128,6 +255,7 @@
+ --%>
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.cs index 51fbf72a..b33a0ce2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.cs @@ -55,6 +55,52 @@ namespace WebsitePanel.Portal internal static List list; + protected void ddArchivingPolicyUpdate() + { + string[] archivePolicy = ES.Services.Lync.GetPolicyList(-1, LyncPolicyType.Archiving, null); + if (archivePolicy != null) + { + foreach (string policy in archivePolicy) + { + if (policy.ToLower() == "global") continue; + string txt = policy.Replace("Tag:", ""); + if (ddArchivingPolicy.Items.FindByValue(policy)==null) + ddArchivingPolicy.Items.Add(new System.Web.UI.WebControls.ListItem(txt, policy)); + } + } + } + + protected void Page_PreRender(object sender, EventArgs e) + { + + if (ddArchivingPolicy.Items.Count == 0) + ddArchivingPolicyUpdate(); + + chkEnterpriseVoice.Enabled = false; + chkEnterpriseVoice.Checked = false; + + pnEnterpriseVoice.Visible = false; + pnServerURI.Visible = false; + + switch (ddTelephony.SelectedIndex) + { + case 1: + break; + case 2: + pnEnterpriseVoice.Visible = true; + chkEnterpriseVoice.Checked = true; + break; + case 3: + pnServerURI.Visible = true; + break; + case 4: + pnServerURI.Visible = true; + break; + + } + + } + public void BindSettings(UserSettings settings) { @@ -113,8 +159,7 @@ namespace WebsitePanel.Portal } } - - LyncUserPlan plan = new LyncUserPlan(); + Providers.HostedSolution.LyncUserPlan plan = new Providers.HostedSolution.LyncUserPlan(); plan.LyncUserPlanName = txtPlan.Text; plan.IsDefault = false; @@ -124,24 +169,21 @@ namespace WebsitePanel.Portal plan.Conferencing = chkConferencing.Checked; plan.EnterpriseVoice = chkEnterpriseVoice.Checked; - 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.VoicePolicy = LyncVoicePolicyType.None; + + plan.RemoteUserAccess = chkRemoteUserAccess.Checked; + plan.PublicIMConnectivity = chkPublicIMConnectivity.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; @@ -234,7 +276,7 @@ namespace WebsitePanel.Portal } catch (Exception) { - messageBox.ShowErrorMessage("EXCHANGE_DELETE_MAILBOXPLAN"); + messageBox.ShowErrorMessage("LYNC_DELETE_PLAN"); } BindPlans(); @@ -261,7 +303,6 @@ namespace WebsitePanel.Portal orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false); } - plan = ES.Services.Lync.GetLyncUserPlan(orgs[0].Id, planId); txtPlan.Text = plan.LyncUserPlanName; @@ -271,26 +312,35 @@ namespace WebsitePanel.Portal chkConferencing.Checked = plan.Conferencing; chkMobility.Checked = plan.Mobility; chkEnterpriseVoice.Checked = plan.EnterpriseVoice; - switch (plan.VoicePolicy) + + chkRemoteUserAccess.Checked = plan.RemoteUserAccess; + chkPublicIMConnectivity.Checked = plan.PublicIMConnectivity; + + chkAllowOrganizeMeetingsWithExternalAnonymous.Checked = plan.AllowOrganizeMeetingsWithExternalAnonymous; + ddTelephony.SelectedIndex = 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; + + ddArchivingPolicyUpdate(); + ListItem li = ddArchivingPolicy.Items.FindByValue(planArchivePolicy); + if (li == null) { - 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; + li = new System.Web.UI.WebControls.ListItem(planArchivePolicy.Replace("Tag:", ""), planArchivePolicy); + ddArchivingPolicy.Items.Add(li); } + ddArchivingPolicy.SelectedIndex = ddArchivingPolicy.Items.IndexOf(li); + + 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)); btnUpdatePlan.Enabled = (string.IsNullOrEmpty(txtPlan.Text)) ? false : true; @@ -298,7 +348,6 @@ namespace WebsitePanel.Portal } catch (Exception) { - messageBox.ShowErrorMessage("EXCHANGE_DELETE_MAILBOXPLAN"); } BindPlans(); @@ -375,7 +424,6 @@ namespace WebsitePanel.Portal plan = new Providers.HostedSolution.LyncUserPlan(); plan.LyncUserPlanId = (int)ViewState["LyncUserPlanID"]; - plan.LyncUserPlanName = txtPlan.Text; plan.IsDefault = false; @@ -385,24 +433,22 @@ namespace WebsitePanel.Portal plan.Conferencing = chkConferencing.Checked; plan.EnterpriseVoice = chkEnterpriseVoice.Checked; - 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.VoicePolicy = LyncVoicePolicyType.None; + + plan.RemoteUserAccess = chkRemoteUserAccess.Checked; + plan.PublicIMConnectivity = chkPublicIMConnectivity.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; @@ -417,11 +463,11 @@ namespace WebsitePanel.Portal if (result < 0) { - messageBox.ShowErrorMessage("EXCHANGE_UPDATEPLANS"); + messageBox.ShowErrorMessage("LYNC_UPDATEPLANS"); } else { - messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS"); + messageBox.ShowSuccessMessage("LYNC_UPDATEPLANS"); } } @@ -503,6 +549,39 @@ namespace WebsitePanel.Portal BindPlans(); } + protected void btnAccept_Click(object sender, EventArgs e) + { + + string name = tbTelephoneProvider.Text; + + if (string.IsNullOrEmpty(name)) return; + + ddTelephonyDialPlanPolicy.Items.Clear(); + string[] dialPlan = ES.Services.Lync.GetPolicyList(-1, LyncPolicyType.DialPlan, name); + if (dialPlan != null) + { + foreach (string policy in dialPlan) + { + if (policy.ToLower() == "global") continue; + string txt = policy.Replace("Tag:", ""); + ddTelephonyDialPlanPolicy.Items.Add(new System.Web.UI.WebControls.ListItem(txt, policy)); + } + } + + ddTelephonyVoicePolicy.Items.Clear(); + string[] voicePolicy = ES.Services.Lync.GetPolicyList(-1, LyncPolicyType.Voice, name); + if (voicePolicy != null) + { + foreach (string policy in voicePolicy) + { + if (policy.ToLower() == "global") continue; + string txt = policy.Replace("Tag:", ""); + ddTelephonyVoicePolicy.Items.Add(new System.Web.UI.WebControls.ListItem(txt, policy)); + } + } + + } + } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs index 71f46a10..d036ed13 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs @@ -1,40 +1,11 @@ -// Copyright (c) 2012, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ - namespace WebsitePanel.Portal { @@ -139,15 +110,6 @@ namespace WebsitePanel.Portal { ///
protected global::System.Web.UI.WebControls.CheckBox chkMobility; - /// - /// chkFederation control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.CheckBox chkFederation; - /// /// chkConferencing control. /// @@ -167,67 +129,256 @@ namespace WebsitePanel.Portal { protected global::System.Web.UI.WebControls.CheckBox chkEnterpriseVoice; /// - /// secEnterpriseVoice control. + /// secPlanFeaturesFederation control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.CollapsiblePanel secEnterpriseVoice; + protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesFederation; /// - /// EnterpriseVoice control. + /// PlanFeaturesFederation control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Panel EnterpriseVoice; + protected global::System.Web.UI.WebControls.Panel PlanFeaturesFederation; /// - /// chkNone control. + /// chkFederation control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RadioButton chkNone; + protected global::System.Web.UI.WebControls.CheckBox chkFederation; /// - /// chkEmergency control. + /// chkRemoteUserAccess control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RadioButton chkEmergency; + protected global::System.Web.UI.WebControls.CheckBox chkRemoteUserAccess; /// - /// chkNational control. + /// chkPublicIMConnectivity control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RadioButton chkNational; + protected global::System.Web.UI.WebControls.CheckBox chkPublicIMConnectivity; /// - /// chkMobile control. + /// secPlanFeaturesArchiving control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RadioButton chkMobile; + protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesArchiving; /// - /// chkInternational control. + /// PlanFeaturesArchiving control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.RadioButton chkInternational; + protected global::System.Web.UI.WebControls.Panel PlanFeaturesArchiving; + + /// + /// locArchivingPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locArchivingPolicy; + + /// + /// ddArchivingPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddArchivingPolicy; + + /// + /// secPlanFeaturesMeeting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesMeeting; + + /// + /// PlanFeaturesMeeting control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel PlanFeaturesMeeting; + + /// + /// chkAllowOrganizeMeetingsWithExternalAnonymous control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkAllowOrganizeMeetingsWithExternalAnonymous; + + /// + /// secPlanFeaturesTelephony control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPlanFeaturesTelephony; + + /// + /// PlanFeaturesTelephony control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel PlanFeaturesTelephony; + + /// + /// locTelephony control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTelephony; + + /// + /// ddTelephony control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddTelephony; + + /// + /// pnEnterpriseVoice control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel pnEnterpriseVoice; + + /// + /// locTelephonyProvider control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTelephonyProvider; + + /// + /// tbTelephoneProvider control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tbTelephoneProvider; + + /// + /// btnAccept control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnAccept; + + /// + /// AcceptRequiredValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator AcceptRequiredValidator; + + /// + /// locDialPlan control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locDialPlan; + + /// + /// ddTelephonyDialPlanPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddTelephonyDialPlanPolicy; + + /// + /// locVoicePolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locVoicePolicy; + + /// + /// ddTelephonyVoicePolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddTelephonyVoicePolicy; + + /// + /// pnServerURI control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel pnServerURI; + + /// + /// locServerURI control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locServerURI; + + /// + /// tbServerURI control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox tbServerURI; /// /// btnAddPlan control. From 0bc9187cf4afa0c2a589b5f7c968d5623303528f Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Thu, 13 Jun 2013 19:26:40 +0400 Subject: [PATCH 2/8] added check "Lync Enterprise Voice" Quotas in dialog "Lync User Plan" --- .../WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs index 2bc16610..684a2e06 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.cs @@ -30,6 +30,11 @@ using System; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.ResultObjects; +using WebsitePanel.Providers; +using WebsitePanel.Providers.Web; +using WebsitePanel.Providers.Common; +using WebsitePanel.Portal.Code.Helpers; + namespace WebsitePanel.Portal.Lync { @@ -37,10 +42,11 @@ namespace WebsitePanel.Portal.Lync { protected void Page_Load(object sender, EventArgs e) { + PackageContext cntx = null; if (!IsPostBack) { - PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId); + cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId); string[] archivePolicy = ES.Services.Lync.GetPolicyList(PanelRequest.ItemID, LyncPolicyType.Archiving, null); if (archivePolicy != null) @@ -169,6 +175,10 @@ namespace WebsitePanel.Portal.Lync } + cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + PlanFeaturesTelephony.Visible = Utils.CheckQouta(Quotas.LYNC_ENTERPRISEVOICE, cntx); + secPlanFeaturesTelephony.Visible = PlanFeaturesTelephony.Visible; + } protected void btnAdd_Click(object sender, EventArgs e) From 3a538e5f1625c37ce36e556f4336c676b4e77245 Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Fri, 9 Aug 2013 17:42:25 +0400 Subject: [PATCH 3/8] adding Enterprise Voice for Lync2013 --- .../Lync2013.cs | 150 +++++++++++++++++- .../LyncBase.cs | 10 ++ ...l.Providers.HostedSolution.Lync2013.csproj | 2 +- 3 files changed, 155 insertions(+), 7 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/Lync2013.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/Lync2013.cs index 97da4d68..68413a3d 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/Lync2013.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/Lync2013.cs @@ -269,7 +269,22 @@ namespace WebsitePanel.Providers.HostedSolution command.Parameters.Add("Identity", userUpn); ExecuteShellCommand(runspace, command, false); - SetLyncUserPlanInternal(organizationId, userUpn, plan, runspace); + command = new Command("Update-CsAddressBook"); + ExecuteShellCommand(runspace, command, false); + command = new Command("Update-CsUserDatabase"); + ExecuteShellCommand(runspace, command, false); + + int trySleep = 5000; int tryMaxCount = 10; bool PlanSet = false; + for (int tryCount = 0; (tryCount < tryMaxCount) && (!PlanSet); tryCount++ ) + { + try + { + PlanSet = SetLyncUserPlanInternal(organizationId, userUpn, plan, runspace); + } + catch { } + if (!PlanSet) System.Threading.Thread.Sleep(trySleep); + } + command = new Command("Update-CsAddressBook"); ExecuteShellCommand(runspace, command, false); command = new Command("Update-CsUserDatabase"); @@ -317,6 +332,8 @@ namespace WebsitePanel.Providers.HostedSolution lyncUser.LineUri = (string) GetPSObjectProperty(user, "LineURI"); lyncUser.SipAddress = lyncUser.SipAddress.ToLower().Replace("sip:", ""); + lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:+", ""); + lyncUser.LineUri = lyncUser.LineUri.ToLower().Replace("tel:", ""); } catch (Exception ex) { @@ -404,13 +421,25 @@ namespace WebsitePanel.Providers.HostedSolution command.Parameters.Add("SipAddress", "SIP:" + lyncUser.SipAddress); } - if (!string.IsNullOrEmpty(lyncUser.SipAddress)) + if (!string.IsNullOrEmpty(lyncUser.LineUri)) { - command.Parameters.Add("LineUri", lyncUser.LineUri); + command.Parameters.Add("LineUri", "TEL:+" + lyncUser.LineUri); + } + else + { + command.Parameters.Add("LineUri", null); } ExecuteShellCommand(runspace, command, false); + if (!String.IsNullOrEmpty(lyncUser.PIN)) + { + command = new Command("Set-CsClientPin"); + command.Parameters.Add("Identity", userUpn); + command.Parameters.Add("Pin", lyncUser.PIN); + ExecuteShellCommand(runspace, command, false); + } + command = new Command("Update-CsAddressBook"); ExecuteShellCommand(runspace, command, false); @@ -454,7 +483,13 @@ namespace WebsitePanel.Providers.HostedSolution bCloseRunSpace = true; } - var command = new Command("Grant-CsExternalAccessPolicy"); + // EnterpriseVoice + var command = new Command("Set-CsUser"); + command.Parameters.Add("Identity", userUpn); + command.Parameters.Add("EnterpriseVoiceEnabled", plan.EnterpriseVoice); + ExecuteShellCommand(runspace, command, false); + + command = new Command("Grant-CsExternalAccessPolicy"); command.Parameters.Add("Identity", userUpn); command.Parameters.Add("PolicyName", plan.Federation ? organizationId : null); ExecuteShellCommand(runspace, command, false); @@ -466,7 +501,6 @@ namespace WebsitePanel.Providers.HostedSolution command = new Command("Grant-CsMobilityPolicy"); command.Parameters.Add("Identity", userUpn); - if (plan.Mobility) { command.Parameters.Add("PolicyName", plan.MobilityEnableOutsideVoice ? organizationId + " EnableOutSideVoice" : organizationId + " DisableOutSideVoice"); @@ -475,8 +509,26 @@ namespace WebsitePanel.Providers.HostedSolution { command.Parameters.Add("PolicyName", null); } - ExecuteShellCommand(runspace, command, false); + + // ArchivePolicy + command = new Command("Grant-CsArchivingPolicy"); + command.Parameters.Add("Identity", userUpn); + command.Parameters.Add("PolicyName", string.IsNullOrEmpty(plan.ArchivePolicy) ? null : plan.ArchivePolicy); + ExecuteShellCommand(runspace, command, false); + + // DialPlan + command = new Command("Grant-CsDialPlan"); + command.Parameters.Add("Identity", userUpn); + command.Parameters.Add("PolicyName", string.IsNullOrEmpty(plan.TelephonyDialPlanPolicy) ? null : plan.TelephonyDialPlanPolicy); + ExecuteShellCommand(runspace, command, false); + + // VoicePolicy + command = new Command("Grant-CsVoicePolicy"); + command.Parameters.Add("Identity", userUpn); + command.Parameters.Add("PolicyName", string.IsNullOrEmpty(plan.TelephonyVoicePolicy) ? null : plan.TelephonyVoicePolicy); + ExecuteShellCommand(runspace, command, false); + command = new Command("Update-CsUserDatabase"); ExecuteShellCommand(runspace, command, false); } @@ -744,6 +796,92 @@ namespace WebsitePanel.Providers.HostedSolution #endregion + #region Policy + + internal override string[] GetPolicyListInternal(LyncPolicyType type, string name) + { + List ret = new List(); + + switch (type) + { + case LyncPolicyType.Archiving: + { + Runspace runSpace = OpenRunspace(); + Command cmd = new Command("Get-CsArchivingPolicy"); + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if ((result != null) && (result.Count > 0)) + { + foreach (PSObject res in result) + { + string Identity = GetPSObjectProperty(res, "Identity").ToString(); + ret.Add(Identity); + } + } + } + break; + case LyncPolicyType.DialPlan: + { + Runspace runSpace = OpenRunspace(); + Command cmd = new Command("Get-CsDialPlan"); + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if ((result != null) && (result.Count > 0)) + { + foreach (PSObject res in result) + { + string Identity = GetPSObjectProperty(res, "Identity").ToString(); + string Description = "" + (string)GetPSObjectProperty(res, "Description"); + if (Description.ToLower().IndexOf(name.ToLower()) == -1) continue; + ret.Add(Identity); + } + + + } + } + break; + case LyncPolicyType.Voice: + { + Runspace runSpace = OpenRunspace(); + Command cmd = new Command("Get-CsVoicePolicy"); + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if ((result != null) && (result.Count > 0)) + { + foreach (PSObject res in result) + { + string Identity = GetPSObjectProperty(res, "Identity").ToString(); + string Description = "" + (string)GetPSObjectProperty(res, "Description"); + if (Description.ToLower().IndexOf(name.ToLower()) == -1) continue; + + ret.Add(Identity); + } + + + } + } + break; + case LyncPolicyType.Pin: + { + Runspace runSpace = OpenRunspace(); + Command cmd = new Command("Get-CsPinPolicy"); + Collection result = ExecuteShellCommand(runSpace, cmd, false); + if ((result != null) && (result.Count > 0)) + { + foreach (PSObject res in result) + { + string Identity = GetPSObjectProperty(res, "Identity").ToString(); + string str = "" + GetPSObjectProperty(res, name); + ret.Add(str); + } + } + } + break; + + } + + return ret.ToArray(); + } + + #endregion + #endregion } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/LyncBase.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/LyncBase.cs index 9a4924f5..b8cd6a62 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/LyncBase.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/LyncBase.cs @@ -134,6 +134,11 @@ namespace WebsitePanel.Providers.HostedSolution ReloadConfigurationInternal(); } + public virtual string[] GetPolicyList(LyncPolicyType type, string name) + { + return GetPolicyListInternal(type, name); + } + public override bool IsInstalled() { bool bResult = false; @@ -209,6 +214,11 @@ namespace WebsitePanel.Providers.HostedSolution throw new NotImplementedException(); } + internal virtual string[] GetPolicyListInternal(LyncPolicyType type, string name) + { + throw new NotImplementedException(); + } + #region PowerShell integration /// Opens runspace. diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/WebsitePanel.Providers.HostedSolution.Lync2013.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/WebsitePanel.Providers.HostedSolution.Lync2013.csproj index 5efb9ece..0d14af54 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/WebsitePanel.Providers.HostedSolution.Lync2013.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Lync2013/WebsitePanel.Providers.HostedSolution.Lync2013.csproj @@ -9,7 +9,7 @@ Properties WebsitePanel.Providers.HostedSolution.Lync2013 WebsitePanel.Providers.HostedSolution.Lync2013 - v4.5 + v4.0 512 From 3a4ef2dffc1edbbc2f1b3e2367eb91dac53e2ddc Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Sat, 10 Aug 2013 00:57:21 +0400 Subject: [PATCH 4/8] Delete Files --- .../Code/Data/DataProvider.cs | 3726 ----------------- .../Code/HostedSolution/LyncController.cs | 1088 ----- 2 files changed, 4814 deletions(-) delete mode 100644 WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs delete mode 100644 WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs deleted file mode 100644 index ae5d603b..00000000 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Data/DataProvider.cs +++ /dev/null @@ -1,3726 +0,0 @@ -// Copyright (c) 2012, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -using System; -using System.Configuration; -using System.Data; -using System.Data.SqlClient; -using System.Text.RegularExpressions; -using WebsitePanel.Providers.HostedSolution; -using Microsoft.ApplicationBlocks.Data; -using System.Collections.Generic; -using Microsoft.Win32; - -namespace WebsitePanel.EnterpriseServer -{ - /// - /// Summary description for DataProvider. - /// - public static class DataProvider - { - - static string EnterpriseServerRegistryPath = "SOFTWARE\\WebsitePanel\\EnterpriseServer"; - - private static string ConnectionString - { - get - { - string ConnectionKey = ConfigurationManager.AppSettings["WebsitePanel.AltConnectionString"]; - string value = string.Empty; - - if (!string.IsNullOrEmpty(ConnectionKey)) - { - RegistryKey root = Registry.LocalMachine; - RegistryKey rk = root.OpenSubKey(EnterpriseServerRegistryPath); - if (rk != null) - { - value = (string)rk.GetValue(ConnectionKey, null); - rk.Close(); - } - } - - if (!string.IsNullOrEmpty(value)) - return value; - else - return ConfigurationManager.ConnectionStrings["EnterpriseServer"].ConnectionString; - } - } - - private static string ObjectQualifier - { - get - { - return ""; - } - } - - #region System Settings - - public static IDataReader GetSystemSettings(string settingsName) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetSystemSettings", - new SqlParameter("@SettingsName", settingsName) - ); - } - - public static void SetSystemSettings(string settingsName, string xml) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "SetSystemSettings", - new SqlParameter("@SettingsName", settingsName), - new SqlParameter("@Xml", xml) - ); - } - - #endregion - - #region Users - public static bool CheckUserExists(string username) - { - SqlParameter prmExists = new SqlParameter("@Exists", SqlDbType.Bit); - prmExists.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "CheckUserExists", - prmExists, - new SqlParameter("@username", username)); - - return Convert.ToBoolean(prmExists.Value); - } - - public static DataSet GetUsersPaged(int actorId, int userId, string filterColumn, string filterValue, - int statusId, int roleId, string sortColumn, int startRow, int maximumRows, bool recursive) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUsersPaged", - new SqlParameter("@actorId", actorId), - new SqlParameter("@UserID", userId), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@statusId", statusId), - new SqlParameter("@roleId", roleId), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows), - new SqlParameter("@recursive", recursive)); - } - - public static DataSet GetUsersSummary(int actorId, int userId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUsersSummary", - new SqlParameter("@actorId", actorId), - new SqlParameter("@UserID", userId)); - } - - public static DataSet GetUserDomainsPaged(int actorId, int userId, string filterColumn, string filterValue, - string sortColumn, int startRow, int maximumRows) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUserDomainsPaged", - new SqlParameter("@actorId", actorId), - new SqlParameter("@UserID", userId), - new SqlParameter("@filterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@filterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@sortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows)); - } - - public static DataSet GetUsers(int actorId, int ownerId, bool recursive) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUsers", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@OwnerID", ownerId), - new SqlParameter("@Recursive", recursive)); - } - - public static DataSet GetUserParents(int actorId, int userId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUserParents", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@UserID", userId)); - } - - public static DataSet GetUserPeers(int actorId, int userId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUserPeers", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@userId", userId)); - } - - public static IDataReader GetUserByExchangeOrganizationIdInternally(int itemId) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUserByExchangeOrganizationIdInternally", - new SqlParameter("@ItemID", itemId)); - } - - - - public static IDataReader GetUserByIdInternally(int userId) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUserByIdInternally", - new SqlParameter("@UserID", userId)); - } - - public static IDataReader GetUserByUsernameInternally(string username) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUserByUsernameInternally", - new SqlParameter("@Username", username)); - } - - public static IDataReader GetUserById(int actorId, int userId) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUserById", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@UserID", userId)); - } - - public static IDataReader GetUserByUsername(int actorId, string username) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUserByUsername", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@Username", username)); - } - - public static int AddUser(int actorId, int ownerId, int roleId, int statusId, string subscriberNumber, int loginStatusId, bool isDemo, - bool isPeer, string comments, string username, string password, - string firstName, string lastName, string email, string secondaryEmail, - string address, string city, string country, string state, string zip, - string primaryPhone, string secondaryPhone, string fax, string instantMessenger, bool htmlMail, - string companyName, bool ecommerceEnabled) - { - SqlParameter prmUserId = new SqlParameter("@UserID", SqlDbType.Int); - prmUserId.Direction = ParameterDirection.Output; - - // add user to WebsitePanel Users table - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddUser", - prmUserId, - new SqlParameter("@ActorId", actorId), - new SqlParameter("@OwnerID", ownerId), - new SqlParameter("@RoleID", roleId), - new SqlParameter("@StatusId", statusId), - new SqlParameter("@SubscriberNumber", subscriberNumber), - new SqlParameter("@LoginStatusId", loginStatusId), - new SqlParameter("@IsDemo", isDemo), - new SqlParameter("@IsPeer", isPeer), - new SqlParameter("@Comments", comments), - new SqlParameter("@username", username), - new SqlParameter("@password", password), - new SqlParameter("@firstName", firstName), - new SqlParameter("@lastName", lastName), - new SqlParameter("@email", email), - new SqlParameter("@secondaryEmail", secondaryEmail), - new SqlParameter("@address", address), - new SqlParameter("@city", city), - new SqlParameter("@country", country), - new SqlParameter("@state", state), - new SqlParameter("@zip", zip), - new SqlParameter("@primaryPhone", primaryPhone), - new SqlParameter("@secondaryPhone", secondaryPhone), - new SqlParameter("@fax", fax), - new SqlParameter("@instantMessenger", instantMessenger), - new SqlParameter("@htmlMail", htmlMail), - new SqlParameter("@CompanyName", companyName), - new SqlParameter("@EcommerceEnabled", ecommerceEnabled)); - - return Convert.ToInt32(prmUserId.Value); - } - - public static void UpdateUser(int actorId, int userId, int roleId, int statusId, string subscriberNumber, int loginStatusId, bool isDemo, - bool isPeer, string comments, string firstName, string lastName, string email, string secondaryEmail, - string address, string city, string country, string state, string zip, - string primaryPhone, string secondaryPhone, string fax, string instantMessenger, bool htmlMail, - string companyName, bool ecommerceEnabled, string additionalParams) - { - // update user - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateUser", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@RoleID", roleId), - new SqlParameter("@StatusId", statusId), - new SqlParameter("@SubscriberNumber", subscriberNumber), - new SqlParameter("@LoginStatusId", loginStatusId), - new SqlParameter("@UserID", userId), - new SqlParameter("@IsDemo", isDemo), - new SqlParameter("@IsPeer", isPeer), - new SqlParameter("@Comments", comments), - new SqlParameter("@firstName", firstName), - new SqlParameter("@lastName", lastName), - new SqlParameter("@email", email), - new SqlParameter("@secondaryEmail", secondaryEmail), - new SqlParameter("@address", address), - new SqlParameter("@city", city), - new SqlParameter("@country", country), - new SqlParameter("@state", state), - new SqlParameter("@zip", zip), - new SqlParameter("@primaryPhone", primaryPhone), - new SqlParameter("@secondaryPhone", secondaryPhone), - new SqlParameter("@fax", fax), - new SqlParameter("@instantMessenger", instantMessenger), - new SqlParameter("@htmlMail", htmlMail), - new SqlParameter("@CompanyName", companyName), - new SqlParameter("@EcommerceEnabled", ecommerceEnabled), - new SqlParameter("@AdditionalParams", additionalParams)); - } - - public static void UpdateUserFailedLoginAttempt(int userId, int lockOut, bool reset) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateUserFailedLoginAttempt", - new SqlParameter("@UserID", userId), - new SqlParameter("@LockOut", lockOut), - new SqlParameter("@Reset", reset)); - } - - public static void DeleteUser(int actorId, int userId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteUser", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@UserID", userId)); - } - - public static void ChangeUserPassword(int actorId, int userId, string password) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "ChangeUserPassword", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@UserID", userId), - new SqlParameter("@password", password)); - } - - #endregion - - #region User Settings - public static IDataReader GetUserSettings(int actorId, int userId, string settingsName) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUserSettings", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@UserID", userId), - new SqlParameter("@SettingsName", settingsName)); - } - public static void UpdateUserSettings(int actorId, int userId, string settingsName, string xml) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateUserSettings", - new SqlParameter("@UserID", userId), - new SqlParameter("@ActorId", actorId), - new SqlParameter("@SettingsName", settingsName), - new SqlParameter("@Xml", xml)); - } - #endregion - - #region Servers - public static DataSet GetAllServers(int actorId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetAllServers", - new SqlParameter("@actorId", actorId)); - } - public static DataSet GetServers(int actorId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServers", - new SqlParameter("@actorId", actorId)); - } - - public static IDataReader GetServer(int actorId, int serverId) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServer", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServerID", serverId)); - } - - public static IDataReader GetServerShortDetails(int serverId) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServerShortDetails", - new SqlParameter("@ServerID", serverId)); - } - - public static IDataReader GetServerByName(int actorId, string serverName) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServerByName", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServerName", serverName)); - } - - public static IDataReader GetServerInternal(int serverId) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServerInternal", - new SqlParameter("@ServerID", serverId)); - } - - public static int AddServer(string serverName, string serverUrl, - string password, string comments, bool virtualServer, string instantDomainAlias, - int primaryGroupId, bool adEnabled, string adRootDomain, string adUsername, string adPassword, - string adAuthenticationType) - { - SqlParameter prmServerId = new SqlParameter("@ServerID", SqlDbType.Int); - prmServerId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddServer", - prmServerId, - new SqlParameter("@ServerName", serverName), - new SqlParameter("@ServerUrl", serverUrl), - new SqlParameter("@Password", password), - new SqlParameter("@Comments", comments), - new SqlParameter("@VirtualServer", virtualServer), - new SqlParameter("@InstantDomainAlias", instantDomainAlias), - new SqlParameter("@PrimaryGroupId", primaryGroupId), - new SqlParameter("@AdEnabled", adEnabled), - new SqlParameter("@AdRootDomain", adRootDomain), - new SqlParameter("@AdUsername", adUsername), - new SqlParameter("@AdPassword", adPassword), - new SqlParameter("@AdAuthenticationType", adAuthenticationType)); - - return Convert.ToInt32(prmServerId.Value); - } - - public static void UpdateServer(int serverId, string serverName, string serverUrl, - string password, string comments, string instantDomainAlias, - int primaryGroupId, bool adEnabled, string adRootDomain, string adUsername, string adPassword, - string adAuthenticationType) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateServer", - new SqlParameter("@ServerID", serverId), - new SqlParameter("@ServerName", serverName), - new SqlParameter("@ServerUrl", serverUrl), - new SqlParameter("@Password", password), - new SqlParameter("@Comments", comments), - new SqlParameter("@InstantDomainAlias", instantDomainAlias), - new SqlParameter("@PrimaryGroupId", primaryGroupId), - new SqlParameter("@AdEnabled", adEnabled), - new SqlParameter("@AdRootDomain", adRootDomain), - new SqlParameter("@AdUsername", adUsername), - new SqlParameter("@AdPassword", adPassword), - new SqlParameter("@AdAuthenticationType", adAuthenticationType)); - - } - - public static int DeleteServer(int serverId) - { - SqlParameter prmResult = new SqlParameter("@Result", SqlDbType.Int); - prmResult.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteServer", - prmResult, - new SqlParameter("@ServerID", serverId)); - - return Convert.ToInt32(prmResult.Value); - } - #endregion - - #region Virtual Servers - public static DataSet GetVirtualServers(int actorId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetVirtualServers", - new SqlParameter("@actorId", actorId)); - } - - public static DataSet GetAvailableVirtualServices(int actorId, int serverId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetAvailableVirtualServices", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServerID", serverId)); - } - - public static DataSet GetVirtualServices(int actorId, int serverId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetVirtualServices", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServerID", serverId)); - } - - public static void AddVirtualServices(int serverId, string xml) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddVirtualServices", - new SqlParameter("@ServerID", serverId), - new SqlParameter("@xml", xml)); - } - - public static void DeleteVirtualServices(int serverId, string xml) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteVirtualServices", - new SqlParameter("@ServerID", serverId), - new SqlParameter("@xml", xml)); - } - - public static void UpdateVirtualGroups(int serverId, string xml) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateVirtualGroups", - new SqlParameter("@ServerID", serverId), - new SqlParameter("@xml", xml)); - } - #endregion - - #region Providers - - // Providers methods - - public static DataSet GetProviders() - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetProviders"); - } - - public static DataSet GetGroupProviders(int groupId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetGroupProviders", - new SqlParameter("@groupId", groupId)); - } - - public static IDataReader GetProvider(int providerId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetProvider", - new SqlParameter("@ProviderID", providerId)); - } - - public static IDataReader GetProviderByServiceID(int serviceId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetProviderByServiceID", - new SqlParameter("@ServiceID", serviceId)); - } - - #endregion - - #region IPAddresses - public static IDataReader GetIPAddress(int ipAddressId) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetIPAddress", - new SqlParameter("@AddressID", ipAddressId)); - } - - public static IDataReader GetIPAddresses(int actorId, int poolId, int serverId) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetIPAddresses", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PoolId", poolId), - new SqlParameter("@ServerId", serverId)); - return reader; - } - - public static IDataReader GetIPAddressesPaged(int actorId, int poolId, int serverId, - string filterColumn, string filterValue, - string sortColumn, int startRow, int maximumRows) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetIPAddressesPaged", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PoolId", poolId), - new SqlParameter("@ServerId", serverId), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows)); - return reader; - } - - public static int AddIPAddress(int poolId, int serverId, string externalIP, string internalIP, - string subnetMask, string defaultGateway, string comments) - { - SqlParameter prmAddresId = new SqlParameter("@AddressID", SqlDbType.Int); - prmAddresId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddIPAddress", - prmAddresId, - new SqlParameter("@ServerID", serverId), - new SqlParameter("@externalIP", externalIP), - new SqlParameter("@internalIP", internalIP), - new SqlParameter("@PoolId", poolId), - new SqlParameter("@SubnetMask", subnetMask), - new SqlParameter("@DefaultGateway", defaultGateway), - new SqlParameter("@Comments", comments)); - - return Convert.ToInt32(prmAddresId.Value); - } - - public static void UpdateIPAddress(int addressId, int poolId, int serverId, - string externalIP, string internalIP, string subnetMask, string defaultGateway, string comments) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateIPAddress", - new SqlParameter("@AddressID", addressId), - new SqlParameter("@externalIP", externalIP), - new SqlParameter("@internalIP", internalIP), - new SqlParameter("@ServerID", serverId), - new SqlParameter("@PoolId", poolId), - new SqlParameter("@SubnetMask", subnetMask), - new SqlParameter("@DefaultGateway", defaultGateway), - new SqlParameter("@Comments", comments)); - } - - public static void UpdateIPAddresses(string xmlIds, int poolId, int serverId, - string subnetMask, string defaultGateway, string comments) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateIPAddresses", - new SqlParameter("@Xml", xmlIds), - new SqlParameter("@ServerID", serverId), - new SqlParameter("@PoolId", poolId), - new SqlParameter("@SubnetMask", subnetMask), - new SqlParameter("@DefaultGateway", defaultGateway), - new SqlParameter("@Comments", comments)); - } - - public static int DeleteIPAddress(int ipAddressId) - { - SqlParameter prmResult = new SqlParameter("@Result", SqlDbType.Int); - prmResult.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteIPAddress", - prmResult, - new SqlParameter("@AddressID", ipAddressId)); - - return Convert.ToInt32(prmResult.Value); - } - - - - #endregion - - #region Clusters - public static IDataReader GetClusters(int actorId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetClusters", - new SqlParameter("@actorId", actorId)); - } - - public static int AddCluster(string clusterName) - { - SqlParameter prmId = new SqlParameter("@ClusterID", SqlDbType.Int); - prmId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddCluster", - prmId, - new SqlParameter("@ClusterName", clusterName)); - - return Convert.ToInt32(prmId.Value); - } - - public static void DeleteCluster(int clusterId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteCluster", - new SqlParameter("@ClusterId", clusterId)); - } - - #endregion - - #region Global DNS records - public static DataSet GetDnsRecordsByService(int actorId, int serviceId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDnsRecordsByService", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServiceId", serviceId)); - } - - public static DataSet GetDnsRecordsByServer(int actorId, int serverId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDnsRecordsByServer", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServerId", serverId)); - } - - public static DataSet GetDnsRecordsByPackage(int actorId, int packageId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDnsRecordsByPackage", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageId", packageId)); - } - - public static DataSet GetDnsRecordsByGroup(int groupId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDnsRecordsByGroup", - new SqlParameter("@GroupId", groupId)); - } - - public static DataSet GetDnsRecordsTotal(int actorId, int packageId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDnsRecordsTotal", - new SqlParameter("@actorId", actorId), - new SqlParameter("@packageId", packageId)); - } - - public static IDataReader GetDnsRecord(int actorId, int recordId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDnsRecord", - new SqlParameter("@actorId", actorId), - new SqlParameter("@RecordId", recordId)); - } - - public static void AddDnsRecord(int actorId, int serviceId, int serverId, int packageId, string recordType, - string recordName, string recordData, int mxPriority, int SrvPriority, int SrvWeight, int SrvPort, int ipAddressId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddDnsRecord", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServiceId", serviceId), - new SqlParameter("@ServerId", serverId), - new SqlParameter("@PackageId", packageId), - new SqlParameter("@RecordType", recordType), - new SqlParameter("@RecordName", recordName), - new SqlParameter("@RecordData", recordData), - new SqlParameter("@MXPriority", mxPriority), - new SqlParameter("@SrvPriority", SrvPriority), - new SqlParameter("@SrvWeight", SrvWeight), - new SqlParameter("@SrvPort", SrvPort), - new SqlParameter("@IpAddressId", ipAddressId)); - } - - public static void UpdateDnsRecord(int actorId, int recordId, string recordType, - string recordName, string recordData, int mxPriority, int SrvPriority, int SrvWeight, int SrvPort, int ipAddressId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateDnsRecord", - new SqlParameter("@actorId", actorId), - new SqlParameter("@RecordId", recordId), - new SqlParameter("@RecordType", recordType), - new SqlParameter("@RecordName", recordName), - new SqlParameter("@RecordData", recordData), - new SqlParameter("@MXPriority", mxPriority), - new SqlParameter("@SrvPriority", SrvPriority), - new SqlParameter("@SrvWeight", SrvWeight), - new SqlParameter("@SrvPort", SrvPort), - new SqlParameter("@IpAddressId", ipAddressId)); - } - - - public static void DeleteDnsRecord(int actorId, int recordId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteDnsRecord", - new SqlParameter("@actorId", actorId), - new SqlParameter("@RecordId", recordId)); - } - #endregion - - #region Domains - public static DataSet GetDomains(int actorId, int packageId, bool recursive) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDomains", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageId", packageId), - new SqlParameter("@Recursive", recursive)); - } - - public static DataSet GetResellerDomains(int actorId, int packageId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetResellerDomains", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageId", packageId)); - } - - public static DataSet GetDomainsPaged(int actorId, int packageId, int serverId, bool recursive, string filterColumn, string filterValue, - string sortColumn, int startRow, int maximumRows) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDomainsPaged", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageId", packageId), - new SqlParameter("@serverId", serverId), - new SqlParameter("@recursive", recursive), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@StartRow", startRow), - new SqlParameter("@MaximumRows", maximumRows)); - } - - public static IDataReader GetDomain(int actorId, int domainId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDomain", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@domainId", domainId)); - } - - public static IDataReader GetDomainByName(int actorId, string domainName, bool searchOnDomainPointer, bool isDomainPointer) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDomainByName", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@domainName", domainName), - new SqlParameter("@SearchOnDomainPointer", searchOnDomainPointer), - new SqlParameter("@IsDomainPointer", isDomainPointer)); - } - - - public static DataSet GetDomainsByZoneId(int actorId, int zoneId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDomainsByZoneID", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@ZoneID", zoneId)); - } - - public static DataSet GetDomainsByDomainItemId(int actorId, int domainId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetDomainsByDomainItemId", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@DomainID", domainId)); - } - - - - public static int CheckDomain(int packageId, string domainName, bool isDomainPointer) - { - SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Int); - prmId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "CheckDomain", - prmId, - new SqlParameter("@packageId", packageId), - new SqlParameter("@domainName", domainName), - new SqlParameter("@isDomainPointer", isDomainPointer)); - - return Convert.ToInt32(prmId.Value); - } - - - - public static int CheckDomainUsedByHostedOrganization(string domainName) - { - SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Int); - prmId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "CheckDomainUsedByHostedOrganization", - prmId, - new SqlParameter("@domainName", domainName)); - - return Convert.ToInt32(prmId.Value); - } - - - public static int AddDomain(int actorId, int packageId, int zoneItemId, string domainName, - bool hostingAllowed, int webSiteId, int mailDomainId, bool isSubDomain, bool isInstantAlias, bool isDomainPointer) - { - SqlParameter prmId = new SqlParameter("@DomainID", SqlDbType.Int); - prmId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddDomain", - prmId, - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageId", packageId), - new SqlParameter("@ZoneItemId", zoneItemId), - new SqlParameter("@DomainName", domainName), - new SqlParameter("@HostingAllowed", hostingAllowed), - new SqlParameter("@WebSiteId", webSiteId), - new SqlParameter("@MailDomainId", mailDomainId), - new SqlParameter("@IsSubDomain", isSubDomain), - new SqlParameter("@IsInstantAlias", isInstantAlias), - new SqlParameter("@IsDomainPointer", isDomainPointer)); - - return Convert.ToInt32(prmId.Value); - } - - public static void UpdateDomain(int actorId, int domainId, int zoneItemId, - bool hostingAllowed, int webSiteId, int mailDomainId, int domainItemId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateDomain", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@DomainId", domainId), - new SqlParameter("@ZoneItemId", zoneItemId), - new SqlParameter("@HostingAllowed", hostingAllowed), - new SqlParameter("@WebSiteId", webSiteId), - new SqlParameter("@MailDomainId", mailDomainId), - new SqlParameter("@DomainItemId", domainItemId)); - } - - public static void DeleteDomain(int actorId, int domainId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteDomain", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@DomainId", domainId)); - } - #endregion - - #region Services - public static IDataReader GetServicesByServerId(int actorId, int serverId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServicesByServerID", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServerID", serverId)); - } - - public static IDataReader GetServicesByServerIdGroupName(int actorId, int serverId, string groupName) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServicesByServerIdGroupName", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@ServerID", serverId), - new SqlParameter("@GroupName", groupName)); - } - - public static DataSet GetRawServicesByServerId(int actorId, int serverId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetRawServicesByServerID", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServerID", serverId)); - } - - public static DataSet GetServicesByGroupId(int actorId, int groupId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServicesByGroupID", - new SqlParameter("@actorId", actorId), - new SqlParameter("@groupId", groupId)); - } - - public static DataSet GetServicesByGroupName(int actorId, string groupName) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServicesByGroupName", - new SqlParameter("@actorId", actorId), - new SqlParameter("@GroupName", groupName)); - } - - public static IDataReader GetService(int actorId, int serviceId) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, - CommandType.StoredProcedure, - ObjectQualifier + "GetService", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServiceID", serviceId)); - } - - public static int AddService(int serverId, int providerId, string serviceName, int serviceQuotaValue, - int clusterId, string comments) - { - SqlParameter prmServiceId = new SqlParameter("@ServiceID", SqlDbType.Int); - prmServiceId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddService", - prmServiceId, - new SqlParameter("@ServerID", serverId), - new SqlParameter("@ProviderID", providerId), - new SqlParameter("@ServiceName", serviceName), - new SqlParameter("@ServiceQuotaValue", serviceQuotaValue), - new SqlParameter("@ClusterId", clusterId), - new SqlParameter("@comments", comments)); - - return Convert.ToInt32(prmServiceId.Value); - } - - public static void UpdateService(int serviceId, string serviceName, int serviceQuotaValue, - int clusterId, string comments) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateService", - new SqlParameter("@ServiceName", serviceName), - new SqlParameter("@ServiceID", serviceId), - new SqlParameter("@ServiceQuotaValue", serviceQuotaValue), - new SqlParameter("@ClusterId", clusterId), - new SqlParameter("@Comments", comments)); - } - - public static int DeleteService(int serviceId) - { - SqlParameter prmResult = new SqlParameter("@Result", SqlDbType.Int); - prmResult.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteService", - prmResult, - new SqlParameter("@ServiceID", serviceId)); - - return Convert.ToInt32(prmResult.Value); - } - - public static IDataReader GetServiceProperties(int actorId, int serviceId) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, - CommandType.StoredProcedure, - ObjectQualifier + "GetServiceProperties", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServiceID", serviceId)); - } - - public static void UpdateServiceProperties(int serviceId, string xml) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateServiceProperties", - new SqlParameter("@ServiceId", serviceId), - new SqlParameter("@Xml", xml)); - } - - public static IDataReader GetResourceGroup(int groupId) - { - return SqlHelper.ExecuteReader(ConnectionString, - CommandType.StoredProcedure, - ObjectQualifier + "GetResourceGroup", - new SqlParameter("@groupId", groupId)); - } - - public static DataSet GetResourceGroups() - { - return SqlHelper.ExecuteDataset(ConnectionString, - CommandType.StoredProcedure, - ObjectQualifier + "GetResourceGroups"); - } - #endregion - - #region Service Items - public static DataSet GetServiceItems(int actorId, int packageId, string groupName, string itemTypeName, bool recursive) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServiceItems", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@GroupName", groupName), - new SqlParameter("@ItemTypeName", itemTypeName), - new SqlParameter("@Recursive", recursive)); - - } - - public static DataSet GetServiceItemsPaged(int actorId, int packageId, string groupName, string itemTypeName, - int serverId, bool recursive, string filterColumn, string filterValue, - string sortColumn, int startRow, int maximumRows) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServiceItemsPaged", - new SqlParameter("@actorId", actorId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@groupName", groupName), - new SqlParameter("@serverId", serverId), - new SqlParameter("@itemTypeName", itemTypeName), - new SqlParameter("@recursive", recursive), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows)); - } - - public static DataSet GetSearchableServiceItemTypes() - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetSearchableServiceItemTypes"); - } - - public static DataSet GetServiceItemsByService(int actorId, int serviceId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServiceItemsByService", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ServiceID", serviceId)); - } - - public static int GetServiceItemsCount(string typeName, string groupName, int serviceId) - { - SqlParameter prmTotalNumber = new SqlParameter("@TotalNumber", SqlDbType.Int); - prmTotalNumber.Direction = ParameterDirection.Output; - - DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServiceItemsCount", - prmTotalNumber, - new SqlParameter("@itemTypeName", typeName), - new SqlParameter("@groupName", groupName), - new SqlParameter("@serviceId", serviceId)); - - // read identity - return Convert.ToInt32(prmTotalNumber.Value); - } - - public static DataSet GetServiceItemsForStatistics(int actorId, int serviceId, int packageId, - bool calculateDiskspace, bool calculateBandwidth, bool suspendable, bool disposable) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServiceItemsForStatistics", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ServiceID", serviceId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@calculateDiskspace", calculateDiskspace), - new SqlParameter("@calculateBandwidth", calculateBandwidth), - new SqlParameter("@suspendable", suspendable), - new SqlParameter("@disposable", disposable)); - } - - public static DataSet GetServiceItemsByPackage(int actorId, int packageId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServiceItemsByPackage", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageID", packageId)); - } - - public static DataSet GetServiceItem(int actorId, int itemId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServiceItem", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@actorId", actorId)); - } - - public static bool CheckServiceItemExists(int serviceId, string itemName, string itemTypeName) - { - SqlParameter prmExists = new SqlParameter("@Exists", SqlDbType.Bit); - prmExists.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "CheckServiceItemExistsInService", - prmExists, - new SqlParameter("@serviceId", serviceId), - new SqlParameter("@itemName", itemName), - new SqlParameter("@itemTypeName", itemTypeName)); - - return Convert.ToBoolean(prmExists.Value); - } - - public static bool CheckServiceItemExists(string itemName, string groupName, string itemTypeName) - { - SqlParameter prmExists = new SqlParameter("@Exists", SqlDbType.Bit); - prmExists.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "CheckServiceItemExists", - prmExists, - new SqlParameter("@itemName", itemName), - new SqlParameter("@groupName", groupName), - new SqlParameter("@itemTypeName", itemTypeName)); - - return Convert.ToBoolean(prmExists.Value); - } - - public static DataSet GetServiceItemByName(int actorId, int packageId, string groupName, - string itemName, string itemTypeName) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServiceItemByName", - new SqlParameter("@actorId", actorId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@itemName", itemName), - new SqlParameter("@itemTypeName", itemTypeName), - new SqlParameter("@groupName", groupName)); - } - - public static DataSet GetServiceItemsByName(int actorId, int packageId, string itemName) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetServiceItemsByName", - new SqlParameter("@actorId", actorId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@itemName", itemName)); - } - - public static int AddServiceItem(int actorId, int serviceId, int packageId, string itemName, - string itemTypeName, string xmlProperties) - { - // add item - SqlParameter prmItemId = new SqlParameter("@ItemID", SqlDbType.Int); - prmItemId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddServiceItem", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@ServiceID", serviceId), - new SqlParameter("@ItemName", itemName), - new SqlParameter("@ItemTypeName", itemTypeName), - new SqlParameter("@xmlProperties", xmlProperties), - new SqlParameter("@CreatedDate", DateTime.Now), - prmItemId); - - return Convert.ToInt32(prmItemId.Value); - } - - public static void UpdateServiceItem(int actorId, int itemId, string itemName, string xmlProperties) - { - // update item - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateServiceItem", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ItemName", itemName), - new SqlParameter("@ItemId", itemId), - new SqlParameter("@XmlProperties", xmlProperties)); - } - - public static void DeleteServiceItem(int actorId, int itemId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteServiceItem", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ItemID", itemId)); - } - - public static void MoveServiceItem(int actorId, int itemId, int destinationServiceId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "MoveServiceItem", - new SqlParameter("@actorId", actorId), - new SqlParameter("@ItemID", itemId), - new SqlParameter("@DestinationServiceID", destinationServiceId)); - } - - public static int GetPackageServiceId(int actorId, int packageId, string groupName) - { - SqlParameter prmServiceId = new SqlParameter("@ServiceID", SqlDbType.Int); - prmServiceId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackageServiceID", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@groupName", groupName), - prmServiceId); - - return Convert.ToInt32(prmServiceId.Value); - } - - public static void UpdatePackageDiskSpace(int packageId, string xml) - { - ExecuteLongNonQuery( - ObjectQualifier + "UpdatePackageDiskSpace", - new SqlParameter("@packageId", packageId), - new SqlParameter("@xml", xml)); - } - - public static void UpdatePackageBandwidth(int packageId, string xml) - { - ExecuteLongNonQuery( - ObjectQualifier + "UpdatePackageBandwidth", - new SqlParameter("@packageId", packageId), - new SqlParameter("@xml", xml)); - } - - public static DateTime GetPackageBandwidthUpdate(int packageId) - { - SqlParameter prmUpdateDate = new SqlParameter("@UpdateDate", SqlDbType.DateTime); - prmUpdateDate.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackageBandwidthUpdate", - prmUpdateDate, - new SqlParameter("@packageId", packageId)); - - return (prmUpdateDate.Value != DBNull.Value) ? Convert.ToDateTime(prmUpdateDate.Value) : DateTime.MinValue; - } - - public static void UpdatePackageBandwidthUpdate(int packageId, DateTime updateDate) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdatePackageBandwidthUpdate", - new SqlParameter("@packageId", packageId), - new SqlParameter("@updateDate", updateDate)); - } - - public static IDataReader GetServiceItemType(int itemTypeId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetServiceItemType", - new SqlParameter("@ItemTypeID", itemTypeId) - ); - } - - public static IDataReader GetServiceItemTypes() - { - return SqlHelper.ExecuteReader ( - ConnectionString, - CommandType.StoredProcedure, - "GetServiceItemTypes" - ); - } - #endregion - - #region Plans - // Plans methods - public static DataSet GetHostingPlans(int actorId, int userId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetHostingPlans", - new SqlParameter("@actorId", actorId), - new SqlParameter("@userId", userId)); - } - - public static DataSet GetHostingAddons(int actorId, int userId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetHostingAddons", - new SqlParameter("@actorId", actorId), - new SqlParameter("@userId", userId)); - } - - public static DataSet GetUserAvailableHostingPlans(int actorId, int userId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUserAvailableHostingPlans", - new SqlParameter("@actorId", actorId), - new SqlParameter("@userId", userId)); - } - - public static DataSet GetUserAvailableHostingAddons(int actorId, int userId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetUserAvailableHostingAddons", - new SqlParameter("@actorId", actorId), - new SqlParameter("@userId", userId)); - } - - public static IDataReader GetHostingPlan(int actorId, int planId) - { - return (IDataReader)SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetHostingPlan", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PlanId", planId)); - } - - public static DataSet GetHostingPlanQuotas(int actorId, int packageId, int planId, int serverId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetHostingPlanQuotas", - new SqlParameter("@actorId", actorId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@planId", planId), - new SqlParameter("@serverId", serverId)); - } - - public static int AddHostingPlan(int actorId, int userId, int packageId, string planName, - string planDescription, bool available, int serverId, decimal setupPrice, decimal recurringPrice, - int recurrenceUnit, int recurrenceLength, bool isAddon, string quotasXml) - { - SqlParameter prmPlanId = new SqlParameter("@PlanID", SqlDbType.Int); - prmPlanId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddHostingPlan", - new SqlParameter("@actorId", actorId), - new SqlParameter("@userId", userId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@planName", planName), - new SqlParameter("@planDescription", planDescription), - new SqlParameter("@available", available), - new SqlParameter("@serverId", serverId), - new SqlParameter("@setupPrice", setupPrice), - new SqlParameter("@recurringPrice", recurringPrice), - new SqlParameter("@recurrenceUnit", recurrenceUnit), - new SqlParameter("@recurrenceLength", recurrenceLength), - new SqlParameter("@isAddon", isAddon), - new SqlParameter("@quotasXml", quotasXml), - prmPlanId); - - // read identity - return Convert.ToInt32(prmPlanId.Value); - } - - public static DataSet UpdateHostingPlan(int actorId, int planId, int packageId, int serverId, string planName, - string planDescription, bool available, decimal setupPrice, decimal recurringPrice, - int recurrenceUnit, int recurrenceLength, string quotasXml) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateHostingPlan", - new SqlParameter("@actorId", actorId), - new SqlParameter("@planId", planId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@serverId", serverId), - new SqlParameter("@planName", planName), - new SqlParameter("@planDescription", planDescription), - new SqlParameter("@available", available), - new SqlParameter("@setupPrice", setupPrice), - new SqlParameter("@recurringPrice", recurringPrice), - new SqlParameter("@recurrenceUnit", recurrenceUnit), - new SqlParameter("@recurrenceLength", recurrenceLength), - new SqlParameter("@quotasXml", quotasXml)); - } - - public static int CopyHostingPlan(int planId, int userId, int packageId) - { - SqlParameter prmPlanId = new SqlParameter("@DestinationPlanID", SqlDbType.Int); - prmPlanId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "CopyHostingPlan", - new SqlParameter("@SourcePlanID", planId), - new SqlParameter("@UserID", userId), - new SqlParameter("@PackageID", packageId), - prmPlanId); - - return Convert.ToInt32(prmPlanId.Value); - } - - public static int DeleteHostingPlan(int actorId, int planId) - { - SqlParameter prmResult = new SqlParameter("@Result", SqlDbType.Int); - prmResult.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteHostingPlan", - prmResult, - new SqlParameter("@actorId", actorId), - new SqlParameter("@PlanId", planId)); - - return Convert.ToInt32(prmResult.Value); - } - #endregion - - #region Packages - - // Packages - public static DataSet GetMyPackages(int actorId, int userId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetMyPackages", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@UserID", userId)); - } - - public static DataSet GetPackages(int actorId, int userId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackages", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@UserID", userId)); - } - - public static DataSet GetNestedPackagesSummary(int actorId, int packageId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetNestedPackagesSummary", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageID", packageId)); - } - - public static DataSet SearchServiceItemsPaged(int actorId, int userId, int itemTypeId, string filterValue, - string sortColumn, int startRow, int maximumRows) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "SearchServiceItemsPaged", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@UserID", userId), - new SqlParameter("@itemTypeId", itemTypeId), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows)); - } - - public static DataSet GetPackagesPaged(int actorId, int userId, string filterColumn, string filterValue, - string sortColumn, int startRow, int maximumRows) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackagesPaged", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@UserID", userId), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows)); - } - - public static DataSet GetNestedPackagesPaged(int actorId, int packageId, string filterColumn, string filterValue, - int statusId, int planId, int serverId, string sortColumn, int startRow, int maximumRows) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetNestedPackagesPaged", - new SqlParameter("@actorId", actorId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@statusId", statusId), - new SqlParameter("@planId", planId), - new SqlParameter("@serverId", serverId), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows)); - } - - public static DataSet GetPackagePackages(int actorId, int packageId, bool recursive) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackagePackages", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@recursive", recursive)); - } - - public static IDataReader GetPackage(int actorId, int packageId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackage", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageID", packageId)); - } - - public static DataSet GetPackageQuotas(int actorId, int packageId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackageQuotas", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageID", packageId)); - } - - public static DataSet GetPackageQuotasForEdit(int actorId, int packageId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackageQuotasForEdit", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageID", packageId)); - } - - public static DataSet AddPackage(int actorId, out int packageId, int userId, int planId, string packageName, - string packageComments, int statusId, DateTime purchaseDate) - { - SqlParameter prmPackageId = new SqlParameter("@PackageID", SqlDbType.Int); - prmPackageId.Direction = ParameterDirection.Output; - - DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddPackage", - prmPackageId, - new SqlParameter("@ActorId", actorId), - new SqlParameter("@userId", userId), - new SqlParameter("@packageName", packageName), - new SqlParameter("@packageComments", packageComments), - new SqlParameter("@statusId", statusId), - new SqlParameter("@planId", planId), - new SqlParameter("@purchaseDate", purchaseDate)); - - // read identity - packageId = Convert.ToInt32(prmPackageId.Value); - - return ds; - } - - public static DataSet UpdatePackage(int actorId, int packageId, int planId, string packageName, - string packageComments, int statusId, DateTime purchaseDate, - bool overrideQuotas, string quotasXml) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdatePackage", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@packageName", packageName), - new SqlParameter("@packageComments", packageComments), - new SqlParameter("@statusId", statusId), - new SqlParameter("@planId", planId), - new SqlParameter("@purchaseDate", purchaseDate), - new SqlParameter("@overrideQuotas", overrideQuotas), - new SqlParameter("@quotasXml", quotasXml)); - } - - public static void UpdatePackageName(int actorId, int packageId, string packageName, - string packageComments) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdatePackageName", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@packageName", packageName), - new SqlParameter("@packageComments", packageComments)); - } - - public static void DeletePackage(int actorId, int packageId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeletePackage", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageID", packageId)); - } - - // Package Add-ons - public static DataSet GetPackageAddons(int actorId, int packageId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackageAddons", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageID", packageId)); - } - - public static IDataReader GetPackageAddon(int actorId, int packageAddonId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackageAddon", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageAddonID", packageAddonId)); - } - - public static DataSet AddPackageAddon(int actorId, out int addonId, int packageId, int planId, int quantity, - int statusId, DateTime purchaseDate, string comments) - { - SqlParameter prmPackageAddonId = new SqlParameter("@PackageAddonID", SqlDbType.Int); - prmPackageAddonId.Direction = ParameterDirection.Output; - - DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddPackageAddon", - prmPackageAddonId, - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@planId", planId), - new SqlParameter("@Quantity", quantity), - new SqlParameter("@statusId", statusId), - new SqlParameter("@PurchaseDate", purchaseDate), - new SqlParameter("@Comments", comments)); - - // read identity - addonId = Convert.ToInt32(prmPackageAddonId.Value); - - return ds; - } - - public static DataSet UpdatePackageAddon(int actorId, int packageAddonId, int planId, int quantity, - int statusId, DateTime purchaseDate, string comments) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdatePackageAddon", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageAddonID", packageAddonId), - new SqlParameter("@planId", planId), - new SqlParameter("@Quantity", quantity), - new SqlParameter("@statusId", statusId), - new SqlParameter("@PurchaseDate", purchaseDate), - new SqlParameter("@Comments", comments)); - } - - public static void DeletePackageAddon(int actorId, int packageAddonId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeletePackageAddon", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageAddonID", packageAddonId)); - } - - #endregion - - #region Packages Settings - public static IDataReader GetPackageSettings(int actorId, int packageId, string settingsName) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackageSettings", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageId", packageId), - new SqlParameter("@SettingsName", settingsName)); - } - public static void UpdatePackageSettings(int actorId, int packageId, string settingsName, string xml) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdatePackageSettings", - new SqlParameter("@PackageId", packageId), - new SqlParameter("@ActorId", actorId), - new SqlParameter("@SettingsName", settingsName), - new SqlParameter("@Xml", xml)); - } - #endregion - - #region Quotas - public static IDataReader GetProviderServiceQuota(int providerId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetProviderServiceQuota", - new SqlParameter("@providerId", providerId)); - } - - public static IDataReader GetPackageQuota(int actorId, int packageId, string quotaName) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPackageQuota", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@QuotaName", quotaName)); - } - #endregion - - #region Log - public static void AddAuditLogRecord(string recordId, int severityId, - int userId, string username, int packageId, int itemId, string itemName, DateTime startDate, DateTime finishDate, string sourceName, - string taskName, string executionLog) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddAuditLogRecord", - new SqlParameter("@recordId", recordId), - new SqlParameter("@severityId", severityId), - new SqlParameter("@UserID", userId), - new SqlParameter("@username", username), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@ItemId", itemId), - new SqlParameter("@itemName", itemName), - new SqlParameter("@startDate", startDate), - new SqlParameter("@finishDate", finishDate), - new SqlParameter("@sourceName", sourceName), - new SqlParameter("@taskName", taskName), - new SqlParameter("@executionLog", executionLog)); - } - - public static DataSet GetAuditLogRecordsPaged(int actorId, int userId, int packageId, int itemId, string itemName, DateTime startDate, DateTime endDate, - int severityId, string sourceName, string taskName, string sortColumn, int startRow, int maximumRows) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetAuditLogRecordsPaged", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@UserID", userId), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@itemId", itemId), - new SqlParameter("@itemName", itemName), - new SqlParameter("@StartDate", startDate), - new SqlParameter("@EndDate", endDate), - new SqlParameter("@severityId", severityId), - new SqlParameter("@sourceName", sourceName), - new SqlParameter("@taskName", taskName), - new SqlParameter("@sortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows)); - } - - public static DataSet GetAuditLogSources() - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetAuditLogSources"); - } - - public static DataSet GetAuditLogTasks(string sourceName) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetAuditLogTasks", - new SqlParameter("@sourceName", sourceName)); - } - - public static IDataReader GetAuditLogRecord(string recordId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetAuditLogRecord", - new SqlParameter("@recordId", recordId)); - } - - public static void DeleteAuditLogRecords(int actorId, int userId, int itemId, string itemName, DateTime startDate, DateTime endDate, - int severityId, string sourceName, string taskName) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteAuditLogRecords", - new SqlParameter("@actorId", actorId), - new SqlParameter("@userId", userId), - new SqlParameter("@itemId", itemId), - new SqlParameter("@itemName", itemName), - new SqlParameter("@startDate", startDate), - new SqlParameter("@endDate", endDate), - new SqlParameter("@severityId", severityId), - new SqlParameter("@sourceName", sourceName), - new SqlParameter("@taskName", taskName)); - } - - public static void DeleteAuditLogRecordsComplete() - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteAuditLogRecordsComplete"); - } - - #endregion - - #region Reports - public static DataSet GetPackagesBandwidthPaged(int actorId, int userId, int packageId, - DateTime startDate, DateTime endDate, string sortColumn, - int startRow, int maximumRows) - { - return ExecuteLongDataSet( - ObjectQualifier + "GetPackagesBandwidthPaged", - new SqlParameter("@actorId", actorId), - new SqlParameter("@userId", userId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@StartDate", startDate), - new SqlParameter("@EndDate", endDate), - new SqlParameter("@sortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows)); - } - - public static DataSet GetPackagesDiskspacePaged(int actorId, int userId, int packageId, string sortColumn, - int startRow, int maximumRows) - { - return ExecuteLongDataSet( - ObjectQualifier + "GetPackagesDiskspacePaged", - new SqlParameter("@actorId", actorId), - new SqlParameter("@userId", userId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@sortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows)); - } - - public static DataSet GetPackageBandwidth(int actorId, int packageId, DateTime startDate, DateTime endDate) - { - return ExecuteLongDataSet( - ObjectQualifier + "GetPackageBandwidth", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageId", packageId), - new SqlParameter("@StartDate", startDate), - new SqlParameter("@EndDate", endDate)); - } - - public static DataSet GetPackageDiskspace(int actorId, int packageId) - { - return ExecuteLongDataSet( - ObjectQualifier + "GetPackageDiskspace", - new SqlParameter("@actorId", actorId), - new SqlParameter("@PackageId", packageId)); - } - - #endregion - - #region Scheduler - public static IDataReader GetScheduleTasks(int actorId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetScheduleTasks", - new SqlParameter("@actorId", actorId)); - } - - public static IDataReader GetScheduleTask(int actorId, string taskId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetScheduleTask", - new SqlParameter("@actorId", actorId), - new SqlParameter("@taskId", taskId)); - } - - public static DataSet GetSchedules(int actorId, int packageId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetSchedules", - new SqlParameter("@actorId", actorId), - new SqlParameter("@packageId", packageId)); - } - - public static DataSet GetSchedulesPaged(int actorId, int packageId, bool recursive, - string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetSchedulesPaged", - new SqlParameter("@actorId", actorId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@recursive", recursive), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows)); - } - - public static DataSet GetSchedule(int actorId, int scheduleId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetSchedule", - new SqlParameter("@actorId", actorId), - new SqlParameter("@scheduleId", scheduleId)); - } - public static IDataReader GetScheduleInternal(int scheduleId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetScheduleInternal", - new SqlParameter("@scheduleId", scheduleId)); - } - public static DataSet GetNextSchedule() - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetNextSchedule"); - } - public static IDataReader GetScheduleParameters(int actorId, string taskId, int scheduleId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetScheduleParameters", - new SqlParameter("@actorId", actorId), - new SqlParameter("@taskId", taskId), - new SqlParameter("@scheduleId", scheduleId)); - } - - /// - /// Loads view configuration for the task with specified id. - /// - /// Task id which points to task for which view configuration will be loaded. - /// View configuration for the task with supplied id. - public static IDataReader GetScheduleTaskViewConfigurations(string taskId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetScheduleTaskViewConfigurations", - new SqlParameter("@taskId", taskId)); - } - - public static int AddSchedule(int actorId, string taskId, int packageId, - string scheduleName, string scheduleTypeId, int interval, - DateTime fromTime, DateTime toTime, DateTime startTime, - DateTime nextRun, bool enabled, string priorityId, int historiesNumber, - int maxExecutionTime, int weekMonthDay, string xmlParameters) - { - SqlParameter prmId = new SqlParameter("@ScheduleID", SqlDbType.Int); - prmId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddSchedule", - prmId, - new SqlParameter("@actorId", actorId), - new SqlParameter("@taskId", taskId), - new SqlParameter("@packageId", packageId), - new SqlParameter("@scheduleName", scheduleName), - new SqlParameter("@scheduleTypeId", scheduleTypeId), - new SqlParameter("@interval", interval), - new SqlParameter("@fromTime", fromTime), - new SqlParameter("@toTime", toTime), - new SqlParameter("@startTime", startTime), - new SqlParameter("@nextRun", nextRun), - new SqlParameter("@enabled", enabled), - new SqlParameter("@priorityId", priorityId), - new SqlParameter("@historiesNumber", historiesNumber), - new SqlParameter("@maxExecutionTime", maxExecutionTime), - new SqlParameter("@weekMonthDay", weekMonthDay), - new SqlParameter("@xmlParameters", xmlParameters)); - - // read identity - return Convert.ToInt32(prmId.Value); - } - public static void UpdateSchedule(int actorId, int scheduleId, string taskId, - string scheduleName, string scheduleTypeId, int interval, - DateTime fromTime, DateTime toTime, DateTime startTime, - DateTime lastRun, DateTime nextRun, bool enabled, string priorityId, int historiesNumber, - int maxExecutionTime, int weekMonthDay, string xmlParameters) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateSchedule", - new SqlParameter("@actorId", actorId), - new SqlParameter("@scheduleId", scheduleId), - new SqlParameter("@taskId", taskId), - new SqlParameter("@scheduleName", scheduleName), - new SqlParameter("@scheduleTypeId", scheduleTypeId), - new SqlParameter("@interval", interval), - new SqlParameter("@fromTime", fromTime), - new SqlParameter("@toTime", toTime), - new SqlParameter("@startTime", startTime), - new SqlParameter("@lastRun", (lastRun == DateTime.MinValue) ? DBNull.Value : (object)lastRun), - new SqlParameter("@nextRun", nextRun), - new SqlParameter("@enabled", enabled), - new SqlParameter("@priorityId", priorityId), - new SqlParameter("@historiesNumber", historiesNumber), - new SqlParameter("@maxExecutionTime", maxExecutionTime), - new SqlParameter("@weekMonthDay", weekMonthDay), - new SqlParameter("@xmlParameters", xmlParameters)); - } - public static void DeleteSchedule(int actorId, int scheduleId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteSchedule", - new SqlParameter("@actorId", actorId), - new SqlParameter("@scheduleId", scheduleId)); - } - - public static DataSet GetScheduleHistories(int actorId, int scheduleId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetScheduleHistories", - new SqlParameter("@actorId", actorId), - new SqlParameter("@scheduleId", scheduleId)); - } - public static IDataReader GetScheduleHistory(int actorId, int scheduleHistoryId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetScheduleHistory", - new SqlParameter("@actorId", actorId), - new SqlParameter("@scheduleHistoryId", scheduleHistoryId)); - } - public static int AddScheduleHistory(int actorId, int scheduleId, - DateTime startTime, DateTime finishTime, string statusId, string executionLog) - { - SqlParameter prmId = new SqlParameter("@ScheduleHistoryID", SqlDbType.Int); - prmId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddScheduleHistory", - prmId, - new SqlParameter("@actorId", actorId), - new SqlParameter("@scheduleId", scheduleId), - new SqlParameter("@startTime", (startTime == DateTime.MinValue) ? DBNull.Value : (object)startTime), - new SqlParameter("@finishTime", (finishTime == DateTime.MinValue) ? DBNull.Value : (object)finishTime), - new SqlParameter("@statusId", statusId), - new SqlParameter("@executionLog", executionLog)); - - // read identity - return Convert.ToInt32(prmId.Value); - } - public static void UpdateScheduleHistory(int actorId, int scheduleHistoryId, - DateTime startTime, DateTime finishTime, string statusId, string executionLog) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "UpdateScheduleHistory", - new SqlParameter("@actorId", actorId), - new SqlParameter("@scheduleHistoryId", scheduleHistoryId), - new SqlParameter("@startTime", (startTime == DateTime.MinValue) ? DBNull.Value : (object)startTime), - new SqlParameter("@finishTime", (finishTime == DateTime.MinValue) ? DBNull.Value : (object)finishTime), - new SqlParameter("@statusId", statusId), - new SqlParameter("@executionLog", executionLog)); - } - public static void DeleteScheduleHistories(int actorId, int scheduleId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteScheduleHistories", - new SqlParameter("@actorId", actorId), - new SqlParameter("@scheduleId", scheduleId)); - } - #endregion - - #region Comments - public static DataSet GetComments(int actorId, int userId, string itemTypeId, int itemId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetComments", - new SqlParameter("@actorId", actorId), - new SqlParameter("@userId", userId), - new SqlParameter("@itemTypeId", itemTypeId), - new SqlParameter("@itemId", itemId)); - } - - public static void AddComment(int actorId, string itemTypeId, int itemId, - string commentText, int severityId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddComment", - new SqlParameter("@actorId", actorId), - new SqlParameter("@itemTypeId", itemTypeId), - new SqlParameter("@itemId", itemId), - new SqlParameter("@commentText", commentText), - new SqlParameter("@severityId", severityId)); - } - - public static void DeleteComment(int actorId, int commentId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteComment", - new SqlParameter("@actorId", actorId), - new SqlParameter("@commentId", commentId)); - } - #endregion - - #region Helper Methods - private static string VerifyColumnName(string str) - { - if (str == null) - str = ""; - return Regex.Replace(str, @"[^\w\. ]", ""); - } - - private static string VerifyColumnValue(string str) - { - return String.IsNullOrEmpty(str) ? str : str.Replace("'", "''"); - } - - private static DataSet ExecuteLongDataSet(string spName, params SqlParameter[] parameters) - { - return ExecuteLongDataSet(spName, CommandType.StoredProcedure, parameters); - } - - private static DataSet ExecuteLongQueryDataSet(string spName, params SqlParameter[] parameters) - { - return ExecuteLongDataSet(spName, CommandType.Text, parameters); - } - - private static DataSet ExecuteLongDataSet(string commandText, CommandType commandType, params SqlParameter[] parameters) - { - SqlConnection conn = new SqlConnection(ConnectionString); - SqlCommand cmd = new SqlCommand(commandText, conn); - cmd.CommandType = commandType; - cmd.CommandTimeout = 300; - - if (parameters != null) - { - foreach (SqlParameter prm in parameters) - { - cmd.Parameters.Add(prm); - } - } - - DataSet ds = new DataSet(); - try - { - SqlDataAdapter da = new SqlDataAdapter(cmd); - da.Fill(ds); - } - finally - { - if (conn.State == ConnectionState.Open) - conn.Close(); - } - - return ds; - } - - private static void ExecuteLongNonQuery(string spName, params SqlParameter[] parameters) - { - SqlConnection conn = new SqlConnection(ConnectionString); - SqlCommand cmd = new SqlCommand(spName, conn); - cmd.CommandType = CommandType.StoredProcedure; - cmd.CommandTimeout = 300; - - if (parameters != null) - { - foreach (SqlParameter prm in parameters) - { - cmd.Parameters.Add(prm); - } - } - - try - { - conn.Open(); - cmd.ExecuteNonQuery(); - } - finally - { - if (conn.State == ConnectionState.Open) - conn.Close(); - } - } - #endregion - - #region Exchange Server - - - public static int AddExchangeAccount(int itemId, int accountType, string accountName, - string displayName, string primaryEmailAddress, bool mailEnabledPublicFolder, - string mailboxManagerActions, string samAccountName, string accountPassword, int mailboxPlanId, string subscriberNumber) - { - SqlParameter outParam = new SqlParameter("@AccountID", SqlDbType.Int); - outParam.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "AddExchangeAccount", - outParam, - new SqlParameter("@ItemID", itemId), - new SqlParameter("@AccountType", accountType), - new SqlParameter("@AccountName", accountName), - new SqlParameter("@DisplayName", displayName), - new SqlParameter("@PrimaryEmailAddress", primaryEmailAddress), - new SqlParameter("@MailEnabledPublicFolder", mailEnabledPublicFolder), - new SqlParameter("@MailboxManagerActions", mailboxManagerActions), - new SqlParameter("@SamAccountName", samAccountName), - new SqlParameter("@AccountPassword", accountPassword), - new SqlParameter("@MailboxPlanId", (mailboxPlanId == 0) ? (object)DBNull.Value : (object)mailboxPlanId), - new SqlParameter("@SubscriberNumber", (string.IsNullOrEmpty(subscriberNumber) ? (object)DBNull.Value : (object)subscriberNumber)) - ); - - return Convert.ToInt32(outParam.Value); - } - - - public static void AddExchangeAccountEmailAddress(int accountId, string emailAddress) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "AddExchangeAccountEmailAddress", - new SqlParameter("@AccountID", accountId), - new SqlParameter("@EmailAddress", emailAddress) - ); - } - - public static void AddExchangeOrganization(int itemId, string organizationId) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "AddExchangeOrganization", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@OrganizationID", organizationId) - ); - } - - public static void AddExchangeOrganizationDomain(int itemId, int domainId, bool isHost) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "AddExchangeOrganizationDomain", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@DomainID", domainId), - new SqlParameter("@IsHost", isHost) - ); - } - - public static void ChangeExchangeAcceptedDomainType(int itemId, int domainId, int domainTypeId) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "ChangeExchangeAcceptedDomainType", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@DomainID", domainId), - new SqlParameter("@DomainTypeID", domainTypeId) - ); - } - - public static IDataReader GetExchangeOrganizationStatistics(int itemId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeOrganizationStatistics", - new SqlParameter("@ItemID", itemId) - ); - } - - public static void DeleteUserEmailAddresses(int accountId, string primaryAddress) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "DeleteUserEmailAddresses", - new SqlParameter("@AccountID", accountId), - new SqlParameter("@PrimaryEmailAddress", primaryAddress) - ); - } - - public static void DeleteExchangeAccount(int itemId, int accountId) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "DeleteExchangeAccount", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@AccountID", accountId) - ); - } - - - public static void DeleteExchangeAccountEmailAddress(int accountId, string emailAddress) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "DeleteExchangeAccountEmailAddress", - new SqlParameter("@AccountID", accountId), - new SqlParameter("@EmailAddress", emailAddress) - ); - } - - public static void DeleteExchangeOrganization(int itemId) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "DeleteExchangeOrganization", - new SqlParameter("@ItemID", itemId) - ); - } - - public static void DeleteExchangeOrganizationDomain(int itemId, int domainId) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "DeleteExchangeOrganizationDomain", - new SqlParameter("@ItemId", itemId), - new SqlParameter("@DomainID", domainId) - ); - } - - public static bool ExchangeAccountEmailAddressExists(string emailAddress) - { - SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit); - outParam.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "ExchangeAccountEmailAddressExists", - new SqlParameter("@EmailAddress", emailAddress), - outParam - ); - - return Convert.ToBoolean(outParam.Value); - } - - public static bool ExchangeOrganizationDomainExists(int domainId) - { - SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit); - outParam.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "ExchangeOrganizationDomainExists", - new SqlParameter("@DomainID", domainId), - outParam - ); - - return Convert.ToBoolean(outParam.Value); - } - - public static bool ExchangeOrganizationExists(string organizationId) - { - SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit); - outParam.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "ExchangeOrganizationExists", - new SqlParameter("@OrganizationID", organizationId), - outParam - ); - - return Convert.ToBoolean(outParam.Value); - } - - public static bool ExchangeAccountExists(string accountName) - { - SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit); - outParam.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "ExchangeAccountExists", - new SqlParameter("@AccountName", accountName), - outParam - ); - - return Convert.ToBoolean(outParam.Value); - } - - public static void UpdateExchangeAccount(int accountId, string accountName, ExchangeAccountType accountType, - string displayName, string primaryEmailAddress, bool mailEnabledPublicFolder, - string mailboxManagerActions, string samAccountName, string accountPassword, int mailboxPlanId, string subscriberNumber) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "UpdateExchangeAccount", - new SqlParameter("@AccountID", accountId), - new SqlParameter("@AccountName", accountName), - new SqlParameter("@DisplayName", displayName), - new SqlParameter("@AccountType", (int)accountType), - new SqlParameter("@PrimaryEmailAddress", primaryEmailAddress), - new SqlParameter("@MailEnabledPublicFolder", mailEnabledPublicFolder), - new SqlParameter("@MailboxManagerActions", mailboxManagerActions), - new SqlParameter("@Password", string.IsNullOrEmpty(accountPassword) ? (object)DBNull.Value : (object)accountPassword), - new SqlParameter("@SamAccountName", samAccountName), - new SqlParameter("@MailboxPlanId", (mailboxPlanId == 0) ? (object)DBNull.Value : (object)mailboxPlanId), - new SqlParameter("@SubscriberNumber", (string.IsNullOrEmpty(subscriberNumber) ? (object)DBNull.Value : (object)subscriberNumber)) - ); - } - - public static void UpdateExchangeAccountUserPrincipalName(int accountId, string userPrincipalName) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "UpdateExchangeAccountUserPrincipalName", - new SqlParameter("@AccountID", accountId), - new SqlParameter("@UserPrincipalName", userPrincipalName)); - } - - public static IDataReader GetExchangeAccount(int itemId, int accountId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeAccount", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@AccountID", accountId) - ); - } - - public static IDataReader GetExchangeAccountByAccountName(int itemId, string accountName) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeAccountByAccountName", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@AccountName", accountName) - ); - } - - public static IDataReader GetExchangeAccountByMailboxPlanId(int itemId, int MailboxPlanId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeAccountByMailboxPlanId", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@MailboxPlanId", MailboxPlanId) - ); - } - - - public static IDataReader GetExchangeAccountEmailAddresses(int accountId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeAccountEmailAddresses", - new SqlParameter("@AccountID", accountId) - ); - } - - public static IDataReader GetExchangeOrganizationDomains(int itemId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeOrganizationDomains", - new SqlParameter("@ItemID", itemId) - ); - } - - - public static IDataReader GetExchangeAccounts(int itemId, int accountType) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeAccounts", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@AccountType", accountType) - ); - } - - public static IDataReader GetExchangeMailboxes(int itemId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeMailboxes", - new SqlParameter("@ItemID", itemId) - ); - } - - public static DataSet GetExchangeAccountsPaged(int actorId, int itemId, string accountTypes, - string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) - { - // check input parameters - string[] types = accountTypes.Split(','); - for (int i = 0; i < types.Length; i++) - { - try - { - int type = Int32.Parse(types[i]); - } - catch - { - throw new ArgumentException("Wrong patameter", "accountTypes"); - } - } - - string searchTypes = String.Join(",", types); - - return SqlHelper.ExecuteDataset( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeAccountsPaged", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId), - new SqlParameter("@AccountTypes", searchTypes), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@StartRow", startRow), - new SqlParameter("@MaximumRows", maximumRows) - ); - } - - public static IDataReader SearchExchangeAccounts(int actorId, int itemId, bool includeMailboxes, - bool includeContacts, bool includeDistributionLists, bool includeRooms, bool includeEquipment, - string filterColumn, string filterValue, string sortColumn) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "SearchExchangeAccounts", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId), - new SqlParameter("@IncludeMailboxes", includeMailboxes), - new SqlParameter("@IncludeContacts", includeContacts), - new SqlParameter("@IncludeDistributionLists", includeDistributionLists), - new SqlParameter("@IncludeRooms", includeRooms), - new SqlParameter("@IncludeEquipment", includeEquipment), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)) - ); - } - - public static IDataReader SearchExchangeAccount(int actorId, int accountType, string primaryEmailAddress) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "SearchExchangeAccount", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@AccountType", accountType), - new SqlParameter("@PrimaryEmailAddress", primaryEmailAddress) - ); - } - - #endregion - - #region Exchange Mailbox Plans - public static int AddExchangeMailboxPlan(int itemID, string mailboxPlan, bool enableActiveSync, bool enableIMAP, bool enableMAPI, bool enableOWA, bool enablePOP, - bool isDefault, int issueWarningPct, int keepDeletedItemsDays, int mailboxSizeMB, int maxReceiveMessageSizeKB, int maxRecipients, - int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType, - bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg) - { - SqlParameter outParam = new SqlParameter("@MailboxPlanId", SqlDbType.Int); - outParam.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "AddExchangeMailboxPlan", - outParam, - new SqlParameter("@ItemID", itemID), - new SqlParameter("@MailboxPlan", mailboxPlan), - new SqlParameter("@EnableActiveSync", enableActiveSync), - new SqlParameter("@EnableIMAP", enableIMAP), - new SqlParameter("@EnableMAPI", enableMAPI), - new SqlParameter("@EnableOWA", enableOWA), - new SqlParameter("@EnablePOP", enablePOP), - new SqlParameter("@IsDefault", isDefault), - new SqlParameter("@IssueWarningPct", issueWarningPct), - new SqlParameter("@KeepDeletedItemsDays", keepDeletedItemsDays), - new SqlParameter("@MailboxSizeMB", mailboxSizeMB), - new SqlParameter("@MaxReceiveMessageSizeKB", maxReceiveMessageSizeKB), - new SqlParameter("@MaxRecipients", maxRecipients), - new SqlParameter("@MaxSendMessageSizeKB", maxSendMessageSizeKB), - new SqlParameter("@ProhibitSendPct", prohibitSendPct), - new SqlParameter("@ProhibitSendReceivePct", prohibitSendReceivePct), - new SqlParameter("@HideFromAddressBook", hideFromAddressBook), - new SqlParameter("@MailboxPlanType", mailboxPlanType), - new SqlParameter("@AllowLitigationHold",enabledLitigationHold), - new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning), - new SqlParameter("@RecoverableItemsSpace",recoverabelItemsSpace), - new SqlParameter("@LitigationHoldUrl",litigationHoldUrl), - new SqlParameter("@LitigationHoldMsg",litigationHoldMsg) - ); - - return Convert.ToInt32(outParam.Value); - } - - - - public static void UpdateExchangeMailboxPlan(int mailboxPlanID, string mailboxPlan, bool enableActiveSync, bool enableIMAP, bool enableMAPI, bool enableOWA, bool enablePOP, - bool isDefault, int issueWarningPct, int keepDeletedItemsDays, int mailboxSizeMB, int maxReceiveMessageSizeKB, int maxRecipients, - int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType, - bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "UpdateExchangeMailboxPlan", - new SqlParameter("@MailboxPlanID", mailboxPlanID), - new SqlParameter("@MailboxPlan", mailboxPlan), - new SqlParameter("@EnableActiveSync", enableActiveSync), - new SqlParameter("@EnableIMAP", enableIMAP), - new SqlParameter("@EnableMAPI", enableMAPI), - new SqlParameter("@EnableOWA", enableOWA), - new SqlParameter("@EnablePOP", enablePOP), - new SqlParameter("@IsDefault", isDefault), - new SqlParameter("@IssueWarningPct", issueWarningPct), - new SqlParameter("@KeepDeletedItemsDays", keepDeletedItemsDays), - new SqlParameter("@MailboxSizeMB", mailboxSizeMB), - new SqlParameter("@MaxReceiveMessageSizeKB", maxReceiveMessageSizeKB), - new SqlParameter("@MaxRecipients", maxRecipients), - new SqlParameter("@MaxSendMessageSizeKB", maxSendMessageSizeKB), - new SqlParameter("@ProhibitSendPct", prohibitSendPct), - new SqlParameter("@ProhibitSendReceivePct", prohibitSendReceivePct), - new SqlParameter("@HideFromAddressBook", hideFromAddressBook), - new SqlParameter("@MailboxPlanType", mailboxPlanType), - new SqlParameter("@AllowLitigationHold", enabledLitigationHold), - new SqlParameter("@RecoverableItemsWarningPct", recoverabelItemsWarning), - new SqlParameter("@RecoverableItemsSpace", recoverabelItemsSpace), - new SqlParameter("@LitigationHoldUrl",litigationHoldUrl), - new SqlParameter("@LitigationHoldMsg",litigationHoldMsg) - - ); - } - - - - public static void DeleteExchangeMailboxPlan(int mailboxPlanId) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "DeleteExchangeMailboxPlan", - new SqlParameter("@MailboxPlanId", mailboxPlanId) - ); - } - - - public static IDataReader GetExchangeMailboxPlan(int mailboxPlanId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeMailboxPlan", - new SqlParameter("@MailboxPlanId", mailboxPlanId) - ); - } - - public static IDataReader GetExchangeMailboxPlans(int itemId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeMailboxPlans", - new SqlParameter("@ItemID", itemId) - ); - } - - - public static IDataReader GetExchangeOrganization(int itemId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetExchangeOrganization", - new SqlParameter("@ItemID", itemId) - ); - } - - - public static void SetOrganizationDefaultExchangeMailboxPlan(int itemId, int mailboxPlanId) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "SetOrganizationDefaultExchangeMailboxPlan", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@MailboxPlanId", mailboxPlanId) - ); - } - - public static void SetExchangeAccountMailboxPlan(int accountId, int mailboxPlanId) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "SetExchangeAccountMailboxplan", - new SqlParameter("@AccountID", accountId), - new SqlParameter("@MailboxPlanId", (mailboxPlanId == 0) ? (object)DBNull.Value : (object)mailboxPlanId) - ); - } - - #endregion - - #region Organizations - - public static void DeleteOrganizationUser(int itemId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, "DeleteOrganizationUsers", new SqlParameter("@ItemID", itemId)); - } - - public static int GetItemIdByOrganizationId(string id) - { - object obj =SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetItemIdByOrganizationId", - new SqlParameter("@OrganizationId", id)); - - return (obj == null || DBNull.Value == obj) ? 0 : (int)obj; - - } - - public static IDataReader GetOrganizationStatistics(int itemId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetOrganizationStatistics", - new SqlParameter("@ItemID", itemId) - ); - } - - public static IDataReader SearchOrganizationAccounts(int actorId, int itemId, - string filterColumn, string filterValue, string sortColumn, bool includeMailboxes) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "SearchOrganizationAccounts", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@IncludeMailboxes", includeMailboxes) - ); - } - - #endregion - - #region CRM - - public static int GetCRMUsersCount(int itemId, string name, string email) - { - SqlParameter[] sqlParams = new SqlParameter[] - { - new SqlParameter("@ItemID", itemId), - GetFilterSqlParam("@Name", name), - GetFilterSqlParam("@Email", email), - }; - - return (int) SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetCRMUsersCount", sqlParams); - - } - - private static SqlParameter GetFilterSqlParam(string paramName, string value) - { - if (string.IsNullOrEmpty(value)) - return new SqlParameter(paramName, DBNull.Value); - - return new SqlParameter(paramName, value); - } - - public static IDataReader GetCrmUsers(int itemId, string sortColumn, string sortDirection, string name, string email, int startRow, int count ) - { - SqlParameter[] sqlParams = new SqlParameter[] - { - new SqlParameter("@ItemID", itemId), - new SqlParameter("@SortColumn", sortColumn), - new SqlParameter("@SortDirection", sortDirection), - GetFilterSqlParam("@Name", name), - GetFilterSqlParam("@Email", email), - new SqlParameter("@StartRow", startRow), - new SqlParameter("Count", count) - }; - - - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetCRMUsers", sqlParams); - } - - public static IDataReader GetCRMOrganizationUsers(int itemId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, "GetCRMOrganizationUsers", - new SqlParameter[] {new SqlParameter("@ItemID", itemId)}); - } - - public static void CreateCRMUser(int itemId, Guid crmId, Guid businessUnitId) - { - SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, "InsertCRMUser", - new SqlParameter[] - { - new SqlParameter("@ItemID", itemId), - new SqlParameter("@CrmUserID", crmId), - new SqlParameter("@BusinessUnitId", businessUnitId) - }); - - } - - - public static IDataReader GetCrmUser(int itemId) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, "GetCRMUser", - new SqlParameter[] - { - new SqlParameter("@AccountID", itemId) - }); - return reader; - - } - - public static int GetCrmUserCount(int itemId) - { - return (int)SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetOrganizationCRMUserCount", - new SqlParameter[] - { new SqlParameter("@ItemID",itemId)}); - } - - public static void DeleteCrmOrganization(int organizationId) - { - SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "DeleteCRMOrganization", - new SqlParameter[] { new SqlParameter("@ItemID", organizationId) }); - } - - #endregion - - #region VPS - Virtual Private Servers - - public static IDataReader GetVirtualMachinesPaged(int actorId, int packageId, string filterColumn, string filterValue, - string sortColumn, int startRow, int maximumRows, bool recursive) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetVirtualMachinesPaged", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@StartRow", startRow), - new SqlParameter("@MaximumRows", maximumRows), - new SqlParameter("@Recursive", recursive)); - return reader; - } - #endregion - - public static IDataReader GetVirtualMachinesForPCPaged(int actorId, int packageId, string filterColumn, string filterValue, - string sortColumn, int startRow, int maximumRows, bool recursive) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetVirtualMachinesPagedForPC", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@StartRow", startRow), - new SqlParameter("@MaximumRows", maximumRows), - new SqlParameter("@Recursive", recursive)); - return reader; - } - - - #region VPS - External Network - - public static IDataReader GetUnallottedIPAddresses(int packageId, int serviceId, int poolId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetUnallottedIPAddresses", - new SqlParameter("@PackageId", packageId), - new SqlParameter("@ServiceId", serviceId), - new SqlParameter("@PoolId", poolId)); - } - - - public static void AllocatePackageIPAddresses(int packageId, string xml) - { - SqlParameter[] param = new[] - { - new SqlParameter("@PackageID", packageId), - new SqlParameter("@xml", xml) - }; - - ExecuteLongNonQuery("AllocatePackageIPAddresses", param); - } - - public static IDataReader GetPackageIPAddresses(int packageId, int poolId, string filterColumn, string filterValue, - string sortColumn, int startRow, int maximumRows, bool recursive) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetPackageIPAddresses", - new SqlParameter("@PackageID", packageId), - new SqlParameter("@PoolId", poolId), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows), - new SqlParameter("@Recursive", recursive)); - return reader; - } - - - public static void DeallocatePackageIPAddress(int id) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, "DeallocatePackageIPAddress", - new SqlParameter("@PackageAddressID", id)); - } - #endregion - - #region VPS - Private Network - - public static IDataReader GetPackagePrivateIPAddressesPaged(int packageId, string filterColumn, string filterValue, - string sortColumn, int startRow, int maximumRows) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetPackagePrivateIPAddressesPaged", - new SqlParameter("@PackageID", packageId), - new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)), - new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)), - new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)), - new SqlParameter("@startRow", startRow), - new SqlParameter("@maximumRows", maximumRows)); - return reader; - } - - public static IDataReader GetPackagePrivateIPAddresses(int packageId) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetPackagePrivateIPAddresses", - new SqlParameter("@PackageID", packageId)); - return reader; - } - #endregion - - #region VPS - External Network Adapter - public static IDataReader GetPackageUnassignedIPAddresses(int actorId, int packageId, int poolId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetPackageUnassignedIPAddresses", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@PoolId", poolId)); - } - - public static IDataReader GetPackageIPAddress(int packageAddressId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetPackageIPAddress", - new SqlParameter("@PackageAddressId", packageAddressId)); - } - - public static IDataReader GetItemIPAddresses(int actorId, int itemId, int poolId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetItemIPAddresses", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId), - new SqlParameter("@PoolID", poolId)); - } - - public static int AddItemIPAddress(int actorId, int itemId, int packageAddressId) - { - return SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - "AddItemIPAddress", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId), - new SqlParameter("@PackageAddressID", packageAddressId)); - } - - public static int SetItemPrimaryIPAddress(int actorId, int itemId, int packageAddressId) - { - return SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - "SetItemPrimaryIPAddress", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId), - new SqlParameter("@PackageAddressID", packageAddressId)); - } - - public static int DeleteItemIPAddress(int actorId, int itemId, int packageAddressId) - { - return SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - "DeleteItemIPAddress", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId), - new SqlParameter("@PackageAddressID", packageAddressId)); - } - - public static int DeleteItemIPAddresses(int actorId, int itemId) - { - return SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - "DeleteItemIPAddresses", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId)); - } - #endregion - - #region VPS - Private Network Adapter - public static IDataReader GetItemPrivateIPAddresses(int actorId, int itemId) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - "GetItemPrivateIPAddresses", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId)); - } - - public static int AddItemPrivateIPAddress(int actorId, int itemId, string ipAddress) - { - return SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - "AddItemPrivateIPAddress", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId), - new SqlParameter("@IPAddress", ipAddress)); - } - - public static int SetItemPrivatePrimaryIPAddress(int actorId, int itemId, int privateAddressId) - { - return SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - "SetItemPrivatePrimaryIPAddress", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId), - new SqlParameter("@PrivateAddressID", privateAddressId)); - } - - public static int DeleteItemPrivateIPAddress(int actorId, int itemId, int privateAddressId) - { - return SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - "DeleteItemPrivateIPAddress", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId), - new SqlParameter("@PrivateAddressID", privateAddressId)); - } - - public static int DeleteItemPrivateIPAddresses(int actorId, int itemId) - { - return SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - "DeleteItemPrivateIPAddresses", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@ItemID", itemId)); - } - #endregion - - #region BlackBerry - - public static void AddBlackBerryUser(int accountId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, - CommandType.StoredProcedure, - "AddBlackBerryUser", - new[] - { - new SqlParameter("@AccountID", accountId) - }); - } - - - public static bool CheckBlackBerryUserExists(int accountId) - { - int res = (int)SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "CheckBlackBerryUserExists", - new SqlParameter("@AccountID", accountId)); - return res > 0; - } - - - public static IDataReader GetBlackBerryUsers(int itemId, string sortColumn, string sortDirection, string name, string email, int startRow, int count) - { - SqlParameter[] sqlParams = new SqlParameter[] - { - new SqlParameter("@ItemID", itemId), - new SqlParameter("@SortColumn", sortColumn), - new SqlParameter("@SortDirection", sortDirection), - GetFilterSqlParam("@Name", name), - GetFilterSqlParam("@Email", email), - new SqlParameter("@StartRow", startRow), - new SqlParameter("Count", count) - }; - - - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetBlackBerryUsers", sqlParams); - } - - public static int GetBlackBerryUsersCount(int itemId, string name, string email) - { - SqlParameter[] sqlParams = new SqlParameter[] - { - new SqlParameter("@ItemID", itemId), - GetFilterSqlParam("@Name", name), - GetFilterSqlParam("@Email", email), - }; - - return - (int) - SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetBlackBerryUsersCount", sqlParams); - } - - public static void DeleteBlackBerryUser(int accountId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, - CommandType.StoredProcedure, - "DeleteBlackBerryUser", - new[] - { - new SqlParameter("@AccountID", accountId) - }); - - } - - #endregion - - #region OCS - - public static void AddOCSUser(int accountId, string instanceId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, - CommandType.StoredProcedure, - "AddOCSUser", - new[] - { - new SqlParameter("@AccountID", accountId), - new SqlParameter("@InstanceID", instanceId) - }); - } - - - public static bool CheckOCSUserExists(int accountId) - { - int res = (int)SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "CheckOCSUserExists", - new SqlParameter("@AccountID", accountId)); - return res > 0; - } - - - public static IDataReader GetOCSUsers(int itemId, string sortColumn, string sortDirection, string name, string email, int startRow, int count) - { - SqlParameter[] sqlParams = new SqlParameter[] - { - new SqlParameter("@ItemID", itemId), - new SqlParameter("@SortColumn", sortColumn), - new SqlParameter("@SortDirection", sortDirection), - GetFilterSqlParam("@Name", name), - GetFilterSqlParam("@Email", email), - new SqlParameter("@StartRow", startRow), - new SqlParameter("Count", count) - }; - - - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetOCSUsers", sqlParams); - } - - public static int GetOCSUsersCount(int itemId, string name, string email) - { - SqlParameter[] sqlParams = new SqlParameter[] - { - new SqlParameter("@ItemID", itemId), - GetFilterSqlParam("@Name", name), - GetFilterSqlParam("@Email", email), - }; - - return - (int) - SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetOCSUsersCount", sqlParams); - } - - public static void DeleteOCSUser(string instanceId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, - CommandType.StoredProcedure, - "DeleteOCSUser", - new[] - { - new SqlParameter("@InstanceId", instanceId) - }); - - } - - public static string GetOCSUserInstanceID(int accountId) - { - return (string)SqlHelper.ExecuteScalar(ConnectionString, - CommandType.StoredProcedure, - "GetInstanceID", - new[] - { - new SqlParameter("@AccountID", accountId) - }); - } - - #endregion - - #region SSL - public static int AddSSLRequest(int actorId, int packageId, int siteID, int userID, string friendlyname, string hostname, string csr, int csrLength, string distinguishedName, bool isRenewal, int previousID) - { - SqlParameter prmId = new SqlParameter("@SSLID", SqlDbType.Int); - prmId.Direction = ParameterDirection.Output; - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddSSLRequest", prmId, - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageId", packageId), - new SqlParameter("@UserID", userID), - new SqlParameter("@WebSiteID", siteID), - new SqlParameter("@FriendlyName", friendlyname), - new SqlParameter("@HostName", hostname), - new SqlParameter("@CSR", csr), - new SqlParameter("@CSRLength", csrLength), - new SqlParameter("@DistinguishedName", distinguishedName), - new SqlParameter("@IsRenewal", isRenewal), - new SqlParameter("@PreviousId", previousID) - ); - return Convert.ToInt32(prmId.Value); - - } - - public static void CompleteSSLRequest(int actorId, int packageId, int id, string certificate, string distinguishedName, string serialNumber, byte[] hash, DateTime validFrom, DateTime expiryDate) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "CompleteSSLRequest", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@ID", id), - new SqlParameter("@DistinguishedName", distinguishedName), - new SqlParameter("@Certificate", certificate), - new SqlParameter("@SerialNumber", serialNumber), - new SqlParameter("@Hash", Convert.ToBase64String(hash)), - new SqlParameter("@ValidFrom", validFrom), - new SqlParameter("@ExpiryDate", expiryDate)); - - } - - public static void AddPFX(int actorId, int packageId, int siteID, int userID, string hostname, string friendlyName, string distinguishedName, int csrLength, string serialNumber, DateTime validFrom, DateTime expiryDate) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "AddPFX", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageId", packageId), - new SqlParameter("@UserID", userID), - new SqlParameter("@WebSiteID", siteID), - new SqlParameter("@FriendlyName", friendlyName), - new SqlParameter("@HostName", hostname), - new SqlParameter("@CSRLength", csrLength), - new SqlParameter("@DistinguishedName", distinguishedName), - new SqlParameter("@SerialNumber", serialNumber), - new SqlParameter("@ValidFrom", validFrom), - new SqlParameter("@ExpiryDate", expiryDate)); - - } - - public static DataSet GetSSL(int actorId, int packageId, int id) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetSSL", - new SqlParameter("@SSLID", id)); - - } - - public static DataSet GetCertificatesForSite(int actorId, int packageId, int siteId) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetCertificatesForSite", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageId", packageId), - new SqlParameter("@websiteid", siteId)); - - } - - public static DataSet GetPendingCertificates(int actorId, int packageId, int id, bool recursive) - { - return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetPendingSSLForWebsite", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@PackageId", packageId), - new SqlParameter("@websiteid", id), - new SqlParameter("@Recursive", recursive)); - - } - - public static IDataReader GetSSLCertificateByID(int actorId, int id) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetSSLCertificateByID", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@ID", id)); - } - - public static int CheckSSL(int siteID, bool renewal) - { - SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Int); - prmId.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "CheckSSL", - prmId, - new SqlParameter("@siteID", siteID), - new SqlParameter("@Renewal", renewal)); - - return Convert.ToInt32(prmId.Value); - } - - public static IDataReader GetSiteCert(int actorId, int siteID) - { - return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "GetSSLCertificateByID", - new SqlParameter("@ActorId", actorId), - new SqlParameter("@ID", siteID)); - } - - public static void DeleteCertificate(int actorId, int packageId, int id) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "DeleteCertificate", - new SqlParameter("@ActorID", actorId), - new SqlParameter("@PackageID", packageId), - new SqlParameter("@id", id)); - } - - public static bool CheckSSLExistsForWebsite(int siteId) - { - SqlParameter prmId = new SqlParameter("@Result", SqlDbType.Bit); - prmId.Direction = ParameterDirection.Output; - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, - ObjectQualifier + "CheckSSLExistsForWebsite", prmId, - new SqlParameter("@siteID", siteId), - new SqlParameter("@SerialNumber", "")); - return Convert.ToBoolean(prmId.Value); - } - #endregion - - #region Lync - - public static void AddLyncUser(int accountId, int lyncUserPlanId, string sipAddress) - { - SqlHelper.ExecuteNonQuery(ConnectionString, - CommandType.StoredProcedure, - "AddLyncUser", - new[] - { - new SqlParameter("@AccountID", accountId), - new SqlParameter("@LyncUserPlanID", lyncUserPlanId), - new SqlParameter("@SipAddress", sipAddress) - }); - } - - public static void UpdateLyncUser(int accountId, string sipAddress) - { - SqlHelper.ExecuteNonQuery(ConnectionString, - CommandType.StoredProcedure, - "UpdateLyncUser", - new[] - { - new SqlParameter("@AccountID", accountId), - new SqlParameter("@SipAddress", sipAddress) - }); - } - - - public static bool CheckLyncUserExists(int accountId) - { - int res = (int)SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "CheckLyncUserExists", - new SqlParameter("@AccountID", accountId)); - return res > 0; - } - - public static bool LyncUserExists(int accountId, string sipAddress) - { - SqlParameter outParam = new SqlParameter("@Exists", SqlDbType.Bit); - outParam.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "LyncUserExists", - new SqlParameter("@AccountID", accountId), - new SqlParameter("@SipAddress", sipAddress), - outParam - ); - - return Convert.ToBoolean(outParam.Value); - } - - - - public static IDataReader GetLyncUsers(int itemId, string sortColumn, string sortDirection, int startRow, int count) - { - SqlParameter[] sqlParams = new SqlParameter[] - { - new SqlParameter("@ItemID", itemId), - new SqlParameter("@SortColumn", sortColumn), - new SqlParameter("@SortDirection", sortDirection), - new SqlParameter("@StartRow", startRow), - new SqlParameter("Count", count) - }; - - - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetLyncUsers", sqlParams); - } - - - public static IDataReader GetLyncUsersByPlanId(int itemId, int planId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetLyncUsersByPlanId", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@PlanId", planId) - ); - } - - public static int GetLyncUsersCount(int itemId) - { - SqlParameter[] sqlParams = new SqlParameter[] - { - new SqlParameter("@ItemID", itemId) - }; - - return - (int) - SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, "GetLyncUsersCount", sqlParams); - } - - public static void DeleteLyncUser(int accountId) - { - SqlHelper.ExecuteNonQuery(ConnectionString, - CommandType.StoredProcedure, - "DeleteLyncUser", - new[] - { - new SqlParameter("@AccountId", accountId) - }); - - } - - public static int AddLyncUserPlan(int itemID, LyncUserPlan lyncUserPlan) - { - SqlParameter outParam = new SqlParameter("@LyncUserPlanId", SqlDbType.Int); - outParam.Direction = ParameterDirection.Output; - - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "AddLyncUserPlan", - outParam, - - new SqlParameter("@ItemID", itemID), - new SqlParameter("@LyncUserPlanName", lyncUserPlan.LyncUserPlanName), - new SqlParameter("@LyncUserPlanType", lyncUserPlan.LyncUserPlanType), - new SqlParameter("@IM", lyncUserPlan.IM), - new SqlParameter("@Mobility", lyncUserPlan.Mobility), - new SqlParameter("@MobilityEnableOutsideVoice", lyncUserPlan.MobilityEnableOutsideVoice), - new SqlParameter("@Federation", lyncUserPlan.Federation), - new SqlParameter("@Conferencing", lyncUserPlan.Conferencing), - new SqlParameter("@EnterpriseVoice", lyncUserPlan.EnterpriseVoice), - new SqlParameter("@VoicePolicy", lyncUserPlan.VoicePolicy), - new SqlParameter("@IsDefault", lyncUserPlan.IsDefault), - - new SqlParameter("@RemoteUserAccess", lyncUserPlan.RemoteUserAccess), - new SqlParameter("@PublicIMConnectivity", lyncUserPlan.PublicIMConnectivity), - - new SqlParameter("@AllowOrganizeMeetingsWithExternalAnonymous", lyncUserPlan.AllowOrganizeMeetingsWithExternalAnonymous), - - new SqlParameter("@Telephony", lyncUserPlan.Telephony), - - new SqlParameter("@ServerURI", lyncUserPlan.ServerURI), - - new SqlParameter("@ArchivePolicy", lyncUserPlan.ArchivePolicy), - new SqlParameter("@TelephonyDialPlanPolicy", lyncUserPlan.TelephonyDialPlanPolicy), - new SqlParameter("@TelephonyVoicePolicy", lyncUserPlan.TelephonyVoicePolicy) - ); - - return Convert.ToInt32(outParam.Value); - } - - - public static void UpdateLyncUserPlan(int itemID, LyncUserPlan lyncUserPlan) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "UpdateLyncUserPlan", - new SqlParameter("@LyncUserPlanId", lyncUserPlan.LyncUserPlanId), - new SqlParameter("@LyncUserPlanName", lyncUserPlan.LyncUserPlanName), - new SqlParameter("@LyncUserPlanType", lyncUserPlan.LyncUserPlanType), - new SqlParameter("@IM", lyncUserPlan.IM), - new SqlParameter("@Mobility", lyncUserPlan.Mobility), - new SqlParameter("@MobilityEnableOutsideVoice", lyncUserPlan.MobilityEnableOutsideVoice), - new SqlParameter("@Federation", lyncUserPlan.Federation), - new SqlParameter("@Conferencing", lyncUserPlan.Conferencing), - new SqlParameter("@EnterpriseVoice", lyncUserPlan.EnterpriseVoice), - new SqlParameter("@VoicePolicy", lyncUserPlan.VoicePolicy), - new SqlParameter("@IsDefault", lyncUserPlan.IsDefault), - - new SqlParameter("@RemoteUserAccess", lyncUserPlan.RemoteUserAccess), - new SqlParameter("@PublicIMConnectivity", lyncUserPlan.PublicIMConnectivity), - - new SqlParameter("@AllowOrganizeMeetingsWithExternalAnonymous", lyncUserPlan.AllowOrganizeMeetingsWithExternalAnonymous), - - new SqlParameter("@Telephony", lyncUserPlan.Telephony), - - new SqlParameter("@ServerURI", lyncUserPlan.ServerURI), - - new SqlParameter("@ArchivePolicy", lyncUserPlan.ArchivePolicy), - new SqlParameter("@TelephonyDialPlanPolicy", lyncUserPlan.TelephonyDialPlanPolicy), - new SqlParameter("@TelephonyVoicePolicy", lyncUserPlan.TelephonyVoicePolicy) - ); - } - - public static void DeleteLyncUserPlan(int lyncUserPlanId) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "DeleteLyncUserPlan", - new SqlParameter("@LyncUserPlanId", lyncUserPlanId) - ); - } - - public static IDataReader GetLyncUserPlan(int lyncUserPlanId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetLyncUserPlan", - new SqlParameter("@LyncUserPlanId", lyncUserPlanId) - ); - } - - - public static IDataReader GetLyncUserPlans(int itemId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetLyncUserPlans", - new SqlParameter("@ItemID", itemId) - ); - } - - - public static void SetOrganizationDefaultLyncUserPlan(int itemId, int lyncUserPlanId) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "SetOrganizationDefaultLyncUserPlan", - new SqlParameter("@ItemID", itemId), - new SqlParameter("@LyncUserPlanId", lyncUserPlanId) - ); - } - - public static IDataReader GetLyncUserPlanByAccountId(int AccountId) - { - return SqlHelper.ExecuteReader( - ConnectionString, - CommandType.StoredProcedure, - "GetLyncUserPlanByAccountId", - new SqlParameter("@AccountID", AccountId) - ); - } - - - public static void SetLyncUserLyncUserplan(int accountId, int lyncUserPlanId) - { - SqlHelper.ExecuteNonQuery( - ConnectionString, - CommandType.StoredProcedure, - "SetLyncUserLyncUserplan", - new SqlParameter("@AccountID", accountId), - new SqlParameter("@LyncUserPlanId", (lyncUserPlanId == 0) ? (object)DBNull.Value : (object)lyncUserPlanId) - ); - } - - - #endregion - - public static int GetPackageIdByName(string Name) - { - int packageId = -1; - List providers = ServerController.GetProviders(); - foreach (ProviderInfo providerInfo in providers) - { - if (string.Equals(Name, providerInfo.ProviderName, StringComparison.OrdinalIgnoreCase)) - { - packageId = providerInfo.ProviderId; - break; - } - } - - //if (-1 == packageId) - //{ - // throw new Exception("Provider not found"); - //} - - return packageId; - } - - public static int GetServiceIdByProviderForServer(int providerId, int serverId) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text, - @"SELECT TOP 1 - ServiceID - FROM Services - WHERE ProviderID = @ProviderID AND ServerID = @ServerID", - new SqlParameter("@ProviderID", providerId), - new SqlParameter("@ServerID", serverId)); - - if (reader.Read()) - { - return (int)reader["ServiceID"]; - } - - return -1; - } - - #region Helicon Zoo - - public static void GetHeliconZooProviderAndGroup(string providerName, out int providerId, out int groupId) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text, - @"SELECT TOP 1 - ProviderID, GroupID - FROM Providers - WHERE ProviderName = @ProviderName", - new SqlParameter("@ProviderName", providerName)); - - reader.Read(); - - providerId = (int) reader["ProviderID"]; - groupId = (int) reader["GroupID"]; - - } - - public static IDataReader GetHeliconZooQuotas(int providerId) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text, - @"SELECT - Q.QuotaID, - Q.GroupID, - Q.QuotaName, - Q.QuotaDescription, - Q.QuotaTypeID, - Q.ServiceQuota - FROM Providers AS P - INNER JOIN Quotas AS Q ON P.GroupID = Q.GroupID - WHERE P.ProviderID = @ProviderID", - new SqlParameter("@ProviderID", providerId)); - - return reader; - } - - public static void RemoveHeliconZooQuota(int groupId, string engineName) - { - int quotaId; - - // find quota id - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text, - @"SELECT TOP 1 - QuotaID - FROM Quotas - WHERE QuotaName = @QuotaName AND GroupID = @GroupID", - new SqlParameter("@QuotaName", engineName), - new SqlParameter("@GroupID", groupId)); - - reader.Read(); - quotaId = (int)reader["QuotaID"]; - - // delete references from HostingPlanQuotas - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.Text, - "DELETE FROM HostingPlanQuotas WHERE QuotaID = @QuotaID", - new SqlParameter("@QuotaID", quotaId) - ); - - // delete from Quotas - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.Text, - "DELETE FROM Quotas WHERE QuotaID = @QuotaID", - new SqlParameter("@QuotaID", quotaId) - ); - - } - - public static void AddHeliconZooQuota(int groupId, int quotaId, string engineName, string engineDescription, int quotaOrder) - { - SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.Text, - @"INSERT INTO Quotas (QuotaID, GroupID, QuotaOrder, QuotaName, QuotaDescription, QuotaTypeID, ServiceQuota) - VALUES (@QuotaID, @GroupID, @QuotaOrder, @QuotaName, @QuotaDescription, 1, 0)", - new SqlParameter("@QuotaID", quotaId), - new SqlParameter("@GroupID", groupId), - new SqlParameter("@QuotaOrder", quotaOrder), - new SqlParameter("@QuotaName", engineName), - new SqlParameter("@QuotaDescription", engineDescription) - ); - } - - public static IDataReader GetEnabledHeliconZooQuotasForPackage(int packageId) - { - int providerId, groupId; - - GetHeliconZooProviderAndGroup("HeliconZoo", out providerId, out groupId); - - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text, - @"SELECT HostingPlanQuotas.QuotaID, Quotas.QuotaName, Quotas.QuotaDescription - FROM HostingPlanQuotas - INNER JOIN Packages ON HostingPlanQuotas.PlanID = Packages.PlanID - INNER JOIN Quotas ON HostingPlanQuotas.QuotaID = Quotas.QuotaID - WHERE - (Packages.PackageID = @PackageID) AND (Quotas.GroupID = @GroupID) AND (HostingPlanQuotas.QuotaValue = 1)", - new SqlParameter("@PackageID", packageId), - new SqlParameter("@GroupID", groupId) - ); - - return reader; - } - - public static int GetServerIdForPackage(int packageId) - { - IDataReader reader = SqlHelper.ExecuteReader(ConnectionString, CommandType.Text, - @"SELECT TOP 1 - ServerID - FROM Packages - WHERE PackageID = @PackageID", - new SqlParameter("@PackageID", packageId) - ); - - if (reader.Read()) - { - return (int)reader["ServerID"]; - } - - return -1; - } - - #endregion - } -} diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs deleted file mode 100644 index 9652202e..00000000 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/LyncController.cs +++ /dev/null @@ -1,1088 +0,0 @@ -// Copyright (c) 2012, Outercurve Foundation. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// - Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// - Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// - Neither the name of the Outercurve Foundation nor the names of its -// contributors may be used to endorse or promote products derived from this -// software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Data; -using System.Xml; -using WebsitePanel.Providers; -using WebsitePanel.Providers.Common; -using WebsitePanel.Providers.HostedSolution; -using WebsitePanel.Providers.ResultObjects; -using WebsitePanel.Providers.Lync; - -namespace WebsitePanel.EnterpriseServer.Code.HostedSolution -{ - public class LyncController - { - - - public static LyncServer GetLyncServer(int lyncServiceId, int organizationServiceId) - { - LyncServer ws = new LyncServer(); - - ServiceProviderProxy.Init(ws, lyncServiceId); - - string[] lyncSettings = ws.ServiceProviderSettingsSoapHeaderValue.Settings; - - List resSettings = new List(lyncSettings); - - if (organizationServiceId != -1) - { - ExtendLyncSettings(resSettings, "primarydomaincontroller", GetProviderProperty(organizationServiceId, "primarydomaincontroller")); - ExtendLyncSettings(resSettings, "rootou", GetProviderProperty(organizationServiceId, "rootou")); - } - ws.ServiceProviderSettingsSoapHeaderValue.Settings = resSettings.ToArray(); - return ws; - } - - private static string GetProviderProperty(int organizationServiceId, string property) - { - - Organizations orgProxy = new Organizations(); - - ServiceProviderProxy.Init(orgProxy, organizationServiceId); - - string[] organizationSettings = orgProxy.ServiceProviderSettingsSoapHeaderValue.Settings; - - string value = string.Empty; - foreach (string str in organizationSettings) - { - string[] props = str.Split('='); - if (props[0].ToLower() == property) - { - value = str; - break; - } - } - - return value; - } - - private static void ExtendLyncSettings(List lyncSettings, string property, string value) - { - bool isAdded = false; - for (int i = 0; i < lyncSettings.Count; i++) - { - string[] props = lyncSettings[i].Split('='); - if (props[0].ToLower() == property) - { - lyncSettings[i] = value; - isAdded = true; - break; - } - } - - if (!isAdded) - { - lyncSettings.Add(value); - } - } - - private static int GetLyncServiceID(int packageId) - { - return PackageController.GetPackageServiceId(packageId, ResourceGroups.Lync); - } - - - private static bool CheckQuota(int itemId) - { - Organization org = OrganizationController.GetOrganization(itemId); - PackageContext cntx = PackageController.GetPackageContext(org.PackageId); - - IntResult userCount = GetLyncUsersCount(itemId); - - int allocatedUsers = cntx.Quotas[Quotas.LYNC_USERS].QuotaAllocatedValue; - - return allocatedUsers == -1 || allocatedUsers > userCount.Value; - } - - - public static LyncUserResult CreateLyncUser(int itemId, int accountId, int lyncUserPlanId) - { - LyncUserResult res = TaskManager.StartResultTask("LYNC", "CREATE_LYNC_USER"); - - int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); - if (accountCheck < 0) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.NOT_AUTHORIZED); - return res; - } - - - LyncUser retLyncUser = new LyncUser(); - bool isLyncUser; - - isLyncUser = DataProvider.CheckLyncUserExists(accountId); - if (isLyncUser) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.USER_IS_ALREADY_LYNC_USER); - return res; - } - - OrganizationUser user; - user = OrganizationController.GetAccount(itemId, accountId); - if (user == null) - { - TaskManager.CompleteResultTask(res, ErrorCodes.CANNOT_GET_ACCOUNT); - return res; - } - - user = OrganizationController.GetUserGeneralSettings(itemId, accountId); - if (string.IsNullOrEmpty(user.FirstName)) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.USER_FIRST_NAME_IS_NOT_SPECIFIED); - return res; - } - - if (string.IsNullOrEmpty(user.LastName)) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.USER_LAST_NAME_IS_NOT_SPECIFIED); - return res; - } - - bool quota = CheckQuota(itemId); - if (!quota) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.USER_QUOTA_HAS_BEEN_REACHED); - return res; - } - - - LyncServer lync; - - try - { - - bool bReloadConfiguration = false; - - Organization org = (Organization)PackageController.GetPackageItem(itemId); - if (org == null) - { - throw new ApplicationException( - string.Format("Organization is null. ItemId={0}", itemId)); - } - - int lyncServiceId = GetLyncServiceID(org.PackageId); - lync = GetLyncServer(lyncServiceId, org.ServiceId); - - if (string.IsNullOrEmpty(org.LyncTenantId)) - { - PackageContext cntx = PackageController.GetPackageContext(org.PackageId); - - org.LyncTenantId = lync.CreateOrganization(org.OrganizationId, - org.DefaultDomain, - Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue), - Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ALLOWVIDEO].QuotaAllocatedValue), - Convert.ToInt32(cntx.Quotas[Quotas.LYNC_MAXPARTICIPANTS].QuotaAllocatedValue), - Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_FEDERATION].QuotaAllocatedValue), - Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ENTERPRISEVOICE].QuotaAllocatedValue)); - - if (string.IsNullOrEmpty(org.LyncTenantId)) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ENABLE_ORG); - return res; - } - else - { - - DomainInfo domain = ServerController.GetDomain(org.DefaultDomain); - - //Add the service records - if (domain != null) - { - if (domain.ZoneItemId != 0) - { - ServerController.AddServiceDNSRecords(org.PackageId, ResourceGroups.Lync, domain, ""); - } - } - - PackageController.UpdatePackageItem(org); - - bReloadConfiguration = true; - } - } - - LyncUserPlan plan = GetLyncUserPlan(itemId, lyncUserPlanId); - - if (!lync.CreateUser(org.OrganizationId, user.UserPrincipalName, plan)) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER); - return res; - } - - if (bReloadConfiguration) - { - LyncControllerAsync userWorker = new LyncControllerAsync(); - userWorker.LyncServiceId = lyncServiceId; - userWorker.OrganizationServiceId = org.ServiceId; - userWorker.Enable_CsComputerAsync(); - } - } - catch (Exception ex) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER, ex); - return res; - } - - try - { - DataProvider.AddLyncUser(accountId, lyncUserPlanId, user.UserPrincipalName); - } - catch (Exception ex) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER_TO_DATABASE, ex); - return res; - } - - res.IsSuccess = true; - TaskManager.CompleteResultTask(); - return res; - - } - - - private static int[] ParseMultiSetting(int lyncServiceId, string settingName) - { - List retIds = new List(); - StringDictionary settings = ServerController.GetServiceSettings(lyncServiceId); - if (!String.IsNullOrEmpty(settings[settingName])) - { - string[] ids = settings[settingName].Split(','); - - int res; - foreach (string id in ids) - { - if (int.TryParse(id, out res)) - retIds.Add(res); - } - } - - if (retIds.Count == 0) - retIds.Add(lyncServiceId); - - return retIds.ToArray(); - - } - - - public static void GetLyncServices(int lyncServiceId, out int[] lyncServiceIds) - { - lyncServiceIds = ParseMultiSetting(lyncServiceId, "LyncServersServiceID"); - } - - - - public static LyncUser GetLyncUserGeneralSettings(int itemId, int accountId) - { - TaskManager.StartTask("LYNC", "GET_LYNC_USER_GENERAL_SETTINGS"); - - LyncUser user = null; - - try - { - Organization org = (Organization)PackageController.GetPackageItem(itemId); - if (org == null) - { - throw new ApplicationException( - string.Format("Organization is null. ItemId={0}", itemId)); - } - - int lyncServiceId = GetLyncServiceID(org.PackageId); - LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId); - - OrganizationUser usr; - usr = OrganizationController.GetAccount(itemId, accountId); - - if (usr != null) - user = lync.GetLyncUserGeneralSettings(org.OrganizationId, usr.UserPrincipalName); - - if (user != null) - { - LyncUserPlan plan = ObjectUtils.FillObjectFromDataReader(DataProvider.GetLyncUserPlanByAccountId(accountId)); - - if (plan != null) - { - user.LyncUserPlanId = plan.LyncUserPlanId; - user.LyncUserPlanName = plan.LyncUserPlanName; - } - } - } - catch (Exception ex) - { - throw TaskManager.WriteError(ex); - - } - TaskManager.CompleteTask(); - return user; - - } - - public static LyncUserResult SetLyncUserGeneralSettings(int itemId, int accountId, string sipAddress, string lineUri) - { - LyncUserResult res = TaskManager.StartResultTask("LYNC", "SET_LYNC_USER_GENERAL_SETTINGS"); - - string PIN = ""; - - string[] uriAndPin = ("" + lineUri).Split(':'); - - if (uriAndPin.Length > 0) lineUri = uriAndPin[0]; - if (uriAndPin.Length > 1) PIN = uriAndPin[1]; - - LyncUser user = null; - - try - { - Organization org = (Organization)PackageController.GetPackageItem(itemId); - if (org == null) - { - throw new ApplicationException( - string.Format("Organization is null. ItemId={0}", itemId)); - } - - int lyncServiceId = GetLyncServiceID(org.PackageId); - LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId); - - OrganizationUser usr; - usr = OrganizationController.GetAccount(itemId, accountId); - - if (usr != null) - user = lync.GetLyncUserGeneralSettings(org.OrganizationId, usr.UserPrincipalName); - - if (user != null) - { - LyncUserPlan plan = ObjectUtils.FillObjectFromDataReader(DataProvider.GetLyncUserPlanByAccountId(accountId)); - - if (plan != null) - { - user.LyncUserPlanId = plan.LyncUserPlanId; - user.LyncUserPlanName = plan.LyncUserPlanName; - } - - - if (!string.IsNullOrEmpty(sipAddress)) - { - if (user.SipAddress != sipAddress) - { - if (sipAddress != usr.UserPrincipalName) - { - if (DataProvider.LyncUserExists(accountId, sipAddress)) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.ADDRESS_ALREADY_USED); - return res; - } - } - user.SipAddress = sipAddress; - } - } - - user.LineUri = lineUri; - user.PIN = PIN; - - lync.SetLyncUserGeneralSettings(org.OrganizationId, usr.UserPrincipalName, user); - - DataProvider.UpdateLyncUser(accountId, sipAddress); - } - } - catch (Exception ex) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.FAILED_SET_SETTINGS, ex); - return res; - } - - res.IsSuccess = true; - TaskManager.CompleteResultTask(); - return res; - - } - - - public static int DeleteOrganization(int itemId) - { - // check account - int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); - if (accountCheck < 0) return accountCheck; - - // place log record - TaskManager.StartTask("LYNC", "DELETE_ORG"); - TaskManager.ItemId = itemId; - - try - { - // delete organization in Exchange - //System.Threading.Thread.Sleep(5000); - Organization org = (Organization)PackageController.GetPackageItem(itemId); - - int lyncServiceId = GetLyncServiceID(org.PackageId); - LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId); - - bool successful = lync.DeleteOrganization(org.OrganizationId, org.DefaultDomain); - - return successful ? 0 : BusinessErrorCodes.ERROR_LYNC_DELETE_SOME_PROBLEMS; - } - catch (Exception ex) - { - throw TaskManager.WriteError(ex); - } - finally - { - TaskManager.CompleteTask(); - } - } - - - public static LyncUserResult SetUserLyncPlan(int itemId, int accountId, int lyncUserPlanId) - { - LyncUserResult res = TaskManager.StartResultTask("LYNC", "SET_LYNC_USER_LYNCPLAN"); - - int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); - if (accountCheck < 0) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.NOT_AUTHORIZED); - return res; - } - - try - { - Organization org = (Organization)PackageController.GetPackageItem(itemId); - if (org == null) - { - throw new ApplicationException( - string.Format("Organization is null. ItemId={0}", itemId)); - } - - int lyncServiceId = GetLyncServiceID(org.PackageId); - LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId); - - LyncUserPlan plan = GetLyncUserPlan(itemId, lyncUserPlanId); - - OrganizationUser user; - user = OrganizationController.GetAccount(itemId, accountId); - - if (!lync.SetLyncUserPlan(org.OrganizationId, user.UserPrincipalName, plan)) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER); - return res; - } - - try - { - DataProvider.SetLyncUserLyncUserplan(accountId, lyncUserPlanId); - } - catch (Exception ex) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_USER_TO_DATABASE, ex); - return res; - } - - res.IsSuccess = true; - TaskManager.CompleteResultTask(); - return res; - } - catch (Exception ex) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_UPDATE_LYNC_USER, ex); - return res; - } - - } - - public static LyncUsersPagedResult GetLyncUsers(int itemId) - { - return GetLyncUsersPaged(itemId, string.Empty, string.Empty, 0, int.MaxValue); - } - - public static LyncUsersPagedResult GetLyncUsersPaged(int itemId, string sortColumn, string sortDirection, int startRow, int count) - { - LyncUsersPagedResult res = TaskManager.StartResultTask("LYNC", "GET_LYNC_USERS"); - - try - { - IDataReader reader = - DataProvider.GetLyncUsers(itemId, sortColumn, sortDirection, startRow, count); - List accounts = new List(); - ObjectUtils.FillCollectionFromDataReader(accounts, reader); - res.Value = new LyncUsersPaged { PageUsers = accounts.ToArray() }; - } - catch (Exception ex) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.GET_LYNC_USERS, ex); - return res; - } - - IntResult intRes = GetLyncUsersCount(itemId); - res.ErrorCodes.AddRange(intRes.ErrorCodes); - if (!intRes.IsSuccess) - { - TaskManager.CompleteResultTask(res); - return res; - } - res.Value.RecordsCount = intRes.Value; - - TaskManager.CompleteResultTask(); - return res; - } - - public static List GetLyncUsersByPlanId(int itemId, int planId) - { - return ObjectUtils.CreateListFromDataReader(DataProvider.GetLyncUsersByPlanId(itemId, planId)); - } - - public static IntResult GetLyncUsersCount(int itemId) - { - IntResult res = TaskManager.StartResultTask("LYNC", "GET_LYNC_USERS_COUNT"); - try - { - res.Value = DataProvider.GetLyncUsersCount(itemId); - } - catch (Exception ex) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.GET_LYNC_USER_COUNT, ex); - return res; - } - - TaskManager.CompleteResultTask(); - return res; - } - - public static LyncUserResult DeleteLyncUser(int itemId, int accountId) - { - LyncUserResult res = TaskManager.StartResultTask("LYNC", "DELETE_LYNC_USER"); - int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); - - if (accountCheck < 0) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.NOT_AUTHORIZED); - return res; - } - - LyncServer lync; - - try - { - Organization org = (Organization)PackageController.GetPackageItem(itemId); - if (org == null) - { - throw new ApplicationException( - string.Format("Organization is null. ItemId={0}", itemId)); - } - - int lyncServiceId = GetLyncServiceID(org.PackageId); - lync = GetLyncServer(lyncServiceId, org.ServiceId); - - OrganizationUser user; - user = OrganizationController.GetAccount(itemId, accountId); - - if (user != null) - lync.DeleteUser(user.UserPrincipalName); - } - catch (Exception ex) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_DELETE_LYNC_USER, ex); - return res; - } - - try - { - DataProvider.DeleteLyncUser(accountId); - } - catch (Exception ex) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_DELETE_LYNC_USER_FROM_METADATA, ex); - return res; - } - - TaskManager.CompleteResultTask(); - return res; - } - - - public static Organization GetOrganization(int itemId) - { - return (Organization)PackageController.GetPackageItem(itemId); - } - - - #region Lync Plans - public static List GetLyncUserPlans(int itemId) - { - // place log record - TaskManager.StartTask("LYNC", "GET_LYNC_LYNCUSERPLANS"); - TaskManager.ItemId = itemId; - - try - { - List plans = new List(); - - UserInfo user = ObjectUtils.FillObjectFromDataReader(DataProvider.GetUserByExchangeOrganizationIdInternally(itemId)); - - if (user.Role == UserRole.User) - LyncController.GetLyncUserPlansByUser(itemId, user, ref plans); - else - LyncController.GetLyncUserPlansByUser(0, user, ref plans); - - - ExchangeOrganization ExchangeOrg = ObjectUtils.FillObjectFromDataReader(DataProvider.GetExchangeOrganization(itemId)); - - if (ExchangeOrg != null) - { - foreach (LyncUserPlan p in plans) - { - p.IsDefault = (p.LyncUserPlanId == ExchangeOrg.LyncUserPlanID); - } - } - - - return plans; - } - catch (Exception ex) - { - throw TaskManager.WriteError(ex); - } - finally - { - TaskManager.CompleteTask(); - } - } - - private static void GetLyncUserPlansByUser(int itemId, UserInfo user, ref List plans) - { - if ((user != null)) - { - List orgs = null; - - if (user.UserId != 1) - { - List Packages = PackageController.GetPackages(user.UserId); - - if ((Packages != null) & (Packages.Count > 0)) - { - orgs = ExchangeServerController.GetExchangeOrganizationsInternal(Packages[0].PackageId, false); - } - } - else - { - orgs = ExchangeServerController.GetExchangeOrganizationsInternal(1, false); - } - - int OrgId = -1; - if (itemId > 0) OrgId = itemId; - else if ((orgs != null) & (orgs.Count > 0)) OrgId = orgs[0].Id; - - if (OrgId != -1) - { - List Plans = ObjectUtils.CreateListFromDataReader(DataProvider.GetLyncUserPlans(OrgId)); - - foreach (LyncUserPlan p in Plans) - { - plans.Add(p); - } - } - - UserInfo owner = UserController.GetUserInternally(user.OwnerId); - - GetLyncUserPlansByUser(0, owner, ref plans); - } - } - - - public static LyncUserPlan GetLyncUserPlan(int itemID, int lyncUserPlanId) - { - - // place log record - TaskManager.StartTask("LYNC", "GET_LYNC_LYNCUSERPLAN"); - TaskManager.ItemId = lyncUserPlanId; - - try - { - return ObjectUtils.FillObjectFromDataReader( - DataProvider.GetLyncUserPlan(lyncUserPlanId)); - } - catch (Exception ex) - { - throw TaskManager.WriteError(ex); - } - finally - { - TaskManager.CompleteTask(); - } - } - - public static int AddLyncUserPlan(int itemID, LyncUserPlan lyncUserPlan) - { - int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); - if (accountCheck < 0) return accountCheck; - - // place log record - TaskManager.StartTask("LYNC", "ADD_LYNC_LYNCUSERPLAN"); - TaskManager.ItemId = itemID; - - try - { - Organization org = GetOrganization(itemID); - if (org == null) - return -1; - - // load package context - PackageContext cntx = PackageController.GetPackageContext(org.PackageId); - - lyncUserPlan.Conferencing = lyncUserPlan.Conferencing & Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue); - lyncUserPlan.EnterpriseVoice = lyncUserPlan.EnterpriseVoice & Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ENTERPRISEVOICE].QuotaAllocatedValue); - if (!lyncUserPlan.EnterpriseVoice) - lyncUserPlan.VoicePolicy = LyncVoicePolicyType.None; - lyncUserPlan.IM = true; - - return DataProvider.AddLyncUserPlan(itemID, lyncUserPlan); - } - catch (Exception ex) - { - throw TaskManager.WriteError(ex); - } - finally - { - TaskManager.CompleteTask(); - } - - } - - - - - - public static int UpdateLyncUserPlan(int itemID, LyncUserPlan lyncUserPlan) - { - int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); - if (accountCheck < 0) return accountCheck; - - // place log record - TaskManager.StartTask("LYNC", "ADD_LYNC_LYNCUSERPLAN"); - TaskManager.ItemId = itemID; - - try - { - Organization org = GetOrganization(itemID); - if (org == null) - return -1; - - // load package context - PackageContext cntx = PackageController.GetPackageContext(org.PackageId); - - lyncUserPlan.Conferencing = lyncUserPlan.Conferencing & Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue); - lyncUserPlan.EnterpriseVoice = lyncUserPlan.EnterpriseVoice & Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ENTERPRISEVOICE].QuotaAllocatedValue); - if (!lyncUserPlan.EnterpriseVoice) - lyncUserPlan.VoicePolicy = LyncVoicePolicyType.None; - lyncUserPlan.IM = true; - - DataProvider.UpdateLyncUserPlan(itemID, lyncUserPlan); - } - catch (Exception ex) - { - throw TaskManager.WriteError(ex); - } - finally - { - TaskManager.CompleteTask(); - } - - - return 0; - } - - - public static int DeleteLyncUserPlan(int itemID, int lyncUserPlanId) - { - int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); - if (accountCheck < 0) return accountCheck; - - TaskManager.StartTask("LYNC", "DELETE_LYNC_LYNCPLAN"); - TaskManager.ItemId = itemID; - - try - { - DataProvider.DeleteLyncUserPlan(lyncUserPlanId); - - return 0; - } - catch (Exception ex) - { - throw TaskManager.WriteError(ex); - } - finally - { - TaskManager.CompleteTask(); - } - - } - - public static int SetOrganizationDefaultLyncUserPlan(int itemId, int lyncUserPlanId) - { - int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); - if (accountCheck < 0) return accountCheck; - - TaskManager.StartTask("LYNC", "SET_LYNC_LYNCUSERPLAN"); - TaskManager.ItemId = itemId; - - try - { - DataProvider.SetOrganizationDefaultLyncUserPlan(itemId, lyncUserPlanId); - - } - catch (Exception ex) - { - throw TaskManager.WriteError(ex); - } - finally - { - TaskManager.CompleteTask(); - } - - return 1; - - } - - #endregion - - #region Federation Domains - public static LyncFederationDomain[] GetFederationDomains(int itemId) - { - // place log record - TaskManager.StartTask("LYNC", "GET_LYNC_FEDERATIONDOMAINS"); - TaskManager.ItemId = itemId; - - LyncFederationDomain[] lyncFederationDomains = null; - - try - { - Organization org = (Organization)PackageController.GetPackageItem(itemId); - - int lyncServiceId = GetLyncServiceID(org.PackageId); - LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId); - - lyncFederationDomains = lync.GetFederationDomains(org.OrganizationId); - } - catch (Exception ex) - { - throw TaskManager.WriteError(ex); - } - finally - { - TaskManager.CompleteTask(); - } - - return lyncFederationDomains; - } - - public static LyncUserResult AddFederationDomain(int itemId, string domainName, string proxyFqdn) - { - LyncUserResult res = TaskManager.StartResultTask("LYNC", "ADD_LYNC_FEDERATIONDOMAIN"); - TaskManager.ItemId = itemId; - TaskManager.TaskParameters["domainName"] = domainName; - TaskManager.TaskParameters["proxyFqdn"] = proxyFqdn; - - int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); - - if (accountCheck < 0) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.NOT_AUTHORIZED); - return res; - } - - - try - { - - Organization org = (Organization)PackageController.GetPackageItem(itemId); - if (org == null) - { - throw new ApplicationException( - string.Format("Organization is null. ItemId={0}", itemId)); - } - - int lyncServiceId = GetLyncServiceID(org.PackageId); - LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId); - - if (string.IsNullOrEmpty(org.LyncTenantId)) - { - PackageContext cntx = PackageController.GetPackageContext(org.PackageId); - - org.LyncTenantId = lync.CreateOrganization(org.OrganizationId, - org.DefaultDomain, - Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_CONFERENCING].QuotaAllocatedValue), - Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ALLOWVIDEO].QuotaAllocatedValue), - Convert.ToInt32(cntx.Quotas[Quotas.LYNC_MAXPARTICIPANTS].QuotaAllocatedValue), - Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_FEDERATION].QuotaAllocatedValue), - Convert.ToBoolean(cntx.Quotas[Quotas.LYNC_ENTERPRISEVOICE].QuotaAllocatedValue)); - - if (string.IsNullOrEmpty(org.LyncTenantId)) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ENABLE_ORG); - return res; - } - else - PackageController.UpdatePackageItem(org); - } - - lync = GetLyncServer(lyncServiceId, org.ServiceId); - - bool bDomainExists = false; - LyncFederationDomain[] domains = GetFederationDomains(itemId); - foreach (LyncFederationDomain d in domains) - { - if (d.DomainName.ToLower() == domainName.ToLower()) - { - bDomainExists = true; - break; - } - - } - - if (!bDomainExists) - lync.AddFederationDomain(org.OrganizationId, domainName.ToLower(), proxyFqdn); - } - catch (Exception ex) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_ADD_LYNC_FEDERATIONDOMAIN, ex); - return res; - } - - TaskManager.CompleteResultTask(); - return res; - } - - public static LyncUserResult RemoveFederationDomain(int itemId, string domainName) - { - LyncUserResult res = TaskManager.StartResultTask("LYNC", "REMOVE_LYNC_FEDERATIONDOMAIN"); - TaskManager.ItemId = itemId; - TaskManager.TaskParameters["domainName"] = domainName; - - int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive); - - if (accountCheck < 0) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.NOT_AUTHORIZED); - return res; - } - - try - { - Organization org = (Organization)PackageController.GetPackageItem(itemId); - if (org == null) - { - throw new ApplicationException( - string.Format("Organization is null. ItemId={0}", itemId)); - } - - int lyncServiceId = GetLyncServiceID(org.PackageId); - LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId); - - if (org.OrganizationId.ToLower() == domainName.ToLower()) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_REMOVE_LYNC_FEDERATIONDOMAIN); - return res; - } - - lync.RemoveFederationDomain(org.OrganizationId, domainName); - } - catch (Exception ex) - { - TaskManager.CompleteResultTask(res, LyncErrorCodes.CANNOT_REMOVE_LYNC_FEDERATIONDOMAIN, ex); - return res; - } - - TaskManager.CompleteResultTask(); - return res; - } - - - #endregion - - public static string[] GetPolicyList(int itemId, LyncPolicyType type, string name) - { - string[] ret = null; - try - { - if (itemId == -1) - { - // policy list in all lync servers - List allpolicylist = new List(); - List servers = ServerController.GetAllServers(); - foreach (ServerInfo server in servers) - { - List services = ServerController.GetServicesByServerIdGroupName(server.ServerId, ResourceGroups.Lync); - foreach (ServiceInfo service in services) - { - LyncServer lync = GetLyncServer(service.ServiceId, -1); - string[] values = lync.GetPolicyList(type, name); - foreach (string val in values) - if (allpolicylist.IndexOf(val) == -1) - allpolicylist.Add(val); - } - - } - ret = allpolicylist.ToArray(); - } - else - { - - Organization org = (Organization)PackageController.GetPackageItem(itemId); - - int lyncServiceId = GetLyncServiceID(org.PackageId); - LyncServer lync = GetLyncServer(lyncServiceId, org.ServiceId); - - ret = lync.GetPolicyList(type, name); - } - } - catch (Exception ex) - { - } - finally - { - } - - return ret; - } - - #region Private methods - public static UInt64 ConvertPhoneNumberToLong(string ip) - { - return Convert.ToUInt64(ip); - } - - public static string ConvertLongToPhoneNumber(UInt64 ip) - { - if (ip == 0) - return ""; - - return ip.ToString(); - } - #endregion - - - } -} From f17301bfc1f73427040fd4443be8d238f56dfdcd Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Thu, 15 Aug 2013 15:51:12 +0400 Subject: [PATCH 5/8] Fixed logging bugs --- .../WebsitePanel.EnterpriseServer/Web.config | 44 +++++++++---------- .../HostedSolutionLog.cs | 10 +++++ 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config index 7a73a914..3a721fdd 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config @@ -1,58 +1,58 @@ - + -
+
- + - + - + - + - - - + + + - + - + - + - - - + + + - + - + - + - - + + - + - + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/HostedSolutionLog.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/HostedSolutionLog.cs index 93b39b45..83257a78 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/HostedSolutionLog.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution/HostedSolutionLog.cs @@ -50,12 +50,22 @@ namespace WebsitePanel.Providers.HostedSolution Log.WriteEnd("{0} {1}", LogPrefix, text); } + public static void LogInfo(string message) + { + Log.WriteInfo("{0} {1}", LogPrefix, message); + } + public static void LogInfo(string message, params object[] args) { string text = String.Format(message, args); Log.WriteInfo("{0} {1}", LogPrefix, text); } + public static void LogWarning(string message) + { + Log.WriteWarning("{0} {1}", LogPrefix, message); + } + public static void LogWarning(string message, params object[] args) { string text = String.Format(message, args); From 7e8b3cce52b94e31c1a2b33cb0e2a3b54dbc4538 Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Wed, 21 Aug 2013 17:54:59 +0400 Subject: [PATCH 6/8] Added global phone list --- .../Servers/IPAddressPool.cs | 3 +- .../Servers/ServerController.cs | 73 +++--- .../App_Data/ModulesData.config | 5 +- .../App_Data/WebsitePanel_Modules.config | 20 +- .../App_Data/WebsitePanel_Pages.config | 16 ++ .../WebsitePanel_Modules.ascx.resx | 13 +- .../WebsitePanel_Pages.ascx.resx | 12 + .../WebsitePanel_SharedResources.ascx.resx | 20 +- .../LyncAllocatePhoneNumbers.ascx.resx | 126 ++++++++++ .../LyncPhoneNumbers.ascx.resx | 126 ++++++++++ .../App_LocalResources/PhoneNumbers.ascx.resx | 204 +++++++++++++++++ .../PhoneNumbersAddPhoneNumber.ascx.resx | 172 ++++++++++++++ .../PhoneNumbersEditPhoneNumber.ascx.resx | 165 ++++++++++++++ ...DisclaimerGeneralSettings.ascx.designer.cs | 109 +++++---- .../WebsitePanel/Lync/LyncCreateUser.ascx | 5 +- .../WebsitePanel/Lync/LyncCreateUser.ascx.cs | 24 +- .../Lync/LyncCreateUser.ascx.designer.cs | 64 ++++-- .../WebsitePanel/Lync/LyncEditUser.ascx | 5 +- .../WebsitePanel/Lync/LyncEditUser.ascx.cs | 29 ++- .../Lync/LyncEditUser.ascx.designer.cs | 74 ++++-- .../LyncAllocatePhoneNumbers.ascx | 11 + .../LyncAllocatePhoneNumbers.ascx.cs | 44 ++++ .../LyncAllocatePhoneNumbers.ascx.designer.cs | 25 ++ .../WebsitePanel/LyncPhoneNumbers.ascx | 30 +++ .../WebsitePanel/LyncPhoneNumbers.ascx.cs | 43 ++++ .../LyncPhoneNumbers.ascx.designer.cs | 65 ++++++ .../WebsitePanel/PhoneNumbers.ascx | 100 ++++++++ .../WebsitePanel/PhoneNumbers.ascx.cs | 157 +++++++++++++ .../PhoneNumbers.ascx.designer.cs | 106 +++++++++ .../PhoneNumbersAddPhoneNumber.ascx | 43 ++++ .../PhoneNumbersAddPhoneNumber.ascx.cs | 173 ++++++++++++++ ...honeNumbersAddPhoneNumber.ascx.designer.cs | 166 ++++++++++++++ .../PhoneNumbersEditPhoneNumber.ascx | 38 ++++ .../PhoneNumbersEditPhoneNumber.ascx.cs | 176 ++++++++++++++ ...oneNumbersEditPhoneNumber.ascx.designer.cs | 136 +++++++++++ .../CRM2011_Settings.ascx.designer.cs | 74 +++--- .../AllocatePackagePhoneNumbers.ascx | 71 ++++++ .../AllocatePackagePhoneNumbers.ascx.cs | 174 ++++++++++++++ ...locatePackagePhoneNumbers.ascx.designer.cs | 215 ++++++++++++++++++ .../AllocatePackagePhoneNumbers.ascx.resx | 153 +++++++++++++ .../PackagePhoneNumbers.ascx.resx | 165 ++++++++++++++ .../UserControls/PackagePhoneNumbers.ascx | 87 +++++++ .../UserControls/PackagePhoneNumbers.ascx.cs | 172 ++++++++++++++ .../PackagePhoneNumbers.ascx.designer.cs | 75 ++++++ .../WebsitePanel/WebSitesIPAddresses.ascx.cs | 1 - .../WebsitePanel.Portal.Modules.csproj | 71 ++++++ 46 files changed, 3667 insertions(+), 169 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncAllocatePhoneNumbers.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncPhoneNumbers.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbers.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersAddPhoneNumber.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersEditPhoneNumber.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.designer.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/AllocatePackagePhoneNumbers.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/PackagePhoneNumbers.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/IPAddressPool.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/IPAddressPool.cs index d2a3656a..67a74266 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/IPAddressPool.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/IPAddressPool.cs @@ -38,6 +38,7 @@ namespace WebsitePanel.EnterpriseServer General = 1, WebSites = 2, VpsExternalNetwork = 3, - VpsManagementNetwork = 4 + VpsManagementNetwork = 4, + PhoneNumbers = 5 } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs index 61e838a6..39e13c75 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Servers/ServerController.cs @@ -965,38 +965,59 @@ namespace WebsitePanel.EnterpriseServer return res; } - var startExternalIP = IPAddress.Parse(externalIP); - var startInternalIP = IPAddress.Parse(internalIP); - var endExternalIP = IPAddress.Parse(endIP); - - // handle CIDR notation IP/Subnet addresses - if (startExternalIP.IsSubnet && endExternalIP == null) { - endExternalIP = startExternalIP.LastSubnetIP; - startExternalIP = startExternalIP.FirstSubnetIP; - } - - if (startExternalIP.V6 != startInternalIP.V6 && (startExternalIP.V6 != endExternalIP.V6 && endExternalIP != null)) throw new NotSupportedException("All IP addresses must be either V4 or V6."); - - int i = 0; - long step = ((endExternalIP - startExternalIP) > 0) ? 1 : -1; - - while (true) + if (pool == IPAddressPool.PhoneNumbers) { - if (i > MaxSubnet) - break; + string phoneFormat = "D" + Math.Max(externalIP.Length, endIP.Length); - // add IP address - DataProvider.AddIPAddress((int)pool, serverId, startExternalIP.ToString(), startInternalIP.ToString(), subnetMask, defaultGateway, comments); + UInt64 start = UInt64.Parse(externalIP); + UInt64 end = UInt64.Parse(endIP); - if (startExternalIP == endExternalIP) - break; + if (end < start) { UInt64 temp = start; start = end; end = temp; } - i++; + const UInt64 maxPhones = 1000; // TODO max? - startExternalIP += step; + end = Math.Min(end, start + maxPhones); - if (startInternalIP != 0) - startInternalIP += step; + for (UInt64 number = start; number <= end; number++) + DataProvider.AddIPAddress((int)pool, serverId, number.ToString(phoneFormat), "", subnetMask, defaultGateway, comments); + } + + else + { + var startExternalIP = IPAddress.Parse(externalIP); + var startInternalIP = IPAddress.Parse(internalIP); + var endExternalIP = IPAddress.Parse(endIP); + + // handle CIDR notation IP/Subnet addresses + if (startExternalIP.IsSubnet && endExternalIP == null) + { + endExternalIP = startExternalIP.LastSubnetIP; + startExternalIP = startExternalIP.FirstSubnetIP; + } + + if (startExternalIP.V6 != startInternalIP.V6 && (startExternalIP.V6 != endExternalIP.V6 && endExternalIP != null)) throw new NotSupportedException("All IP addresses must be either V4 or V6."); + + int i = 0; + long step = ((endExternalIP - startExternalIP) > 0) ? 1 : -1; + + while (true) + { + if (i > MaxSubnet) + break; + + // add IP address + DataProvider.AddIPAddress((int)pool, serverId, startExternalIP.ToString(), startInternalIP.ToString(), subnetMask, defaultGateway, comments); + + if (startExternalIP == endExternalIP) + break; + + i++; + + startExternalIP += step; + + if (startInternalIP != 0) + startInternalIP += step; + } } } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config index b2602ecb..c7d2f0d6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ModulesData.config @@ -81,7 +81,10 @@ - + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index 63db8671..fd56bbb9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -160,7 +160,17 @@ - + + + + + + + + + + + @@ -264,7 +274,13 @@ - + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config index e6277aa7..bb162c93 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Pages.config @@ -212,6 +212,17 @@ + + + + + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx index 4d4e954b..2a1aabc9 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Modules.ascx.resx @@ -771,8 +771,19 @@ System Hard Quota - Helicon Zoo + + Phone Numbers + + + Add Phone Numbers + + + Edit Phone numbers + + + Phone Numbers + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx index 6b30cf6d..6e584424 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_Pages.ascx.resx @@ -462,4 +462,16 @@ System Hard Quota + + Phone Numbers + + + {user} - {space} - Phone Numbers + + + Phone Numbers + + + Phone Numbers + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index 09d7a912..e6c16978 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -3112,7 +3112,6 @@ Failed to update user login name. - Mailbox primary e-mail address has been changed. @@ -3365,7 +3364,6 @@ Please note not all email address are deleted - There are no public folders to delete @@ -3954,9 +3952,6 @@ IP Address could not be deleted - - IP Address could not be deleted because it is being used by Virtual Private Server. - Cannot add network adapter IP addresses @@ -5313,4 +5308,19 @@ By clicking on the button 'Apply', you will apply the respective hard quota on each provisioned home folder. Note that this may take some time. + + Error adding Phone number + + + Cannot add Phone numbers range. + + + The following errors have been occurred: + + + Phone number have been successfully deallocated. + + + At least one Phone number must be selected. + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncAllocatePhoneNumbers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncAllocatePhoneNumbers.ascx.resx new file mode 100644 index 00000000..1cf75868 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncAllocatePhoneNumbers.ascx.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Number of Phone Numbers: + + + Quotas + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncPhoneNumbers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncPhoneNumbers.ascx.resx new file mode 100644 index 00000000..1cf75868 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/LyncPhoneNumbers.ascx.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Number of Phone Numbers: + + + Quotas + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbers.ascx.resx new file mode 100644 index 00000000..8b997d67 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbers.ascx.resx @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add + + + Numbers + + + NAT Address + + + Server + + + User + + + Comments + + + No Phone Numbers found in the selected Pool. + + + Numbers + + + NAT Address + + + Server Name + + + Username + + + VPS + + + Default Gateway + + + VPS External Network IP + + + VPS Management Network IP + + + Web Sites IP + + + General IP + + + Page size: + + + Pool: + + + return confirm('Delete selected?'); + + + Delete selected + + + Edit selected... + + + Item + + + Space + + + User + + + Default Gateway + + + Item Name + + + Phone Numbers + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersAddPhoneNumber.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersAddPhoneNumber.ascx.resx new file mode 100644 index 00000000..4be33be2 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersAddPhoneNumber.ascx.resx @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + IP Address: + + + NAT Address: + + + Server: + + + Comments: + + + Add + + + Cancel + + + <Not Assigned> + + + Settings: + + + to + + + Default Gateway: + + + Subnet Mask: + + + General IP + + + VPS External Network IP + + + VPS Management Network IP + + + Web Sites IP + + + + Phone Numbers + + + Phone Numbers: + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersEditPhoneNumber.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersEditPhoneNumber.ascx.resx new file mode 100644 index 00000000..4411a1aa --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/PhoneNumbersEditPhoneNumber.ascx.resx @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Server: + + + Comments: + + + Update + + + Cancel + + + <Not Assigned> + + + Default Gateway: + + + Subnet Mask: + + + General IP + + + VPS External Network IP + + + VPS Management Network IP + + + Web Sites IP + + + IP Address: + + + NAT Address: + + + Phone Numbers + + + Phone Number: + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs index accdff07..d6b1088f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs @@ -1,10 +1,11 @@ //------------------------------------------------------------------------------ -// <àâòîìàòè÷åñêè ñîçäàâàåìîå> -// Ýòîò êîä ñîçäàí ïðîãðàììîé. +// +// This code was generated by a tool. // -// Èçìåíåíèÿ â ýòîì ôàéëå ìîãóò ïðèâåñòè ê íåïðàâèëüíîé ðàáîòå è áóäóò ïîòåðÿíû â ñëó÷àå -// ïîâòîðíîé ãåíåðàöèè êîäà. -// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + //------------------------------------------------------------------------------ namespace WebsitePanel.Portal.ExchangeServer { @@ -13,128 +14,142 @@ namespace WebsitePanel.Portal.ExchangeServer { public partial class ExchangeDisclaimerGeneralSettings { /// - /// asyncTasks ýëåìåíò óïðàâëåíèÿ. + /// asyncTasks control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; /// - /// breadcrumb ýëåìåíò óïðàâëåíèÿ. + /// breadcrumb control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb; /// - /// menu ýëåìåíò óïðàâëåíèÿ. + /// menu control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; /// - /// Image1 ýëåìåíò óïðàâëåíèÿ. + /// Image1 control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Image Image1; /// - /// locTitle ýëåìåíò óïðàâëåíèÿ. + /// locTitle control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locTitle; /// - /// litDisplayName ýëåìåíò óïðàâëåíèÿ. + /// litDisplayName control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Literal litDisplayName; /// - /// messageBox ýëåìåíò óïðàâëåíèÿ. + /// messageBox control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; /// - /// locDisplayName ýëåìåíò óïðàâëåíèÿ. + /// locDisplayName control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locDisplayName; /// - /// txtDisplayName ýëåìåíò óïðàâëåíèÿ. + /// txtDisplayName control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtDisplayName; /// - /// valRequireDisplayName ýëåìåíò óïðàâëåíèÿ. + /// valRequireDisplayName control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireDisplayName; /// - /// locNotes ýëåìåíò óïðàâëåíèÿ. + /// locNotes control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locNotes; /// - /// txtNotes ýëåìåíò óïðàâëåíèÿ. + /// txtNotes control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtNotes; /// - /// btnSave ýëåìåíò óïðàâëåíèÿ. + /// btnSave control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Button btnSave; /// - /// ValidationSummary1 ýëåìåíò óïðàâëåíèÿ. + /// ValidationSummary1 control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary1; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx index 92d9ad13..1ca87bfe 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx @@ -52,9 +52,10 @@ - + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs index 24e9e225..74d1e604 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.cs @@ -32,6 +32,10 @@ using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.HostedSolution; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + namespace WebsitePanel.Portal.Lync { @@ -43,11 +47,27 @@ namespace WebsitePanel.Portal.Lync { WebsitePanel.Providers.HostedSolution.LyncUserPlan[] plans = ES.Services.Lync.GetLyncUserPlans(PanelRequest.ItemID); + BindPhoneNumbers(); + if (plans.Length == 0) btnCreate.Enabled = false; } } + private void BindPhoneNumbers() + { + + ddlPhoneNumber.Items.Add(new ListItem("", "")); + + PackageIPAddress[] ips = ES.Services.Servers.GetPackageUnassignedIPAddresses(PanelSecurity.PackageId, IPAddressPool.PhoneNumbers); + foreach (PackageIPAddress ip in ips) + { + string phone = ip.ExternalIP; + ddlPhoneNumber.Items.Add(new ListItem(phone, phone)); + } + + } + + protected void Page_PreRender(object sender, EventArgs e) { bool EnterpriseVoice = false; @@ -54,7 +77,7 @@ namespace WebsitePanel.Portal.Lync if (!EnterpriseVoice) { - tbPhoneNumber.Text = ""; + ddlPhoneNumber.Text = ""; tbPin.Text = ""; } @@ -88,7 +111,7 @@ namespace WebsitePanel.Portal.Lync planSelector.planId = lyncUser.LyncUserPlanId.ToString(); lyncUserSettings.sipAddress = lyncUser.SipAddress; - tbPhoneNumber.Text = lyncUser.LineUri; + Utils.SelectListItem(ddlPhoneNumber, lyncUser.LineUri); } protected void btnSave_Click(object sender, EventArgs e) @@ -100,7 +123,7 @@ namespace WebsitePanel.Portal.Lync LyncUserResult res = ES.Services.Lync.SetUserLyncPlan(PanelRequest.ItemID, PanelRequest.AccountID, Convert.ToInt32(planSelector.planId)); if (res.IsSuccess && res.ErrorCodes.Count == 0) { - res = ES.Services.Lync.SetLyncUserGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID, lyncUserSettings.sipAddress, tbPhoneNumber.Text + ":" + tbPin.Text); + res = ES.Services.Lync.SetLyncUserGeneralSettings(PanelRequest.ItemID, PanelRequest.AccountID, lyncUserSettings.sipAddress, ddlPhoneNumber.SelectedItem.Text + ":" + tbPin.Text); } if (res.IsSuccess && res.ErrorCodes.Count == 0) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs index 3598ce62..4d0c2b8f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs @@ -3,9 +3,10 @@ // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ + namespace WebsitePanel.Portal.Lync { @@ -15,8 +16,9 @@ namespace WebsitePanel.Portal.Lync { /// asyncTasks control. ///
/// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; @@ -24,8 +26,9 @@ namespace WebsitePanel.Portal.Lync { /// breadcrumb control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb; @@ -33,8 +36,9 @@ namespace WebsitePanel.Portal.Lync { /// menu control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu; @@ -42,8 +46,9 @@ namespace WebsitePanel.Portal.Lync { /// Image1 control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Image Image1; @@ -51,8 +56,9 @@ namespace WebsitePanel.Portal.Lync { /// locTitle control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locTitle; @@ -60,8 +66,9 @@ namespace WebsitePanel.Portal.Lync { /// litDisplayName control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Literal litDisplayName; @@ -69,8 +76,9 @@ namespace WebsitePanel.Portal.Lync { /// messageBox control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; @@ -78,8 +86,9 @@ namespace WebsitePanel.Portal.Lync { /// locPlanName control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locPlanName; @@ -87,8 +96,9 @@ namespace WebsitePanel.Portal.Lync { /// planSelector control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.Lync.UserControls.LyncUserPlanSelector planSelector; @@ -96,8 +106,9 @@ namespace WebsitePanel.Portal.Lync { /// locSipAddress control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locSipAddress; @@ -105,8 +116,9 @@ namespace WebsitePanel.Portal.Lync { /// lyncUserSettings control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.Lync.UserControls.LyncUserSettings lyncUserSettings; @@ -114,8 +126,9 @@ namespace WebsitePanel.Portal.Lync { /// pnEnterpriseVoice control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Panel pnEnterpriseVoice; @@ -123,26 +136,39 @@ namespace WebsitePanel.Portal.Lync { /// locPhoneNumber control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locPhoneNumber; /// - /// tbPhoneNumber control. + /// tb_PhoneNumber control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// - protected global::System.Web.UI.WebControls.TextBox tbPhoneNumber; + protected global::System.Web.UI.WebControls.TextBox tb_PhoneNumber; + + /// + /// ddlPhoneNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPhoneNumber; /// /// PhoneFormatValidator control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.RegularExpressionValidator PhoneFormatValidator; @@ -150,8 +176,9 @@ namespace WebsitePanel.Portal.Lync { /// locLyncPin control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Localize locLyncPin; @@ -159,8 +186,9 @@ namespace WebsitePanel.Portal.Lync { /// tbPin control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox tbPin; @@ -168,8 +196,9 @@ namespace WebsitePanel.Portal.Lync { /// PinRegularExpressionValidator control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.RegularExpressionValidator PinRegularExpressionValidator; @@ -177,8 +206,9 @@ namespace WebsitePanel.Portal.Lync { /// btnSave control. /// /// - /// Auto-generated field. + /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.Button btnSave; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx new file mode 100644 index 00000000..11b61237 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx @@ -0,0 +1,11 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LyncAllocatePhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.LyncAllocatePhoneNumbers" %> +<%@ Register Src="UserControls/AllocatePackagePhoneNumbers.ascx" TagName="AllocatePackagePhoneNumbers" TagPrefix="wsp" %> + +
+ + + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.cs new file mode 100644 index 00000000..83622ff7 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebsitePanel.Portal +{ + public partial class LyncAllocatePhoneNumbers : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.designer.cs new file mode 100644 index 00000000..e6560c46 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.designer.cs @@ -0,0 +1,25 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class LyncAllocatePhoneNumbers { + + /// + /// allocatePhoneNumbers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.AllocatePackagePhoneNumbers allocatePhoneNumbers; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx new file mode 100644 index 00000000..6d0fcca5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx @@ -0,0 +1,30 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LyncPhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.LyncPhoneNumbers" %> +<%@ Register Src="UserControls/PackagePhoneNumbers.ascx" TagName="PackagePhoneNumbers" TagPrefix="wsp" %> +<%@ Register Src="UserControls/Quota.ascx" TagName="Quota" TagPrefix="wsp" %> +<%@ Register Src="UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %> + +
+ + +
+ + + + + + + + + +
+ + +
+
+ diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.cs new file mode 100644 index 00000000..dd0b1e40 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.cs @@ -0,0 +1,43 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebsitePanel.Portal +{ + public partial class LyncPhoneNumbers : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.designer.cs new file mode 100644 index 00000000..ea72d381 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.designer.cs @@ -0,0 +1,65 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class LyncPhoneNumbers { + + /// + /// webAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.PackagePhoneNumbers webAddresses; + + /// + /// secQuotas control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secQuotas; + + /// + /// QuotasPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Panel QuotasPanel; + + /// + /// locIPQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locIPQuota; + + /// + /// addressesQuota control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.Quota addressesQuota; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx new file mode 100644 index 00000000..31a176b6 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx @@ -0,0 +1,100 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.PhoneNumbers" %> +<%@ Register Src="UserControls/SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %> +<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> + + + + + + +
+ +
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + <%# Eval("ExternalIP") %> + + + + + + + <%# Eval("UserName") %>  + + + + + + <%# Eval("PackageName") %> +   + + + + + + + + + + + + + + + +
+
+ + +
+
+ + + 10 + 20 + 50 + 100 + +
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.cs new file mode 100644 index 00000000..48705d52 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.cs @@ -0,0 +1,157 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Web.UI.WebControls; +using System.Collections.Generic; +using WebsitePanel.Providers.Common; +using System.Text; +using WebsitePanel.EnterpriseServer; + +namespace WebsitePanel.Portal +{ + public partial class PhoneNumbers : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + // set display preferences + if (!IsPostBack) + { + // page size + gvIPAddresses.PageSize = UsersHelper.GetDisplayItemsPerPage(); + ddlItemsPerPage.SelectedValue = gvIPAddresses.PageSize.ToString(); + + } + else + { + gvIPAddresses.PageSize = Utils.ParseInt(ddlItemsPerPage.SelectedValue, 10); + } + + + if (!IsPostBack) + { + searchBox.AddCriteria("ExternalIP", GetLocalizedString("SearchField.ExternalIP")); + searchBox.AddCriteria("ServerName", GetLocalizedString("SearchField.Server")); + searchBox.AddCriteria("ItemName", GetLocalizedString("SearchField.ItemName")); + searchBox.AddCriteria("Username", GetLocalizedString("SearchField.Username")); + } + + } + protected void odsIPAddresses_Selected(object sender, ObjectDataSourceStatusEventArgs e) + { + if (e.Exception != null) + { + ProcessException(e.Exception); + this.DisableControls = true; + e.ExceptionHandled = true; + } + } + + public string GetSpaceHomeUrl(int spaceId) + { + return PortalUtils.GetSpaceHomePageUrl(spaceId); + } + + + protected void btnAddItem_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("PoolID", "PhoneNumbers", "add_phone"), true); + } + + protected void ddlItemsPerPage_SelectedIndexChanged(object sender, EventArgs e) + { + gvIPAddresses.PageSize = Utils.ParseInt(ddlItemsPerPage.SelectedValue, 10); + gvIPAddresses.DataBind(); + } + + protected void btnEditSelected_Click(object sender, EventArgs e) + { + int[] addresses = GetSelectedItems(gvIPAddresses); + if (addresses.Length == 0) + { + ShowWarningMessage("IP_EDIT_LIST_EMPTY_ERROR"); + return; + } + + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < addresses.Length; i++) + { + if (i > 0) sb.Append(","); + sb.Append(addresses[i]); + } + + // go to edit screen + Response.Redirect(EditUrl("Addresses", sb.ToString(), "edit_phone"), true); + } + + protected void btnDeleteSelected_Click(object sender, EventArgs e) + { + int[] addresses = GetSelectedItems(gvIPAddresses); + if (addresses.Length == 0) + { + ShowWarningMessage("IP_DELETE_LIST_EMPTY_ERROR"); + return; + } + + try + { + // delete selected IP addresses + ResultObject res = ES.Services.Servers.DeleteIPAddresses(addresses); + + if (!res.IsSuccess) + { + messageBox.ShowMessage(res, "IP_DELETE_RANGE_IP", "IP"); + return; + } + + // refresh grid + gvIPAddresses.DataBind(); + } + catch (Exception ex) + { + ShowErrorMessage("IP_DELETE_RANGE_IP", ex); + return; + } + } + + private int[] GetSelectedItems(GridView gv) + { + List items = new List(); + + for (int i = 0; i < gv.Rows.Count; i++) + { + GridViewRow row = gv.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect.Checked) + items.Add((int)gv.DataKeys[i].Value); + } + + return items.ToArray(); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.designer.cs new file mode 100644 index 00000000..9e7b294c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.designer.cs @@ -0,0 +1,106 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class PhoneNumbers { + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// btnAddItem control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnAddItem; + + /// + /// searchBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.SearchBox searchBox; + + /// + /// gvIPAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.GridView gvIPAddresses; + + /// + /// odsIPAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ObjectDataSource odsIPAddresses; + + /// + /// btnEditSelected control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnEditSelected; + + /// + /// btnDeleteSelected control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnDeleteSelected; + + /// + /// lblItemsPerPage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Label lblItemsPerPage; + + /// + /// ddlItemsPerPage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.DropDownList ddlItemsPerPage; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx new file mode 100644 index 00000000..de4f9a51 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx @@ -0,0 +1,43 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PhoneNumbersAddPhoneNumber.ascx.cs" Inherits="WebsitePanel.Portal.PhoneNumbersAddPhoneNumber" %> +<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +    + + + +
+ +
+
+ + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.cs new file mode 100644 index 00000000..f050f67c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.cs @@ -0,0 +1,173 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.ResultObjects; +using WebsitePanel.Providers.Common; + +namespace WebsitePanel.Portal +{ + public partial class PhoneNumbersAddPhoneNumber : WebsitePanelModuleBase + { + private void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + + // bind dropdowns + try + { + BindServers(); + + // set server if found in request + if (PanelRequest.ServerId != 0) + Utils.SelectListItem(ddlServer, PanelRequest.ServerId); + } + catch (Exception ex) + { + ShowErrorMessage("IP_ADD_INIT_FORM", ex); + return; + } + + ToggleControls(); + } + } + + private void BindServers() + { + try + { + ddlServer.DataSource = ES.Services.Servers.GetServers(); + ddlServer.DataBind(); + } + catch (Exception ex) + { + Response.Write(ex); + } + + // add "select" item + ddlServer.Items.Insert(0, new ListItem(GetLocalizedString("Text.NotAssigned"), "")); + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + if (Page.IsValid) + { + int serverId = Utils.ParseInt(ddlServer.SelectedValue, 0); + IPAddressPool pool = IPAddressPool.PhoneNumbers; + string comments = txtComments.Text.Trim(); + + string start; + string end; + + start = startPhone.Text; + end = endPhone.Text; + + // add ip address + if (end != "" || start.Contains("/")) + { + string errorKey = "IP_ADD_PHONE_RANGE"; + + try + { + // add IP range + ResultObject res = ES.Services.Servers.AddIPAddressesRange(pool, serverId, start, end, + "", "", "", comments); + if (!res.IsSuccess) + { + // show error + messageBox.ShowMessage(res, errorKey, "IP"); + return; + } + } + catch (Exception ex) + { + ShowErrorMessage(errorKey, ex); + return; + } + } + else + { + string errorKey = "IP_ADD_PHONE"; + + // add single IP + try + { + IntResult res = ES.Services.Servers.AddIPAddress(pool, serverId, start, + "", "", "", comments); + if (!res.IsSuccess) + { + messageBox.ShowMessage(res, errorKey, "IP"); + return; + } + } + catch (Exception ex) + { + ShowErrorMessage(errorKey, ex); + return; + } + } + + // Redirect back to the portal home page + RedirectBack(); + } + } + protected void btnCancel_Click(object sender, EventArgs e) + { + // Redirect back to the portal home page + RedirectBack(); + } + + private void RedirectBack() + { + Response.Redirect(NavigateURL("PoolID", "PhoneNumbers")); + } + + protected void ddlPools_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + private void ToggleControls() + { + requireStartPhoneValidator.Enabled = true; + } + + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.designer.cs new file mode 100644 index 00000000..37bb6c33 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.designer.cs @@ -0,0 +1,166 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class PhoneNumbersAddPhoneNumber { + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// validatorsSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ValidationSummary validatorsSummary; + + /// + /// consistentAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.CustomValidator consistentAddresses; + + /// + /// locServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locServer; + + /// + /// ddlServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.DropDownList ddlServer; + + /// + /// PhoneNumbersRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow PhoneNumbersRow; + + /// + /// Localize1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize Localize1; + + /// + /// startPhone control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox startPhone; + + /// + /// requireStartPhoneValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator requireStartPhoneValidator; + + /// + /// Localize2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize Localize2; + + /// + /// endPhone control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox endPhone; + + /// + /// lblComments control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize lblComments; + + /// + /// txtComments control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox txtComments; + + /// + /// btnAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnAdd; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx new file mode 100644 index 00000000..1bd18e27 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx @@ -0,0 +1,38 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PhoneNumbersEditPhoneNumber.ascx.cs" Inherits="WebsitePanel.Portal.PhoneNumbersEditPhoneNumber" %> +<%@ Register Src="UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ +
+
+ + +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.cs new file mode 100644 index 00000000..c056895d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.cs @@ -0,0 +1,176 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Data; +using System.Configuration; +using System.Collections; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; + +namespace WebsitePanel.Portal +{ + public partial class PhoneNumbersEditPhoneNumber : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + try + { + // bind dropdowns + BindServers(); + + // bind IP + BindPhone(); + } + catch (Exception ex) + { + ShowErrorMessage("IP_GET_IP", ex); + return; + } + } + } + + private void BindPhone() + { + int addressId = PanelRequest.AddressID; + + // check if multiple editing + if (!String.IsNullOrEmpty(PanelRequest.Addresses)) + { + string[] ids = PanelRequest.Addresses.Split(','); + addressId = Utils.ParseInt(ids[0], 0); + } + + // bind first address + IPAddressInfo addr = ES.Services.Servers.GetIPAddress(addressId); + + if (addr != null) + { + Utils.SelectListItem(ddlServer, addr.ServerId); + + Phone.Text = addr.ExternalIP; + txtComments.Text = addr.Comments; + + ToggleControls(); + } + else + { + // exit + RedirectBack(); + } + } + + private void BindServers() + { + ddlServer.DataSource = ES.Services.Servers.GetServers(); + ddlServer.DataBind(); + ddlServer.Items.Insert(0, new ListItem(GetLocalizedString("Text.NotAssigned"), "")); + } + + private void RedirectBack() + { + Response.Redirect(NavigateURL("PoolID", "PhoneNumbers")); + } + + protected void btnUpdate_Click(object sender, EventArgs e) + { + if (Page.IsValid) + { + try + { + int serverId = Utils.ParseInt(ddlServer.SelectedValue, 0); + IPAddressPool pool = IPAddressPool.PhoneNumbers; + + ResultObject res = null; + + // update single IP address + if (!String.IsNullOrEmpty(PanelRequest.Addresses)) + { + // update multiple IPs + string[] ids = PanelRequest.Addresses.Split(','); + int[] addresses = new int[ids.Length]; + for (int i = 0; i < ids.Length; i++) + addresses[i] = Utils.ParseInt(ids[i], 0); + + res = ES.Services.Servers.UpdateIPAddresses(addresses, + pool, serverId, "", "", txtComments.Text.Trim()); + } + else + { + string address = Phone.Text; + + // update single IP + res = ES.Services.Servers.UpdateIPAddress(PanelRequest.AddressID, + pool, serverId, address, "", "", "", txtComments.Text.Trim()); + } + + if (!res.IsSuccess) + { + messageBox.ShowMessage(res, "IP_UPDATE_IP", "IP"); + return; + } + + // Redirect back to the portal home page + RedirectBack(); + } + catch (Exception ex) + { + ShowErrorMessage("IP_UPDATE_IP", ex); + return; + } + } + } + + protected void btnCancel_Click(object sender, EventArgs e) + { + // Redirect back to the portal home page + RedirectBack(); + } + + protected void ddlPools_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + private void ToggleControls() + { + bool multipleEdit = !String.IsNullOrEmpty(PanelRequest.Addresses); + PhoneNumbersRow.Visible = !multipleEdit; + requireStartPhoneValidator.Enabled = !multipleEdit; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.designer.cs new file mode 100644 index 00000000..c47738c0 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.designer.cs @@ -0,0 +1,136 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class PhoneNumbersEditPhoneNumber { + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// validatorsSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ValidationSummary validatorsSummary; + + /// + /// locServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locServer; + + /// + /// ddlServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.DropDownList ddlServer; + + /// + /// PhoneNumbersRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow PhoneNumbersRow; + + /// + /// Localize1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize Localize1; + + /// + /// Phone control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox Phone; + + /// + /// requireStartPhoneValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator requireStartPhoneValidator; + + /// + /// lblComments control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize lblComments; + + /// + /// txtComments control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox txtComments; + + /// + /// btnUpdate control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnUpdate; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs index 5cf5ec1e..a7e103dc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs @@ -1,10 +1,11 @@ //------------------------------------------------------------------------------ -// <àâòîìàòè÷åñêè ñîçäàâàåìîå> -// Ýòîò êîä ñîçäàí ïðîãðàììîé. +// +// This code was generated by a tool. // -// Èçìåíåíèÿ â ýòîì ôàéëå ìîãóò ïðèâåñòè ê íåïðàâèëüíîé ðàáîòå è áóäóò ïîòåðÿíû â ñëó÷àå -// ïîâòîðíîé ãåíåðàöèè êîäà. -// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + //------------------------------------------------------------------------------ namespace WebsitePanel.Portal.ProviderControls { @@ -13,83 +14,92 @@ namespace WebsitePanel.Portal.ProviderControls { public partial class CRM2011_Settings { /// - /// txtSqlServer ýëåìåíò óïðàâëåíèÿ. + /// txtSqlServer control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtSqlServer; /// - /// RequiredFieldValidator1 ýëåìåíò óïðàâëåíèÿ. + /// RequiredFieldValidator1 control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; /// - /// txtReportingService ýëåìåíò óïðàâëåíèÿ. + /// txtReportingService control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtReportingService; /// - /// txtDomainName ýëåìåíò óïðàâëåíèÿ. + /// txtDomainName control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtDomainName; /// - /// RequiredFieldValidator2 ýëåìåíò óïðàâëåíèÿ. + /// RequiredFieldValidator2 control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2; /// - /// ddlSchema ýëåìåíò óïðàâëåíèÿ. + /// ddlSchema control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.DropDownList ddlSchema; /// - /// ddlCrmIpAddress ýëåìåíò óïðàâëåíèÿ. + /// ddlCrmIpAddress control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::WebsitePanel.Portal.SelectIPAddress ddlCrmIpAddress; /// - /// txtPort ýëåìåíò óïðàâëåíèÿ. + /// txtPort control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtPort; /// - /// txtAppRootDomain ýëåìåíò óïðàâëåíèÿ. + /// txtAppRootDomain control. /// /// - /// Àâòîìàòè÷åñêè ñîçäàâàåìîå ïîëå. - /// Äëÿ èçìåíåíèÿ ïåðåìåñòèòå îáúÿâëåíèå ïîëÿ èç ôàéëà êîíñòðóêòîðà â ôàéë êîäà ïðîãðàììíîé ÷àñòè. + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// protected global::System.Web.UI.WebControls.TextBox txtAppRootDomain; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx new file mode 100644 index 00000000..7dd2aece --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx @@ -0,0 +1,71 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AllocatePackagePhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.AllocatePackagePhoneNumbers" %> +<%@ Register Src="SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> + + + + + + +
    +
  • + +
  • +
  • + +
  • +
+ + + + + + + + + + + + + + + + +
+ +
+ + + + + * + + +
+ +
+ +
+ +
+
+
+

+ + +

\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.cs new file mode 100644 index 00000000..991b7a21 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.cs @@ -0,0 +1,174 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; + +namespace WebsitePanel.Portal.UserControls +{ + public partial class AllocatePackagePhoneNumbers : WebsitePanelControlBase + { + private IPAddressPool pool; + public IPAddressPool Pool + { + get { return pool; } + set { pool = value; } + } + + private string listAddressesControl; + public string ListAddressesControl + { + get { return listAddressesControl; } + set { listAddressesControl = value; } + } + + private string resourceGroup; + public string ResourceGroup + { + get { return resourceGroup; } + set { resourceGroup = value; } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + BindIPAddresses(); + ToggleControls(); + } + } + + private void BindIPAddresses() + { + bool vps = (Pool == IPAddressPool.VpsExternalNetwork || Pool == IPAddressPool.VpsManagementNetwork); + + // bind list + IPAddressInfo[] ips = ES.Services.Servers.GetUnallottedIPAddresses(PanelSecurity.PackageId, ResourceGroup, Pool); + foreach (IPAddressInfo ip in ips) + { + string txt = ip.ExternalIP; + + // web sites - NAT Address + if (!vps && !String.IsNullOrEmpty(ip.InternalIP)) + txt += "/" + ip.InternalIP; + + // VPS - Gateway Address + else if (vps && !String.IsNullOrEmpty(ip.DefaultGateway)) + txt += "/" + ip.DefaultGateway; + + listExternalAddresses.Items.Add(new ListItem(txt, ip.AddressId.ToString())); + } + + int quotaAllowed = -1; + string quotaName = (String.Compare(ResourceGroup, ResourceGroups.VPS, true) == 0) ? Quotas.VPS_EXTERNAL_IP_ADDRESSES_NUMBER : Quotas.WEB_IP_ADDRESSES; + PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); + if (cntx.Quotas.ContainsKey(quotaName)) + { + int quotaAllocated = cntx.Quotas[quotaName].QuotaAllocatedValue; + int quotaUsed = cntx.Quotas[quotaName].QuotaUsedValue; + + if (quotaAllocated != -1) + quotaAllowed = quotaAllocated - quotaUsed; + } + + // bind controls + int max = quotaAllowed == -1 ? listExternalAddresses.Items.Count : quotaAllowed; + + txtExternalAddressesNumber.Text = max.ToString(); + litMaxAddresses.Text = String.Format(GetLocalizedString("litMaxAddresses.Text"), max); + + if (max == 0) + { + AddressesTable.Visible = false; + ErrorMessagesList.Visible = true; + EmptyAddressesMessage.Visible = (listExternalAddresses.Items.Count == 0); + QuotaReachedMessage.Visible = (quotaAllowed == 0); + btnAdd.Enabled = false; + } + } + + protected void btnAdd_Click(object sender, EventArgs e) + { + try + { + List ids = new List(); + foreach (ListItem item in listExternalAddresses.Items) + { + if (item.Selected) + ids.Add(Utils.ParseInt(item.Value)); + } + + ResultObject res = ES.Services.Servers.AllocatePackageIPAddresses(PanelSecurity.PackageId, + ResourceGroup, Pool, + radioExternalRandom.Checked, + Utils.ParseInt(txtExternalAddressesNumber.Text), + ids.ToArray()); + if (res.IsSuccess) + { + // return back + Response.Redirect(HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), ListAddressesControl)); + } + else + { + // show message + messageBox.ShowMessage(res, "VPS_ALLOCATE_EXTERNAL_ADDRESSES_ERROR", "VPS"); + } + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("VPS_ALLOCATE_EXTERNAL_ADDRESSES_ERROR", ex); + } + } + + protected void btnCancel_Click(object sender, EventArgs e) + { + Response.Redirect(HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), ListAddressesControl)); + } + + protected void radioExternalSelected_CheckedChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + private void ToggleControls() + { + AddressesNumberRow.Visible = radioExternalRandom.Checked; + AddressesListRow.Visible = radioExternalSelected.Checked; + } + + protected void radioExternalRandom_CheckedChanged(object sender, EventArgs e) + { + ToggleControls(); + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.designer.cs new file mode 100644 index 00000000..14339064 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.designer.cs @@ -0,0 +1,215 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.UserControls { + + + public partial class AllocatePackagePhoneNumbers { + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// validatorsSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ValidationSummary validatorsSummary; + + /// + /// ErrorMessagesList control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl ErrorMessagesList; + + /// + /// EmptyAddressesMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl EmptyAddressesMessage; + + /// + /// locNotEnoughAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locNotEnoughAddresses; + + /// + /// QuotaReachedMessage control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl QuotaReachedMessage; + + /// + /// locQuotaReached control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locQuotaReached; + + /// + /// AddressesTable control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.UpdatePanel AddressesTable; + + /// + /// radioExternalRandom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.RadioButton radioExternalRandom; + + /// + /// AddressesNumberRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow AddressesNumberRow; + + /// + /// locExternalAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locExternalAddresses; + + /// + /// txtExternalAddressesNumber control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.TextBox txtExternalAddressesNumber; + + /// + /// ExternalAddressesValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator ExternalAddressesValidator; + + /// + /// litMaxAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Literal litMaxAddresses; + + /// + /// radioExternalSelected control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.RadioButton radioExternalSelected; + + /// + /// AddressesListRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow AddressesListRow; + + /// + /// listExternalAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ListBox listExternalAddresses; + + /// + /// locHoldCtrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Localize locHoldCtrl; + + /// + /// btnAdd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnAdd; + + /// + /// btnCancel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnCancel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/AllocatePackagePhoneNumbers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/AllocatePackagePhoneNumbers.ascx.resx new file mode 100644 index 00000000..b8f2d0ea --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/AllocatePackagePhoneNumbers.ascx.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Add + + + Cancel + + + Enter the number of Phone Numbers + + + ({0} max) + + + Number of Phone Numbers: + + + * Hold CTRL key to select multiple phone numbers + + + The pool of Phone Numbers is empty.<br/>Allocate more Phone Numbers on reseller level. If the current hosting space is nested within "System" space then add more server Phone Numbers to the appropriate pool on "Configuration -> Phone Numbers" page. + + + Allocate Phone Numbers + + + Randomly select Phone Numbers from the pool + + + Select Phone Numbers from the list + + + Phone Numbers quota has been reached. + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/PackagePhoneNumbers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/PackagePhoneNumbers.ascx.resx new file mode 100644 index 00000000..646a40dd --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/PackagePhoneNumbers.ascx.resx @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Allocate... + + + Deallocate Selected + + + No Phone Numbers have been allocated to this hosting space. + + + Gateway + + + Phone Numbers + + + Item Name + + + Primary + + + Space + + + Subnet Mask + + + User + + + Default Gateway + + + Phone Numbers + + + Item Name + + + User Name + + + return confirm('Deallocate selected Phone Numbers from hosting space?'); + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx new file mode 100644 index 00000000..6fb848de --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx @@ -0,0 +1,87 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PackagePhoneNumbers.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.PackagePhoneNumbers" %> +<%@ Register Src="SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="wsp" %> + + + + + + +
+
+ +
+
+ +
+
+ + + + + + + + +   + + + + + + + + + <%# Eval("ItemName") %> +   + + + + + + + <%# Eval("PackageName") %> + + + + + + <%# Eval("UserName") %> + + + + + + + + + + + + + +
+ +
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.cs new file mode 100644 index 00000000..e907fb61 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.cs @@ -0,0 +1,172 @@ +// Copyright (c) 2012, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; +using System.Collections.Generic; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.Providers.Common; + +namespace WebsitePanel.Portal.UserControls +{ + public partial class PackagePhoneNumbers : WebsitePanelControlBase + { + private bool spaceOwner; + + private IPAddressPool pool; + public IPAddressPool Pool + { + get { return pool; } + set { pool = value; } + } + + private string editItemControl; + public string EditItemControl + { + get { return editItemControl; } + set { editItemControl = value; } + } + + private string spaceHomeControl; + public string SpaceHomeControl + { + get { return spaceHomeControl; } + set { spaceHomeControl = value; } + } + + private string allocateAddressesControl; + public string AllocateAddressesControl + { + get { return allocateAddressesControl; } + set { allocateAddressesControl = value; } + } + + public bool ManageAllowed + { + get { return ViewState["ManageAllowed"] != null ? (bool)ViewState["ManageAllowed"] : false; } + set { ViewState["ManageAllowed"] = value; } + } + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + searchBox.AddCriteria("ExternalIP", GetLocalizedString("SearchField.IPAddress")); + searchBox.AddCriteria("ItemName", GetLocalizedString("SearchField.ItemName")); + searchBox.AddCriteria("Username", GetLocalizedString("SearchField.Username")); + } + + bool isUserSelected = PanelSecurity.SelectedUser.Role == WebsitePanel.EnterpriseServer.UserRole.User; + bool isUserLogged = PanelSecurity.EffectiveUser.Role == WebsitePanel.EnterpriseServer.UserRole.User; + spaceOwner = PanelSecurity.EffectiveUserId == PanelSecurity.SelectedUserId; + + gvAddresses.Columns[3].Visible = !isUserSelected; // space + gvAddresses.Columns[4].Visible = !isUserSelected; // user + + // managing external network permissions + gvAddresses.Columns[0].Visible = !isUserLogged && ManageAllowed; + btnAllocateAddress.Visible = !isUserLogged && !spaceOwner && ManageAllowed && !String.IsNullOrEmpty(AllocateAddressesControl); + btnDeallocateAddresses.Visible = !isUserLogged && ManageAllowed; + } + + public string GetItemEditUrl(string itemID) + { + return HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), EditItemControl, + "ItemID=" + itemID); + } + + public string GetSpaceHomeUrl(string spaceId) + { + return HostModule.EditUrl("SpaceID", spaceId, SpaceHomeControl); + } + + protected void odsExternalAddressesPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) + { + if (e.Exception != null) + { + messageBox.ShowErrorMessage("EXCHANGE_GET_MAILBOXES", e.Exception); + e.ExceptionHandled = true; + } + } + + protected void btnAllocateAddress_Click(object sender, EventArgs e) + { + Response.Redirect(HostModule.EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), AllocateAddressesControl)); + } + + protected void gvAddresses_RowDataBound(object sender, GridViewRowEventArgs e) + { + PackageIPAddress item = e.Row.DataItem as PackageIPAddress; + if (item != null) + { + // checkbox + CheckBox chkSelect = e.Row.FindControl("chkSelect") as CheckBox; + chkSelect.Enabled = (!spaceOwner || (PanelSecurity.PackageId != item.PackageId)) && item.ItemId == 0; + } + } + + protected void btnDeallocateAddresses_Click(object sender, EventArgs e) + { + List ids = new List(); + + try + { + List items = new List(); + for (int i = 0; i < gvAddresses.Rows.Count; i++) + { + GridViewRow row = gvAddresses.Rows[i]; + CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); + if (chkSelect.Checked) + items.Add((int)gvAddresses.DataKeys[i].Value); + } + + // check if at least one is selected + if (items.Count == 0) + { + messageBox.ShowWarningMessage("PHONE_EDIT_LIST_EMPTY_ERROR"); + return; + } + + ResultObject res = ES.Services.Servers.DeallocatePackageIPAddresses(PanelSecurity.PackageId, items.ToArray()); + messageBox.ShowMessage(res, "DEALLOCATE_SPACE_PHONE_NUMBER", "VPS"); + gvAddresses.DataBind(); + } + catch (Exception ex) + { + messageBox.ShowErrorMessage("DEALLOCATE_SPACE_PHONE_NUMBER", ex); + } + } + + protected void odsExternalAddressesPaged_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) + { + e.InputParameters["pool"] = Pool; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.designer.cs new file mode 100644 index 00000000..2a0d585d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.designer.cs @@ -0,0 +1,75 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.UserControls { + + + public partial class PackagePhoneNumbers { + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// btnAllocateAddress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnAllocateAddress; + + /// + /// searchBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::WebsitePanel.Portal.SearchBox searchBox; + + /// + /// gvAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.GridView gvAddresses; + + /// + /// odsExternalAddressesPaged control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.ObjectDataSource odsExternalAddressesPaged; + + /// + /// btnDeallocateAddresses control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + + /// + protected global::System.Web.UI.WebControls.Button btnDeallocateAddresses; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesIPAddresses.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesIPAddresses.ascx.cs index 073a45f6..ce25e873 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesIPAddresses.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebSitesIPAddresses.ascx.cs @@ -38,7 +38,6 @@ namespace WebsitePanel.Portal { protected void Page_Load(object sender, EventArgs e) { - } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 0596b4b6..689afdc0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -461,6 +461,20 @@ OrgIdPolicyEditor.ascx + + PackagePhoneNumbers.ascx + ASPXCodeBehind + + + PackagePhoneNumbers.ascx + + + AllocatePackagePhoneNumbers.ascx + ASPXCodeBehind + + + AllocatePackagePhoneNumbers.ascx + MonitoringPage.aspx ASPXCodeBehind @@ -3879,6 +3893,41 @@ WebsitesSSL.ascx + + LyncPhoneNumbers.ascx + ASPXCodeBehind + + + LyncPhoneNumbers.ascx + + + LyncAllocatePhoneNumbers.ascx + ASPXCodeBehind + + + LyncAllocatePhoneNumbers.ascx + + + PhoneNumbers.ascx + ASPXCodeBehind + + + PhoneNumbers.ascx + + + PhoneNumbersAddPhoneNumber.ascx + ASPXCodeBehind + + + PhoneNumbersAddPhoneNumber.ascx + + + PhoneNumbersEditPhoneNumber.ascx + ASPXCodeBehind + + + PhoneNumbersEditPhoneNumber.ascx + @@ -3918,6 +3967,8 @@ + + @@ -3980,6 +4031,11 @@ + + + + + @@ -5061,6 +5117,12 @@ Designer + + Designer + + + Designer + @@ -5072,6 +5134,15 @@ + + Designer + + + Designer + + + + Designer From 77fb1ff2fc9a878615acc9eb706e68dd570858b1 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 21 Aug 2013 11:15:46 -0400 Subject: [PATCH 7/8] Update Files with Copyright --- .../HostedSolution/LyncPolicyType.cs | 30 ++++++++++++++++++- ...DisclaimerGeneralSettings.ascx.designer.cs | 28 +++++++++++++++++ .../Lync/LyncAddLyncUserPlan.ascx.designer.cs | 28 +++++++++++++++++ .../Lync/LyncCreateUser.ascx.designer.cs | 30 ++++++++++++++++++- .../Lync/LyncEditUser.ascx.designer.cs | 30 ++++++++++++++++++- .../LyncUserPlanSelector.ascx.designer.cs | 28 +++++++++++++++++ .../LyncAllocatePhoneNumbers.ascx.designer.cs | 30 ++++++++++++++++++- .../LyncPhoneNumbers.ascx.designer.cs | 30 ++++++++++++++++++- .../PhoneNumbers.ascx.designer.cs | 28 +++++++++++++++++ ...honeNumbersAddPhoneNumber.ascx.designer.cs | 28 +++++++++++++++++ ...oneNumbersEditPhoneNumber.ascx.designer.cs | 28 +++++++++++++++++ .../CRM2011_Settings.ascx.designer.cs | 28 +++++++++++++++++ ...ttingsLyncUserPlansPolicy.ascx.designer.cs | 30 ++++++++++++++++++- ...locatePackagePhoneNumbers.ascx.designer.cs | 30 ++++++++++++++++++- .../PackagePhoneNumbers.ascx.designer.cs | 30 ++++++++++++++++++- 15 files changed, 428 insertions(+), 8 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncPolicyType.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncPolicyType.cs index d1971d37..5a069a48 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncPolicyType.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/HostedSolution/LyncPolicyType.cs @@ -1,4 +1,32 @@ -using System; +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs index d6b1088f..e7de40fb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeDisclaimerGeneralSettings.ascx.designer.cs @@ -1,3 +1,31 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs index 2b9ef0b7..1fc0acef 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncAddLyncUserPlan.ascx.designer.cs @@ -1,3 +1,31 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.designer.cs index ee97a5d3..12bced36 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncCreateUser.ascx.designer.cs @@ -1,4 +1,32 @@ -//------------------------------------------------------------------------------ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs index 4d0c2b8f..73782c96 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncEditUser.ascx.designer.cs @@ -1,4 +1,32 @@ -//------------------------------------------------------------------------------ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.designer.cs index 00a2ed12..8863bb48 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/UserControls/LyncUserPlanSelector.ascx.designer.cs @@ -1,3 +1,31 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.designer.cs index e6560c46..8ed64ed4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncAllocatePhoneNumbers.ascx.designer.cs @@ -1,4 +1,32 @@ -//------------------------------------------------------------------------------ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.designer.cs index ea72d381..11db7c69 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/LyncPhoneNumbers.ascx.designer.cs @@ -1,4 +1,32 @@ -//------------------------------------------------------------------------------ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.designer.cs index 9e7b294c..fc5338bd 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbers.ascx.designer.cs @@ -1,3 +1,31 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.designer.cs index 37bb6c33..ae27f15d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersAddPhoneNumber.ascx.designer.cs @@ -1,3 +1,31 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.designer.cs index c47738c0..43eeebb6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/PhoneNumbersEditPhoneNumber.ascx.designer.cs @@ -1,3 +1,31 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs index a7e103dc..86ec4040 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/CRM2011_Settings.ascx.designer.cs @@ -1,3 +1,31 @@ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + //------------------------------------------------------------------------------ // // This code was generated by a tool. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs index d036ed13..4dbc33f5 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsLyncUserPlansPolicy.ascx.designer.cs @@ -1,4 +1,32 @@ -//------------------------------------------------------------------------------ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.designer.cs index 14339064..4bbd3de7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/AllocatePackagePhoneNumbers.ascx.designer.cs @@ -1,4 +1,32 @@ -//------------------------------------------------------------------------------ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.designer.cs index 2a0d585d..2b4926c8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/PackagePhoneNumbers.ascx.designer.cs @@ -1,4 +1,32 @@ -//------------------------------------------------------------------------------ +// Copyright (c) 2011, Outercurve Foundation. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// - Neither the name of the Outercurve Foundation nor the names of its +// contributors may be used to endorse or promote products derived from this +// software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // From 5e97b6e36163dbd6be5f00a0b5820d39167a5043 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 21 Aug 2013 11:53:56 -0400 Subject: [PATCH 8/8] Added tag build-2.1.0.143 for changeset ec5b54fbee38