service levels fixes.

This commit is contained in:
vfedosevich 2014-09-12 17:44:58 +03:00
parent b1c52c36eb
commit bc46549393
8 changed files with 66 additions and 27 deletions

View file

@ -61,7 +61,6 @@
<ItemStyle Width="20%"></ItemStyle>
<ItemTemplate>
<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"
NavigateUrl='<%# GetMailboxEditUrl(Eval("AccountId").ToString()) %>'>
<%# Eval("DisplayName") %>

View file

@ -45,6 +45,8 @@ namespace WebsitePanel.Portal.ExchangeServer
}
}
private PackageContext cntx;
private ServiceLevel[] ServiceLevels;
protected void Page_Load(object sender, EventArgs e)
@ -60,7 +62,7 @@ namespace WebsitePanel.Portal.ExchangeServer
BindServiceLevels();
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER))
{
if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1)
@ -122,7 +124,7 @@ namespace WebsitePanel.Portal.ExchangeServer
else if (accountType == ExchangeAccountType.Equipment)
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);
}
@ -197,7 +199,21 @@ namespace WebsitePanel.Portal.ExchangeServer
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;
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;
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))
{

View file

@ -62,7 +62,6 @@
<ItemStyle Width="25%"></ItemStyle>
<ItemTemplate>
<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"
NavigateUrl='<%# GetUserEditUrl(Eval("AccountId").ToString()) %>'>
<%# Eval("DisplayName") %>

View file

@ -39,6 +39,7 @@ namespace WebsitePanel.Portal.HostedSolution
public partial class OrganizationUsers : WebsitePanelModuleBase
{
private ServiceLevel[] ServiceLevels;
private PackageContext cntx;
protected void Page_Load(object sender, EventArgs e)
{
@ -49,7 +50,7 @@ namespace WebsitePanel.Portal.HostedSolution
BindServiceLevels();
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (cntx.Quotas.ContainsKey(Quotas.EXCHANGE2007_ISCONSUMER))
{
if (cntx.Quotas[Quotas.EXCHANGE2007_ISCONSUMER].QuotaAllocatedValue != 1)
@ -191,7 +192,7 @@ namespace WebsitePanel.Portal.HostedSolution
imgName = "admin_16.png";
break;
}
if (vip) imgName = "admin_16.png";
if (vip && cntx.Groups.ContainsKey(ResourceGroups.ServiceLevels)) imgName = "vip_user_16.png";
return GetThemedImage("Exchange/" + imgName);
}
@ -311,7 +312,21 @@ namespace WebsitePanel.Portal.HostedSolution
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;
}
}
}