This commit is contained in:
dev_amdtel 2014-09-12 20:47:38 +04:00
commit dcf8d4c63e
8 changed files with 66 additions and 27 deletions

View file

@ -4523,6 +4523,12 @@ CREATE TABLE SupportServiceLevels
) )
GO 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='ExchangeAccounts' AND COLS.name='LevelID')
ALTER TABLE [dbo].[ExchangeAccounts] ADD
[LevelID] [int] NULL,
[IsVIP] [bit] NOT NULL DEFAULT 0
GO
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetSupportServiceLevels') IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetSupportServiceLevels')
DROP PROCEDURE GetSupportServiceLevels DROP PROCEDURE GetSupportServiceLevels
GO GO
@ -4707,13 +4713,7 @@ END
RETURN RETURN
GO 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='ExchangeAccounts' AND COLS.name='LevelID')
BEGIN
ALTER TABLE [dbo].[ExchangeAccounts] ADD
[LevelID] [int] NULL,
[IsVIP] [bit] NOT NULL DEFAULT 0
END
GO
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type IN ('FN', 'IF', 'TF') AND name = 'GetPackageServiceLevelResource') IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type IN ('FN', 'IF', 'TF') AND name = 'GetPackageServiceLevelResource')
DROP FUNCTION GetPackageServiceLevelResource DROP FUNCTION GetPackageServiceLevelResource

View file

@ -618,7 +618,7 @@ namespace WebsitePanel.Import.CsvBulk
mailbox.JobTitle, mailbox.Company, mailbox.Department, mailbox.Office, null, mailbox.BusinessPhone, mailbox.JobTitle, mailbox.Company, mailbox.Department, mailbox.Office, null, mailbox.BusinessPhone,
mailbox.Fax, mailbox.HomePhone, mailbox.MobilePhone, mailbox.Pager, mailbox.WebPage, mailbox.Notes, mailbox.Fax, mailbox.HomePhone, mailbox.MobilePhone, mailbox.Pager, mailbox.WebPage, mailbox.Notes,
// these are new and not in csv ... // these are new and not in csv ...
mailbox.ExternalEmail, mailbox.SubscriberNumber); mailbox.ExternalEmail, mailbox.SubscriberNumber,mailbox.LevelId, mailbox.IsVIP);
ret = true; ret = true;
} }
catch (Exception ex) catch (Exception ex)
@ -762,7 +762,7 @@ namespace WebsitePanel.Import.CsvBulk
null, false, user.Disabled, user.Locked, user.FirstName, user.Initials, null, false, user.Disabled, user.Locked, user.FirstName, user.Initials,
user.LastName, user.Address, user.City, user.State, user.Zip, user.Country, user.LastName, user.Address, user.City, user.State, user.Zip, user.Country,
user.JobTitle, user.Company, user.Department, user.Office, null, user.BusinessPhone, user.JobTitle, user.Company, user.Department, user.Office, null, user.BusinessPhone,
user.Fax, user.HomePhone, user.MobilePhone, user.Pager, user.WebPage, user.Notes, user.ExternalEmail, user.SubscriberNumber); user.Fax, user.HomePhone, user.MobilePhone, user.Pager, user.WebPage, user.Notes, user.ExternalEmail, user.SubscriberNumber, user.LevelId, user.IsVIP);
ret = true; ret = true;
} }
catch (Exception ex) catch (Exception ex)

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

View file

@ -61,7 +61,6 @@
<ItemStyle Width="20%"></ItemStyle> <ItemStyle Width="20%"></ItemStyle>
<ItemTemplate> <ItemTemplate>
<asp:Image ID="img1" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType"),(bool)Eval("IsVIP")) %>' ImageAlign="AbsMiddle" /> <asp:Image ID="img1" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType"),(bool)Eval("IsVIP")) %>' ImageAlign="AbsMiddle" />
<asp:Label runat="server" Text='<%# (bool)Eval("IsVIP") ? "*" : string.Empty %>' style="font-weight:bold;"/>
<asp:hyperlink id="lnk1" runat="server" <asp:hyperlink id="lnk1" runat="server"
NavigateUrl='<%# GetMailboxEditUrl(Eval("AccountId").ToString()) %>'> NavigateUrl='<%# GetMailboxEditUrl(Eval("AccountId").ToString()) %>'>
<%# Eval("DisplayName") %> <%# Eval("DisplayName") %>

View file

@ -45,6 +45,8 @@ namespace WebsitePanel.Portal.ExchangeServer
} }
} }
private PackageContext cntx;
private ServiceLevel[] ServiceLevels; private ServiceLevel[] ServiceLevels;
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
@ -60,7 +62,7 @@ namespace WebsitePanel.Portal.ExchangeServer
BindServiceLevels(); BindServiceLevels();
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER))
{ {
if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1)
@ -122,7 +124,7 @@ namespace WebsitePanel.Portal.ExchangeServer
else if (accountType == ExchangeAccountType.Equipment) else if (accountType == ExchangeAccountType.Equipment)
imgName = "equipment_16.gif"; imgName = "equipment_16.gif";
if (vip) imgName = "admin_16.png"; if (vip && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) imgName = "vip_user_16.png";
return GetThemedImage("Exchange/" + imgName); return GetThemedImage("Exchange/" + imgName);
} }
@ -197,7 +199,21 @@ namespace WebsitePanel.Portal.ExchangeServer
public ServiceLevel GetServiceLevel(int levelId) public ServiceLevel GetServiceLevel(int levelId)
{ {
return ServiceLevels.Where(x => x.LevelId == levelId).DefaultIfEmpty(new ServiceLevel { LevelName = "", LevelDescription = "" }).FirstOrDefault(); ServiceLevel serviceLevel = ServiceLevels.Where(x => x.LevelId == levelId).DefaultIfEmpty(new ServiceLevel { LevelName = "", LevelDescription = "" }).FirstOrDefault();
bool enable = !string.IsNullOrEmpty(serviceLevel.LevelName);
enable = enable ? cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName) : false;
enable = enable ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue > 0 : false;
if (!enable)
{
serviceLevel.LevelName = "";
serviceLevel.LevelDescription = "";
}
//return ServiceLevels.Where(x => x.LevelId == levelId).DefaultIfEmpty(new ServiceLevel { LevelName = "", LevelDescription = "" }).FirstOrDefault();
return serviceLevel;
} }
} }
} }

View file

@ -86,17 +86,7 @@ namespace WebsitePanel.Portal.HostedSolution
txtInitials.Text = user.Initials; txtInitials.Text = user.Initials;
txtLastName.Text = user.LastName; txtLastName.Text = user.LastName;
if (user.LevelId > 0 && secServiceLevels.Visible)
{
ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(user.LevelId);
if (ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()) == null)
ddlServiceLevels.Items.Add(new ListItem(serviceLevel.LevelName, serviceLevel.LevelId.ToString()));
ddlServiceLevels.Items.FindByValue(string.Empty).Selected = false;
ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()).Selected = true;
}
chkVIP.Checked = user.IsVIP && secServiceLevels.Visible;
txtJobTitle.Text = user.JobTitle; txtJobTitle.Text = user.JobTitle;
txtCompany.Text = user.Company; txtCompany.Text = user.Company;
@ -136,6 +126,26 @@ namespace WebsitePanel.Portal.HostedSolution
} }
} }
if (user.LevelId > 0 && secServiceLevels.Visible)
{
ServiceLevel serviceLevel = ES.Services.Organizations.GetSupportServiceLevel(user.LevelId);
bool addLevel = ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()) == null;
addLevel = addLevel && cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName);
addLevel = addLevel ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue > 0 : addLevel;
if (addLevel)
{
ddlServiceLevels.Items.Add(new ListItem(serviceLevel.LevelName, serviceLevel.LevelId.ToString()));
ddlServiceLevels.Items.FindByValue(string.Empty).Selected = false;
ddlServiceLevels.Items.FindByValue(serviceLevel.LevelId.ToString()).Selected = true;
}
}
chkVIP.Checked = user.IsVIP && secServiceLevels.Visible;
if (cntx.Quotas.ContainsKey(Quotas.ORGANIZATION_ALLOWCHANGEUPN)) if (cntx.Quotas.ContainsKey(Quotas.ORGANIZATION_ALLOWCHANGEUPN))
{ {

View file

@ -62,7 +62,6 @@
<ItemStyle Width="25%"></ItemStyle> <ItemStyle Width="25%"></ItemStyle>
<ItemTemplate> <ItemTemplate>
<asp:Image ID="img1" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType"),(bool)Eval("IsVIP")) %>' ImageAlign="AbsMiddle"/> <asp:Image ID="img1" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType"),(bool)Eval("IsVIP")) %>' ImageAlign="AbsMiddle"/>
<asp:Label runat="server" Text='<%# (bool)Eval("IsVIP") ? "*" : string.Empty %>' style="font-weight:bold;"/>
<asp:hyperlink id="lnk1" runat="server" <asp:hyperlink id="lnk1" runat="server"
NavigateUrl='<%# GetUserEditUrl(Eval("AccountId").ToString()) %>'> NavigateUrl='<%# GetUserEditUrl(Eval("AccountId").ToString()) %>'>
<%# Eval("DisplayName") %> <%# Eval("DisplayName") %>

View file

@ -39,6 +39,7 @@ namespace WebsitePanel.Portal.HostedSolution
public partial class OrganizationUsers : WebsitePanelModuleBase public partial class OrganizationUsers : WebsitePanelModuleBase
{ {
private ServiceLevel[] ServiceLevels; private ServiceLevel[] ServiceLevels;
private PackageContext cntx;
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
@ -49,7 +50,7 @@ namespace WebsitePanel.Portal.HostedSolution
BindServiceLevels(); BindServiceLevels();
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId); cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER)) if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER))
{ {
if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1) if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1)
@ -191,7 +192,7 @@ namespace WebsitePanel.Portal.HostedSolution
imgName = "admin_16.png"; imgName = "admin_16.png";
break; break;
} }
if (vip) imgName = "admin_16.png"; if (vip && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) imgName = "vip_user_16.png";
return GetThemedImage("Exchange/" + imgName); return GetThemedImage("Exchange/" + imgName);
} }
@ -311,7 +312,21 @@ namespace WebsitePanel.Portal.HostedSolution
public ServiceLevel GetServiceLevel(int levelId) public ServiceLevel GetServiceLevel(int levelId)
{ {
return ServiceLevels.Where(x => x.LevelId == levelId).DefaultIfEmpty(new ServiceLevel { LevelName = "", LevelDescription = "" }).FirstOrDefault(); ServiceLevel serviceLevel = ServiceLevels.Where(x => x.LevelId == levelId).DefaultIfEmpty(new ServiceLevel { LevelName = "", LevelDescription = "" }).FirstOrDefault();
bool enable = !string.IsNullOrEmpty(serviceLevel.LevelName);
enable = enable ? cntx.Quotas.ContainsKey(Quotas.SERVICE_LEVELS + serviceLevel.LevelName) : false;
enable = enable ? cntx.Quotas[Quotas.SERVICE_LEVELS + serviceLevel.LevelName].QuotaAllocatedValue > 0 : false;
if (!enable)
{
serviceLevel.LevelName = "";
serviceLevel.LevelDescription = "";
}
//return ServiceLevels.Where(x => x.LevelId == levelId).DefaultIfEmpty(new ServiceLevel { LevelName = "", LevelDescription = "" }).FirstOrDefault();
return serviceLevel;
} }
} }
} }