Lync user plans aligned with Exchange mailbox plans

This commit is contained in:
robvde 2012-08-10 16:12:59 +04:00
parent 0ecd34363a
commit 260e981140
17 changed files with 921 additions and 260 deletions

View file

@ -13460,6 +13460,7 @@ CREATE TABLE [dbo].[LyncUserPlans](
[LyncUserPlanId] [int] IDENTITY(1,1) NOT NULL,
[ItemID] [int] NOT NULL,
[LyncUserPlanName] [nvarchar](300) COLLATE Latin1_General_CI_AS NOT NULL,
[LyncUserPlanType] [int] NULL,
[IM] [bit] NOT NULL,
[Mobility] [bit] NOT NULL,
[MobilityEnableOutsideVoice] [bit] NOT NULL,
@ -45269,6 +45270,7 @@ CREATE PROCEDURE [dbo].[AddLyncUserPlan]
@LyncUserPlanId int OUTPUT,
@ItemID int,
@LyncUserPlanName nvarchar(300),
@LyncUserPlanType int,
@IM bit,
@Mobility bit,
@MobilityEnableOutsideVoice bit,
@ -45298,6 +45300,7 @@ INSERT INTO LyncUserPlans
(
ItemID,
LyncUserPlanName,
LyncUserPlanType,
IM,
Mobility,
MobilityEnableOutsideVoice,
@ -45311,6 +45314,7 @@ VALUES
(
@ItemID,
@LyncUserPlanName,
@LyncUserPlanType,
@IM,
@Mobility,
@MobilityEnableOutsideVoice,
@ -45333,6 +45337,45 @@ GO
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
)
AS
UPDATE LyncUserPlans SET
LyncUserPlanName = @LyncUserPlanName,
LyncUserPlanType = @LyncUserPlanType,
IM = @IM,
Mobility = @Mobility,
MobilityEnableOutsideVoice = @MobilityEnableOutsideVoice,
Federation = @Federation,
Conferencing =@Conferencing,
EnterpriseVoice = @EnterpriseVoice,
VoicePolicy = @VoicePolicy,
IsDefault = @IsDefault
WHERE LyncUserPlanId = @LyncUserPlanId
RETURN
GO
CREATE PROCEDURE [dbo].[GetLyncUsersByPlanId]
(
@ -45456,6 +45499,7 @@ SELECT
LyncUserPlanId,
ItemID,
LyncUserPlanName,
LyncUserPlanType,
IM,
Mobility,
MobilityEnableOutsideVoice,
@ -45491,6 +45535,7 @@ SELECT
LyncUserPlanId,
ItemID,
LyncUserPlanName,
LyncUserPlanType,
IM,
Mobility,
MobilityEnableOutsideVoice,
@ -45525,6 +45570,7 @@ SELECT
LyncUserPlanId,
ItemID,
LyncUserPlanName,
LyncUserPlanType,
IM,
Mobility,
MobilityEnableOutsideVoice,

View file

@ -1869,7 +1869,6 @@ GO
-- LyncUserPlans
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[LyncUserPlans]') AND type in (N'U'))
BEGIN
@ -1877,6 +1876,7 @@ CREATE TABLE [dbo].[LyncUserPlans](
[LyncUserPlanId] [int] IDENTITY(1,1) NOT NULL,
[ItemID] [int] NOT NULL,
[LyncUserPlanName] [nvarchar](300) NOT NULL,
[LyncUserPlanType] [int] NULL,
[IM] [bit] NOT NULL,
[Mobility] [bit] NOT NULL,
[MobilityEnableOutsideVoice] [bit] NOT NULL,
@ -1917,6 +1917,15 @@ GO
IF NOT EXISTS(select 1 from sys.columns COLS INNER JOIN sys.objects OBJS ON OBJS.object_id=COLS.object_id and OBJS.type='U' AND OBJS.name='LyncUserPlans' AND COLS.name='LyncUserPlanType')
BEGIN
ALTER TABLE [dbo].[LyncUserPlans] ADD
[LyncUserPlanType] [int] NULL
END
GO
/****** Object: Table [dbo].[AddExchangeAccount] ******/
ALTER PROCEDURE [dbo].[AddExchangeAccount]
@ -3694,6 +3703,42 @@ GO
ALTER PROCEDURE [dbo].[GetLyncUsersByPlanId]
(
@ItemID int,
@PlanId int
)
AS
SELECT
ea.AccountID,
ea.ItemID,
ea.AccountName,
ea.DisplayName,
ea.PrimaryEmailAddress,
ea.SamAccountName,
ou.LyncUserPlanId,
lp.LyncUserPlanName
FROM
ExchangeAccounts ea
INNER JOIN
LyncUsers ou
INNER JOIN
LyncUserPlans lp
ON
ou.LyncUserPlanId = lp.LyncUserPlanId
ON
ea.AccountID = ou.AccountID
WHERE
ea.ItemID = @ItemID AND
ou.LyncUserPlanId = @PlanId
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'AddLyncUserPlan')
BEGIN
@ -3702,6 +3747,7 @@ EXEC sp_executesql N'CREATE PROCEDURE [dbo].[AddLyncUserPlan]
@LyncUserPlanId int OUTPUT,
@ItemID int,
@LyncUserPlanName nvarchar(300),
@LyncUserPlanType int,
@IM bit,
@Mobility bit,
@MobilityEnableOutsideVoice bit,
@ -3713,13 +3759,15 @@ EXEC sp_executesql N'CREATE PROCEDURE [dbo].[AddLyncUserPlan]
)
AS
IF ((SELECT Count(*) FROM LyncUserPlans WHERE ItemId = @ItemID) = 0)
IF (((SELECT Count(*) FROM LyncUserPlans WHERE ItemId = @ItemID) = 0) AND (@LyncUserPlanType=0))
BEGIN
SET @IsDefault = 1
END
ELSE
BEGIN
IF @IsDefault = 1
IF ((@IsDefault = 1) AND (@LyncUserPlanType=0))
BEGIN
UPDATE LyncUserPlans SET IsDefault = 0 WHERE ItemID = @ItemID
END
@ -3730,6 +3778,7 @@ INSERT INTO LyncUserPlans
(
ItemID,
LyncUserPlanName,
LyncUserPlanType,
IM,
Mobility,
MobilityEnableOutsideVoice,
@ -3743,6 +3792,7 @@ VALUES
(
@ItemID,
@LyncUserPlanName,
@LyncUserPlanType,
@IM,
@Mobility,
@MobilityEnableOutsideVoice,
@ -3761,11 +3811,18 @@ GO
ALTER PROCEDURE [dbo].[AddLyncUserPlan]
(
@LyncUserPlanId int OUTPUT,
@ItemID int,
@LyncUserPlanName nvarchar(300),
@LyncUserPlanType int,
@IM bit,
@Mobility bit,
@MobilityEnableOutsideVoice bit,
@ -3777,24 +3834,24 @@ ALTER PROCEDURE [dbo].[AddLyncUserPlan]
)
AS
IF ((SELECT Count(*) FROM LyncUserPlans WHERE ItemId = @ItemID) = 0)
IF (((SELECT Count(*) FROM LyncUserPlans WHERE ItemId = @ItemID) = 0) AND (@LyncUserPlanType=0))
BEGIN
SET @IsDefault = 1
END
ELSE
BEGIN
IF @IsDefault = 1
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,
@ -3808,6 +3865,7 @@ VALUES
(
@ItemID,
@LyncUserPlanName,
@LyncUserPlanType,
@IM,
@Mobility,
@MobilityEnableOutsideVoice,
@ -3824,8 +3882,6 @@ RETURN
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'CheckLyncUserExists')
BEGIN
EXEC sp_executesql N'CREATE PROCEDURE [dbo].[CheckLyncUserExists]
@ -3915,6 +3971,7 @@ SELECT
LyncUserPlanId,
ItemID,
LyncUserPlanName,
LyncUserPlanType,
IM,
Mobility,
MobilityEnableOutsideVoice,
@ -3935,6 +3992,31 @@ GO
ALTER PROCEDURE [dbo].[GetLyncUserPlan]
(
@LyncUserPlanId int
)
AS
SELECT
LyncUserPlanId,
ItemID,
LyncUserPlanName,
LyncUserPlanType,
IM,
Mobility,
MobilityEnableOutsideVoice,
Federation,
Conferencing,
EnterpriseVoice,
VoicePolicy,
IsDefault
FROM
LyncUserPlans
WHERE
LyncUserPlanId = @LyncUserPlanId
RETURN
GO
@ -3950,6 +4032,7 @@ SELECT
LyncUserPlanId,
ItemID,
LyncUserPlanName,
LyncUserPlanType,
IM,
Mobility,
MobilityEnableOutsideVoice,
@ -3972,6 +4055,30 @@ GO
ALTER PROCEDURE [dbo].[GetLyncUserPlanByAccountId]
(
@AccountID int
)
AS
SELECT
LyncUserPlanId,
ItemID,
LyncUserPlanName,
LyncUserPlanType,
IM,
Mobility,
MobilityEnableOutsideVoice,
Federation,
Conferencing,
EnterpriseVoice,
VoicePolicy,
IsDefault
FROM
LyncUserPlans
WHERE
LyncUserPlanId IN (SELECT LyncUserPlanId FROM LyncUsers WHERE AccountID = @AccountID)
RETURN
GO
@ -3987,6 +4094,7 @@ SELECT
LyncUserPlanId,
ItemID,
LyncUserPlanName,
LyncUserPlanType,
IM,
Mobility,
MobilityEnableOutsideVoice,
@ -4009,6 +4117,32 @@ GO
ALTER PROCEDURE [dbo].[GetLyncUserPlans]
(
@ItemID int
)
AS
SELECT
LyncUserPlanId,
ItemID,
LyncUserPlanName,
LyncUserPlanType,
IM,
Mobility,
MobilityEnableOutsideVoice,
Federation,
Conferencing,
EnterpriseVoice,
VoicePolicy,
IsDefault
FROM
LyncUserPlans
WHERE
ItemID = @ItemID
ORDER BY LyncUserPlanName
RETURN
GO
@ -5181,6 +5315,46 @@ 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
)
AS
UPDATE LyncUserPlans SET
LyncUserPlanName = @LyncUserPlanName,
LyncUserPlanType = @LyncUserPlanType,
IM = @IM,
Mobility = @Mobility,
MobilityEnableOutsideVoice = @MobilityEnableOutsideVoice,
Federation = @Federation,
Conferencing =@Conferencing,
EnterpriseVoice = @EnterpriseVoice,
VoicePolicy = @VoicePolicy,
IsDefault = @IsDefault
WHERE LyncUserPlanId = @LyncUserPlanId
RETURN'
END
GO
IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'SmarterMail 10.x')
BEGIN
INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (66, 4, N'SmarterMail', N'SmarterMail 10.x', N'WebsitePanel.Providers.Mail.SmarterMail10, WebsitePanel.Providers.Mail.SmarterMail10', N'SmarterMail60', NULL)

View file

@ -1,35 +1,7 @@
// 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.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.5456
// Runtime Version:2.0.50727.6387
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -37,7 +9,7 @@
//------------------------------------------------------------------------------
//
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
// This source code was auto-generated by wsdl, Version=2.0.50727.3038.
//
namespace WebsitePanel.EnterpriseServer {
using System.Xml.Serialization;
@ -52,8 +24,10 @@ namespace WebsitePanel.EnterpriseServer {
using WebsitePanel.Providers.ResultObjects;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="esLyncSoap", Namespace="http://tempuri.org/")]
@ -75,6 +49,8 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback AddLyncUserPlanOperationCompleted;
private System.Threading.SendOrPostCallback UpdateLyncUserPlanOperationCompleted;
private System.Threading.SendOrPostCallback DeleteLyncUserPlanOperationCompleted;
private System.Threading.SendOrPostCallback SetOrganizationDefaultLyncUserPlanOperationCompleted;
@ -91,7 +67,7 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
public esLync() {
this.Url = "http://localhost:9005/esLync.asmx";
this.Url = "http://localhost:9002/esLync.asmx";
}
/// <remarks/>
@ -118,6 +94,9 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
public event AddLyncUserPlanCompletedEventHandler AddLyncUserPlanCompleted;
/// <remarks/>
public event UpdateLyncUserPlanCompletedEventHandler UpdateLyncUserPlanCompleted;
/// <remarks/>
public event DeleteLyncUserPlanCompletedEventHandler DeleteLyncUserPlanCompleted;
@ -497,6 +476,50 @@ namespace WebsitePanel.EnterpriseServer {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/UpdateLyncUserPlan", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int UpdateLyncUserPlan(int itemId, LyncUserPlan lyncUserPlan) {
object[] results = this.Invoke("UpdateLyncUserPlan", new object[] {
itemId,
lyncUserPlan});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginUpdateLyncUserPlan(int itemId, LyncUserPlan lyncUserPlan, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("UpdateLyncUserPlan", new object[] {
itemId,
lyncUserPlan}, callback, asyncState);
}
/// <remarks/>
public int EndUpdateLyncUserPlan(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void UpdateLyncUserPlanAsync(int itemId, LyncUserPlan lyncUserPlan) {
this.UpdateLyncUserPlanAsync(itemId, lyncUserPlan, null);
}
/// <remarks/>
public void UpdateLyncUserPlanAsync(int itemId, LyncUserPlan lyncUserPlan, object userState) {
if ((this.UpdateLyncUserPlanOperationCompleted == null)) {
this.UpdateLyncUserPlanOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateLyncUserPlanOperationCompleted);
}
this.InvokeAsync("UpdateLyncUserPlan", new object[] {
itemId,
lyncUserPlan}, this.UpdateLyncUserPlanOperationCompleted, userState);
}
private void OnUpdateLyncUserPlanOperationCompleted(object arg) {
if ((this.UpdateLyncUserPlanCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.UpdateLyncUserPlanCompleted(this, new UpdateLyncUserPlanCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteLyncUserPlan", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int DeleteLyncUserPlan(int itemId, int lyncUserPlanId) {
@ -815,11 +838,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void CreateLyncUserCompletedEventHandler(object sender, CreateLyncUserCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CreateLyncUserCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -841,11 +864,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void DeleteLyncUserCompletedEventHandler(object sender, DeleteLyncUserCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class DeleteLyncUserCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -867,11 +890,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetLyncUsersPagedCompletedEventHandler(object sender, GetLyncUsersPagedCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetLyncUsersPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -893,11 +916,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetLyncUsersByPlanIdCompletedEventHandler(object sender, GetLyncUsersByPlanIdCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetLyncUsersByPlanIdCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -919,11 +942,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetLyncUserCountCompletedEventHandler(object sender, GetLyncUserCountCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetLyncUserCountCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -945,11 +968,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetLyncUserPlansCompletedEventHandler(object sender, GetLyncUserPlansCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetLyncUserPlansCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -971,11 +994,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetLyncUserPlanCompletedEventHandler(object sender, GetLyncUserPlanCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetLyncUserPlanCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -997,11 +1020,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void AddLyncUserPlanCompletedEventHandler(object sender, AddLyncUserPlanCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class AddLyncUserPlanCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -1023,11 +1046,37 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void UpdateLyncUserPlanCompletedEventHandler(object sender, UpdateLyncUserPlanCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class UpdateLyncUserPlanCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal UpdateLyncUserPlanCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public int Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void DeleteLyncUserPlanCompletedEventHandler(object sender, DeleteLyncUserPlanCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class DeleteLyncUserPlanCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -1049,11 +1098,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetOrganizationDefaultLyncUserPlanCompletedEventHandler(object sender, SetOrganizationDefaultLyncUserPlanCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SetOrganizationDefaultLyncUserPlanCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -1075,11 +1124,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetLyncUserGeneralSettingsCompletedEventHandler(object sender, GetLyncUserGeneralSettingsCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetLyncUserGeneralSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -1101,11 +1150,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetUserLyncPlanCompletedEventHandler(object sender, SetUserLyncPlanCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SetUserLyncPlanCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -1127,11 +1176,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetFederationDomainsCompletedEventHandler(object sender, GetFederationDomainsCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetFederationDomainsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -1153,11 +1202,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void AddFederationDomainCompletedEventHandler(object sender, AddFederationDomainCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class AddFederationDomainCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -1179,11 +1228,11 @@ namespace WebsitePanel.EnterpriseServer {
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void RemoveFederationDomainCompletedEventHandler(object sender, RemoveFederationDomainCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class RemoveFederationDomainCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {

View file

@ -3296,6 +3296,7 @@ namespace WebsitePanel.EnterpriseServer
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),
@ -3309,6 +3310,27 @@ namespace WebsitePanel.EnterpriseServer
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)
);
}
public static void DeleteLyncUserPlan(int lyncUserPlanId)
{
SqlHelper.ExecuteNonQuery(

View file

@ -539,6 +539,16 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
try
{
List<LyncUserPlan> plans = new List<LyncUserPlan>();
UserInfo user = ObjectUtils.FillObjectFromDataReader<UserInfo>(DataProvider.GetUserByExchangeOrganizationIdInternally(itemId));
LyncController.GetLyncUserPlansByUser(user, ref plans);
return plans;
return ObjectUtils.CreateListFromDataReader<LyncUserPlan>(
DataProvider.GetLyncUserPlans(itemId));
}
@ -552,6 +562,43 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
}
private static void GetLyncUserPlansByUser(UserInfo user, ref List<LyncUserPlan> plans)
{
if ((user != null))
{
List<Organization> orgs = null;
if (user.UserId != 1)
{
List<PackageInfo> Packages = PackageController.GetPackages(user.UserId);
if ((Packages != null) & (Packages.Count > 0))
{
orgs = ExchangeServerController.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
orgs = ExchangeServerController.GetExchangeOrganizations(1, false);
}
if ((orgs != null) & (orgs.Count > 0))
{
List<LyncUserPlan> Plans = ObjectUtils.CreateListFromDataReader<LyncUserPlan>(DataProvider.GetLyncUserPlans(orgs[0].Id));
foreach (LyncUserPlan p in Plans)
{
plans.Add(p);
}
}
UserInfo owner = UserController.GetUserInternally(user.OwnerId);
GetLyncUserPlansByUser(owner, ref plans);
}
}
public static LyncUserPlan GetLyncUserPlan(int itemID, int lyncUserPlanId)
{
@ -611,6 +658,50 @@ namespace WebsitePanel.EnterpriseServer.Code.HostedSolution
}
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);

View file

@ -94,6 +94,13 @@ namespace WebsitePanel.EnterpriseServer
return LyncController.AddLyncUserPlan(itemId, lyncUserPlan);
}
[WebMethod]
public int UpdateLyncUserPlan(int itemId, LyncUserPlan lyncUserPlan)
{
return LyncController.UpdateLyncUserPlan(itemId, lyncUserPlan);
}
[WebMethod]
public int DeleteLyncUserPlan(int itemId, int lyncUserPlanId)
{

View file

@ -35,6 +35,7 @@ namespace WebsitePanel.Providers.HostedSolution
public class LyncUserPlan
{
int lyncUserPlanId;
int itemId;
string lyncUserPlanName;
bool im;
@ -44,9 +45,16 @@ namespace WebsitePanel.Providers.HostedSolution
bool mobility;
bool mobilityEnableOutsideVoice;
LyncVoicePolicyType voicePolicy;
int lyncUserPlanType;
bool isDefault;
public int ItemId
{
get { return this.itemId; }
set { this.itemId = value; }
}
public int LyncUserPlanId
{
get { return this.lyncUserPlanId; }
@ -59,6 +67,13 @@ namespace WebsitePanel.Providers.HostedSolution
set { this.lyncUserPlanName = value; }
}
public int LyncUserPlanType
{
get { return this.lyncUserPlanType; }
set { this.lyncUserPlanType = value; }
}
public bool IM
{
get { return this.im; }

View file

@ -0,0 +1,37 @@
// 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.
namespace WebsitePanel.Providers.HostedSolution
{
public enum LyncUserPlanType
{
User = 0,
Reseller = 1,
Administrator = 2
}
}

View file

@ -88,6 +88,7 @@
<Compile Include="HostedSolution\LyncFederationDomain.cs" />
<Compile Include="HostedSolution\LyncUser.cs" />
<Compile Include="HostedSolution\LyncUserPlan.cs" />
<Compile Include="HostedSolution\LyncUserPlanType.cs" />
<Compile Include="HostedSolution\LyncUsersPaged.cs" />
<Compile Include="HostedSolution\LyncVoicePolicyType.cs" />
<Compile Include="HostedSolution\TransactionAction.cs" />

View file

@ -40,6 +40,9 @@ namespace WebsitePanel.Portal.Lync
if (!IsPostBack)
{
PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId);
if (PanelRequest.GetInt("LyncUserPlanId") != 0)
{
Providers.HostedSolution.LyncUserPlan plan = ES.Services.Lync.GetLyncUserPlan(PanelRequest.ItemID, PanelRequest.GetInt("LyncUserPlanId"));
@ -81,7 +84,6 @@ namespace WebsitePanel.Portal.Lync
chkIM.Checked = true;
chkIM.Enabled = false;
chkNone.Checked = true;
PackageContext cntx = ES.Services.Packages.GetPackageContext(PanelSecurity.PackageId);
if (cntx != null)
{
foreach (QuotaValueInfo quota in cntx.QuotasArray)

View file

@ -34,6 +34,11 @@
<asp:GridView ID="gvPlans" runat="server" AutoGenerateColumns="False" EnableViewState="true"
Width="100%" EmptyDataText="gvPlans" CssSelectorClass="NormalGridView" OnRowCommand="gvPlan_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="img2" runat="server" Width="16px" Height="16px" ImageUrl='<%# GetPlanType((int)Eval("LyncUserPlanType")) %>' ImageAlign="AbsMiddle" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvPlan">
<ItemStyle Width="70%"></ItemStyle>
<ItemTemplate>

View file

@ -106,6 +106,16 @@ namespace WebsitePanel.Portal.Lync
try
{
LyncUserPlan plan = ES.Services.Lync.GetLyncUserPlan(PanelRequest.ItemID, planId);
if (plan.LyncUserPlanType > 0)
{
ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindPlans();
return;
}
int result = ES.Services.Lync.DeleteLyncUserPlan(PanelRequest.ItemID, planId);
if (result < 0)
@ -113,6 +123,9 @@ namespace WebsitePanel.Portal.Lync
messageBox.ShowResultMessage(result);
return;
}
else
ShowSuccessMessage("REQUEST_COMPLETED_SUCCESFULLY");
}
catch (Exception)
@ -131,8 +144,19 @@ namespace WebsitePanel.Portal.Lync
try
{
LyncUserPlan plan = ES.Services.Lync.GetLyncUserPlan(PanelRequest.ItemID, planId);
if (plan.LyncUserPlanType > 0)
{
ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindPlans();
return;
}
ES.Services.Lync.SetOrganizationDefaultLyncUserPlan(PanelRequest.ItemID, planId);
ShowSuccessMessage("REQUEST_COMPLETED_SUCCESFULLY");
// rebind domains
BindPlans();
}
@ -170,5 +194,29 @@ namespace WebsitePanel.Portal.Lync
}
}
public string GetPlanType(int planType)
{
string imgName = string.Empty;
LyncUserPlanType type = (LyncUserPlanType)planType;
switch (type)
{
case LyncUserPlanType.Reseller:
imgName = "company24.png";
break;
case LyncUserPlanType.Administrator:
imgName = "company24.png";
break;
default:
imgName = "admin_16.png";
break;
}
return GetThemedImage("Exchange/" + imgName);
}
}
}

View file

@ -1,31 +1,3 @@
// 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.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.

View file

@ -12,6 +12,11 @@
<ItemTemplate>
<asp:ImageButton ID="cmdEdit" runat="server" SkinID="EditSmall" CommandName="EditItem" AlternateText="Edit record" CommandArgument='<%# Eval("LyncUserPlanId") %>' ></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="img2" runat="server" Width="16px" Height="16px" ImageUrl='<%# GetPlanType((int)Eval("LyncUserPlanType")) %>' ImageAlign="AbsMiddle" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvPlan">
<ItemStyle Width="70%"></ItemStyle>
@ -19,13 +24,6 @@
<asp:Label id="lnkDisplayPlan" runat="server" EnableViewState="true" ><%# Eval("LyncUserPlanName")%></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="gvPlanDefault">
<ItemTemplate>
<div style="text-align:center">
<input type="radio" name="DefaultPlan" value='<%# Eval("LyncUserPlanId") %>' <%# IsChecked((bool)Eval("IsDefault")) %> />
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
&nbsp;<asp:ImageButton id="imgDelPlan" runat="server" Text="Delete" SkinID="ExchangeDelete"
@ -33,13 +31,15 @@
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected plan?')"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="btnStamp" runat="server" meta:resourcekey="btnStamp"
Text="Restamp all lync users with this plan" CssClass="Button1" CommandName="RestampItem" CommandArgument='<%# Eval("LyncUserPlanId") %>' OnClientClick="if (confirm('Restamp lync user with this plan.\n\nAre you sure you want to restamp the lync users ?')) ShowProgressDialog('Stamping lync users, this might take a while ...'); else return false;"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<div style="text-align: center">
<asp:Button ID="btnSetDefaultPlan" runat="server" meta:resourcekey="btnSetDefaulPlan"
Text="Set Default Lync user plan" CssClass="Button1" OnClick="btnSetDefaultPlan_Click" />
</div>
<wsp:CollapsiblePanel id="secPlan" runat="server"
TargetControlID="Plan" meta:resourcekey="secPlan" Text="Plan">
</wsp:CollapsiblePanel>
@ -131,14 +131,29 @@
<br />
<table>
<tr>
<td>
<div class="FormButtonsBarClean">
<asp:Button ID="btnAddPlan" runat="server" meta:resourcekey="btnAddPlan"
Text="Add New plan" CssClass="Button1" OnClick="btnAddPlan_Click" />
</div>
</td>
<td>
<div class="FormButtonsBarClean">
<asp:Button ID="btnAddPlanToOrganizations" runat="server" meta:resourcekey="btnAddPlanToOrganizations"
Text="Add Plans Template to All Organizations" CssClass="Button1" OnClick="btnAddPlanToOrganizations_Click" OnClientClick="if (confirm('Plans with an existing name will not be added. \nAre you sure you want to add the plans template to all tenants ?')) ShowProgressDialog('Adding plans, this might take a while ...'); else return false;"/>
<asp:Button ID="btnUpdatePlan" runat="server" meta:resourcekey="btnUpdatePlan"
Text="Update Plan" CssClass="Button1" OnClick="btnUpdatePlan_Click" />
</div>
</td>
</tr>
</table>
<br />
<asp:TextBox ID="txtStatus" runat="server" CssClass="TextBox400" MaxLength="128" ReadOnly="true"></asp:TextBox>

View file

@ -55,34 +55,43 @@ namespace WebsitePanel.Portal
internal static List<LyncUserPlan> list;
public void BindSettings(UserSettings settings)
{
BindPlans();
if (list == null)
list = new List<LyncUserPlan>();
if (!string.IsNullOrEmpty(settings[UserSettings.DEFAULT_LYNCUSERPLANS]))
{
XmlSerializer serializer = new XmlSerializer(list.GetType());
StringReader reader = new StringReader(settings[UserSettings.DEFAULT_LYNCUSERPLANS]);
list = (List<LyncUserPlan>)serializer.Deserialize(reader);
txtStatus.Visible = false;
}
private void BindPlans()
{
Providers.HostedSolution.Organization[] orgs = null;
if (PanelSecurity.SelectedUserId != 1)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
LyncUserPlan[] list = ES.Services.Lync.GetLyncUserPlans(orgs[0].Id);
gvPlans.DataSource = list;
gvPlans.DataBind();
if (gvPlans.Rows.Count <= 1)
{
btnSetDefaultPlan.Enabled = false;
}
else
btnSetDefaultPlan.Enabled = true;
}
btnUpdatePlan.Enabled = (string.IsNullOrEmpty(txtPlan.Text)) ? false : true;
}
@ -134,55 +143,126 @@ namespace WebsitePanel.Portal
}
if (list == null)
list = new List<LyncUserPlan>();
if (PanelSecurity.SelectedUser.Role == UserRole.Administrator)
plan.LyncUserPlanType = (int)LyncUserPlanType.Administrator;
else
if (PanelSecurity.SelectedUser.Role == UserRole.Reseller)
plan.LyncUserPlanType = (int)LyncUserPlanType.Reseller;
list.Add(plan);
gvPlans.DataSource = list;
gvPlans.DataBind();
if (gvPlans.Rows.Count <= 1)
Providers.HostedSolution.Organization[] orgs = null;
if (PanelSecurity.SelectedUserId != 1)
{
btnSetDefaultPlan.Enabled = false;
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
btnSetDefaultPlan.Enabled = true;
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
int result = ES.Services.Lync.AddLyncUserPlan(orgs[0].Id, plan);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
}
BindPlans();
}
protected void gvPlan_RowCommand(object sender, GridViewCommandEventArgs e)
{
int planId = Utils.ParseInt(e.CommandArgument.ToString(), 0);
Providers.HostedSolution.Organization[] orgs = null;
Providers.HostedSolution.LyncUserPlan plan;
int result = 0;
switch (e.CommandName)
{
case "DeleteItem":
try
{
foreach (LyncUserPlan p in list)
if (PanelSecurity.SelectedUserId != 1)
{
if (p.LyncUserPlanId == planId)
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
list.Remove(p);
break;
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
gvPlans.DataSource = list;
gvPlans.DataBind();
if (gvPlans.Rows.Count <= 1)
{
btnSetDefaultPlan.Enabled = false;
}
else
btnSetDefaultPlan.Enabled = true;
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
plan = ES.Services.Lync.GetLyncUserPlan(orgs[0].Id, planId);
if (plan.ItemId != orgs[0].Id)
{
messageBox.ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindPlans();
return;
}
result = ES.Services.ExchangeServer.DeleteExchangeMailboxPlan(orgs[0].Id, planId);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
ViewState["LyncUserPlanID"] = null;
txtPlan.Text = string.Empty;
btnUpdatePlan.Enabled = (string.IsNullOrEmpty(txtPlan.Text)) ? false : true;
}
catch (Exception)
{
messageBox.ShowErrorMessage("EXCHANGE_DELETE_MAILBOXPLAN");
}
BindPlans();
break;
case "EditItem":
foreach (LyncUserPlan plan in list)
try
{
if (plan.LyncUserPlanId == planId)
ViewState["LyncUserPlanID"] = planId;
if (PanelSecurity.SelectedUserId != 1)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
plan = ES.Services.Lync.GetLyncUserPlan(orgs[0].Id, planId);
txtPlan.Text = plan.LyncUserPlanName;
chkIM.Checked = plan.IM;
@ -212,63 +292,166 @@ namespace WebsitePanel.Portal
break;
}
btnUpdatePlan.Enabled = (string.IsNullOrEmpty(txtPlan.Text)) ? false : true;
break;
}
catch (Exception)
{
messageBox.ShowErrorMessage("EXCHANGE_DELETE_MAILBOXPLAN");
}
BindPlans();
break;
case "RestampItem":
RestampLyncUsers(planId, planId);
break;
}
}
public string GetPlanType(int planType)
{
string imgName = string.Empty;
LyncUserPlanType type = (LyncUserPlanType)planType;
switch (type)
{
case LyncUserPlanType.Reseller:
imgName = "company24.png";
break;
case LyncUserPlanType.Administrator:
imgName = "company24.png";
break;
default:
imgName = "admin_16.png";
break;
}
return GetThemedImage("Exchange/" + imgName);
}
protected void btnSetDefaultPlan_Click(object sender, EventArgs e)
{
// get domain
int planId = Utils.ParseInt(Request.Form["DefaultLyncUserPlan"], 0);
foreach (LyncUserPlan p in list)
{
p.IsDefault = false;
}
foreach (LyncUserPlan p in list)
{
if (p.LyncUserPlanId == planId)
{
p.IsDefault = true;
break;
}
}
gvPlans.DataSource = list;
gvPlans.DataBind();
}
public void SaveSettings(UserSettings settings)
{
XmlSerializer serializer = new XmlSerializer(list.GetType());
StringWriter writer = new StringWriter();
serializer.Serialize(writer, list);
settings[UserSettings.DEFAULT_LYNCUSERPLANS] = writer.ToString();
}
protected void btnAddPlanToOrganizations_Click(object sender, EventArgs e)
{
AddPlanToOrganizations("ServerAdmin");
settings["LyncUserPlansPolicy"] = "";
}
private void AddPlanToOrganizations(string serverAdmin)
protected void btnUpdatePlan_Click(object sender, EventArgs e)
{
UserInfo ServerAdminInfo = ES.Services.Users.GetUserByUsername(serverAdmin);
if (ServerAdminInfo == null) return;
if (ViewState["LyncUserPlanID"] == null)
return;
UserInfo[] UsersInfo = ES.Services.Users.GetUsers(ServerAdminInfo.UserId, true);
int planId = (int)ViewState["LyncUserPlanID"];
Providers.HostedSolution.Organization[] orgs = null;
Providers.HostedSolution.LyncUserPlan plan;
if (PanelSecurity.SelectedUserId != 1)
{
PackageInfo[] Packages = ES.Services.Packages.GetPackages(PanelSecurity.SelectedUserId);
if ((Packages != null) & (Packages.GetLength(0) > 0))
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(Packages[0].PackageId, false);
}
}
else
{
orgs = ES.Services.ExchangeServer.GetExchangeOrganizations(1, false);
}
plan = ES.Services.Lync.GetLyncUserPlan(orgs[0].Id, planId);
if (plan.ItemId != orgs[0].Id)
{
messageBox.ShowErrorMessage("EXCHANGE_UNABLE_USE_SYSTEMPLAN");
BindPlans();
return;
}
plan = new Providers.HostedSolution.LyncUserPlan();
plan.LyncUserPlanId = (int)ViewState["LyncUserPlanID"];
plan.LyncUserPlanName = txtPlan.Text;
plan.IsDefault = false;
plan.IM = true;
plan.Mobility = chkMobility.Checked;
plan.Federation = chkFederation.Checked;
plan.Conferencing = chkConferencing.Checked;
plan.EnterpriseVoice = chkEnterpriseVoice.Checked;
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;
}
if (PanelSecurity.SelectedUser.Role == UserRole.Administrator)
plan.LyncUserPlanType = (int)LyncUserPlanType.Administrator;
else
if (PanelSecurity.SelectedUser.Role == UserRole.Reseller)
plan.LyncUserPlanType = (int)LyncUserPlanType.Reseller;
if ((orgs != null) & (orgs.GetLength(0) > 0))
{
int result = ES.Services.Lync.UpdateLyncUserPlan(orgs[0].Id, plan);
if (result < 0)
{
messageBox.ShowErrorMessage("EXCHANGE_UPDATEPLANS");
}
else
{
messageBox.ShowSuccessMessage("EXCHANGE_UPDATEPLANS");
}
}
BindPlans();
}
private bool PlanExists(LyncUserPlan plan, LyncUserPlan[] plans)
{
bool result = false;
foreach (LyncUserPlan p in plans)
{
if (p.LyncUserPlanName.ToLower() == plan.LyncUserPlanName.ToLower())
{
result = true;
break;
}
}
return result;
}
protected void txtMailboxPlan_TextChanged(object sender, EventArgs e)
{
btnUpdatePlan.Enabled = (string.IsNullOrEmpty(txtPlan.Text)) ? false : true;
}
private void RestampLyncUsers(int sourcePlanId, int destinationPlanId)
{
UserInfo[] UsersInfo = ES.Services.Users.GetUsers(PanelSecurity.SelectedUserId, true);
try
{
@ -290,11 +473,18 @@ namespace WebsitePanel.Portal
{
if (!string.IsNullOrEmpty(org.LyncTenantId))
{
LyncUserPlan[] plans = ES.Services.Lync.GetLyncUserPlans(org.Id);
LyncUser[] Accounts = ES.Services.Lync.GetLyncUsersByPlanId(org.Id, sourcePlanId);
foreach (LyncUserPlan p in list)
foreach (LyncUser a in Accounts)
{
if (!PlanExists(p, plans)) ES.Services.Lync.AddLyncUserPlan(org.Id, p);
txtStatus.Text = "Completed";
Providers.ResultObjects.LyncUserResult result = ES.Services.Lync.SetUserLyncPlan(org.Id, a.AccountID, destinationPlanId);
if (!result.IsSuccess)
{
BindPlans();
txtStatus.Text = "Error: " + a.DisplayName;
messageBox.ShowErrorMessage("EXCHANGE_STAMPMAILBOXES");
return;
}
}
}
@ -302,29 +492,16 @@ namespace WebsitePanel.Portal
}
}
}
messageBox.ShowSuccessMessage("LYNC_APPLYPLANTEMPLATE");
}
messageBox.ShowSuccessMessage("EXCHANGE_STAMPMAILBOXES");
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("LYNC_APPLYPLANTEMPLATE", ex);
}
messageBox.ShowErrorMessage("EXCHANGE_FAILED_TO_STAMP", ex);
}
private bool PlanExists(LyncUserPlan plan, LyncUserPlan[] plans)
{
bool result = false;
foreach (LyncUserPlan p in plans)
{
if (p.LyncUserPlanName.ToLower() == plan.LyncUserPlanName.ToLower())
{
result = true;
break;
BindPlans();
}
}
return result;
}
}

View file

@ -39,15 +39,6 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.GridView gvPlans;
/// <summary>
/// btnSetDefaultPlan control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSetDefaultPlan;
/// <summary>
/// secPlan control.
/// </summary>
@ -220,12 +211,21 @@ namespace WebsitePanel.Portal {
protected global::System.Web.UI.WebControls.Button btnAddPlan;
/// <summary>
/// btnAddPlanToOrganizations control.
/// btnUpdatePlan control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnAddPlanToOrganizations;
protected global::System.Web.UI.WebControls.Button btnUpdatePlan;
/// <summary>
/// txtStatus control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtStatus;
}
}

View file

@ -35,8 +35,8 @@ REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ecStorefrontProxy.cs
REM %WSDL% %SERVER_URL%/ecStorehouse.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ecStorehouseProxy.cs /namespace:WebsitePanel.Ecommerce.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ecStorehouseProxy.cs
%WSDL% %SERVER_URL%/esExchangeServer.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
%WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs
REM %WSDL% %SERVER_URL%/esExchangeServer.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ExchangeServerProxy.cs
REM %WSDL% %SERVER_URL%/esExchangeHostedEdition.asmx /out:.\WebsitePanel.EnterpriseServer.Client\ExchangeHostedEditionProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\ExchangeHostedEditionProxy.cs
@ -92,8 +92,8 @@ REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\WebServersProxy.cs
REM %WSDL% %SERVER_URL%/esVirtualizationServerForPrivateCloud.asmx /out:.\WebsitePanel.EnterpriseServer.Client\VirtualizationServerProxyForPrivateCloud.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\VirtualizationServerProxyForPrivateCloud.cs
REM %WSDL% %SERVER_URL%/esLync.asmx /out:.\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs
%WSDL% %SERVER_URL%/esLync.asmx /out:.\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
%WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs