Merge
This commit is contained in:
commit
d2f8d2e923
9 changed files with 173 additions and 35 deletions
|
@ -158,7 +158,6 @@ order by rg.groupOrder
|
|||
public const string ORGANIZATION_USERS = "HostedSolution.Users";
|
||||
public const string ORGANIZATION_DOMAINS = "HostedSolution.Domains";
|
||||
public const string ORGANIZATION_ALLOWCHANGEUPN = "HostedSolution.AllowChangeUPN";
|
||||
//public const string ORGANIZATION_SECURITYGROUPMANAGEMENT = "HostedSolution.SecurityGroupManagement";
|
||||
public const string ORGANIZATION_SECURITYGROUPS = "HostedSolution.SecurityGroups";
|
||||
|
||||
public const string CRM_USERS = "HostedCRM.Users";
|
||||
|
|
|
@ -144,6 +144,8 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution
|
|||
|
||||
private System.Threading.SendOrPostCallback AddAdditionalGroupOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback SetDefaultOrganizationOperationCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public esOrganizations()
|
||||
{
|
||||
|
@ -267,6 +269,9 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution
|
|||
/// <remarks/>
|
||||
public event AddAdditionalGroupCompletedEventHandler AddAdditionalGroupCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event SetDefaultOrganizationCompletedEventHandler SetDefaultOrganizationCompleted;
|
||||
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CheckOrgIdExists", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
|
@ -2608,6 +2613,56 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetDefaultOrganization", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public void SetDefaultOrganization(int newDefaultOrganizationId, int currentDefaultOrganizationId)
|
||||
{
|
||||
this.Invoke("SetDefaultOrganization", new object[] {
|
||||
newDefaultOrganizationId,
|
||||
currentDefaultOrganizationId});
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginSetDefaultOrganization(int newDefaultOrganizationId, int currentDefaultOrganizationId, System.AsyncCallback callback, object asyncState)
|
||||
{
|
||||
return this.BeginInvoke("SetDefaultOrganization", new object[] {
|
||||
newDefaultOrganizationId,
|
||||
currentDefaultOrganizationId}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void EndSetDefaultOrganization(System.IAsyncResult asyncResult)
|
||||
{
|
||||
this.EndInvoke(asyncResult);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetDefaultOrganizationAsync(int newDefaultOrganizationId, int currentDefaultOrganizationId)
|
||||
{
|
||||
this.SetDefaultOrganizationAsync(newDefaultOrganizationId, currentDefaultOrganizationId, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetDefaultOrganizationAsync(int newDefaultOrganizationId, int currentDefaultOrganizationId, object userState)
|
||||
{
|
||||
if ((this.SetDefaultOrganizationOperationCompleted == null))
|
||||
{
|
||||
this.SetDefaultOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetDefaultOrganizationOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("SetDefaultOrganization", new object[] {
|
||||
newDefaultOrganizationId,
|
||||
currentDefaultOrganizationId}, this.SetDefaultOrganizationOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnSetDefaultOrganizationOperationCompleted(object arg)
|
||||
{
|
||||
if ((this.SetDefaultOrganizationCompleted != null))
|
||||
{
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.SetDefaultOrganizationCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public new void CancelAsync(object userState)
|
||||
{
|
||||
|
@ -3732,4 +3787,8 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void SetDefaultOrganizationCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
||||
}
|
|
@ -286,6 +286,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
TaskManager.WriteError(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static int CreateOrganization(int packageId, string organizationId, string organizationName, string domainName)
|
||||
{
|
||||
int itemId;
|
||||
|
@ -1276,6 +1277,44 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static void SetDefaultOrganization(int newDefaultOrganizationId, int currentDefaultOrganizationId)
|
||||
{
|
||||
// place log record
|
||||
List<BackgroundTaskParameter> parameters = new List<BackgroundTaskParameter>();
|
||||
parameters.Add(new BackgroundTaskParameter("ItemID", newDefaultOrganizationId));
|
||||
|
||||
TaskManager.StartTask("ORGANIZATION", "SET_DEFAULT_ORG", parameters);
|
||||
|
||||
try
|
||||
{
|
||||
if (currentDefaultOrganizationId > 0)
|
||||
{
|
||||
// load current default organization
|
||||
Organization currentDefaultOrg = (Organization)PackageController.GetPackageItem(currentDefaultOrganizationId);
|
||||
|
||||
currentDefaultOrg.IsDefault = false;
|
||||
|
||||
// save changes
|
||||
PackageController.UpdatePackageItem(currentDefaultOrg);
|
||||
}
|
||||
|
||||
// load organization
|
||||
Organization newDefaultOrg = (Organization)PackageController.GetPackageItem(newDefaultOrganizationId);
|
||||
|
||||
newDefaultOrg.IsDefault = true;
|
||||
// save changes
|
||||
PackageController.UpdatePackageItem(newDefaultOrg);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
#region Users
|
||||
|
||||
|
||||
|
|
|
@ -117,6 +117,11 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return OrganizationController.GetAccountIdByUserPrincipalName(itemId, userPrincipalName);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void SetDefaultOrganization(int newDefaultOrganizationId, int currentDefaultOrganizationId)
|
||||
{
|
||||
OrganizationController.SetDefaultOrganization(newDefaultOrganizationId, currentDefaultOrganizationId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2014, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -63,6 +63,9 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
|
||||
#endregion
|
||||
|
||||
[Persistent]
|
||||
public bool IsDefault { get; set; }
|
||||
|
||||
[Persistent]
|
||||
public int MaxSharePointStorage
|
||||
{
|
||||
|
|
|
@ -168,4 +168,10 @@
|
|||
<data name="Text.PageName" xml:space="preserve">
|
||||
<value>Home</value>
|
||||
</data>
|
||||
<data name="gvOrgsDefault.HeaderText" xml:space="preserve">
|
||||
<value>Default</value>
|
||||
</data>
|
||||
<data name="btnSetDefaultOrganization.Text" xml:space="preserve">
|
||||
<value>Set Default Organization</value>
|
||||
</data>
|
||||
</root>
|
|
@ -74,6 +74,13 @@
|
|||
</ItemTemplate>
|
||||
<HeaderStyle Wrap="False" />
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField meta:resourcekey="gvOrgsDefault">
|
||||
<ItemTemplate>
|
||||
<div style="text-align:center">
|
||||
<input type="radio" name="DefaultOrganization" value='<%# Eval("ItemID") %>' <%# IsChecked(Convert.ToString(Eval("IsDefault")), Eval("ItemID").ToString()) %>/>
|
||||
</div>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-Width="20px">
|
||||
<ItemTemplate>
|
||||
<asp:ImageButton ID="cmdDelete" runat="server" Text="Delete" SkinID="ExchangeDelete"
|
||||
|
@ -98,11 +105,15 @@
|
|||
</asp:ObjectDataSource>
|
||||
|
||||
<br />
|
||||
|
||||
<asp:Localize ID="locQuota" runat="server" meta:resourcekey="locQuota" Text="Total Organizations Created:"></asp:Localize>
|
||||
|
||||
<wsp:Quota ID="orgsQuota" runat="server" QuotaName="HostedSolution.Organizations" />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<div style="text-align: center">
|
||||
<asp:Button ID="btnSetDefaultOrganization" runat="server" meta:resourcekey="btnSetDefaultOrganization"
|
||||
Text="Set Default Organization" CssClass="Button1" OnClick="btnSetDefaultOrganization_Click" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2014, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -27,14 +27,18 @@
|
|||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Web.UI.WebControls;
|
||||
using WebsitePanel.EnterpriseServer;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
|
||||
namespace WebsitePanel.Portal.ExchangeServer
|
||||
{
|
||||
public partial class Organizations : WebsitePanelModuleBase
|
||||
{
|
||||
private int CurrentDefaultOrgId { get; set; }
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
// set display preferences
|
||||
|
@ -50,7 +54,6 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
btnCreate.Enabled = false;
|
||||
}
|
||||
|
||||
|
||||
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
|
||||
if (cntx.Quotas.ContainsKey(Quotas.ORGANIZATIONS))
|
||||
{
|
||||
|
@ -60,6 +63,8 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
//else
|
||||
//if (gvOrgs.Rows.Count > 0) btnCreate.Enabled = false;
|
||||
|
||||
btnSetDefaultOrganization.Enabled = !(gvOrgs.Rows.Count < 2);
|
||||
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
if (Request.UrlReferrer != null && PanelSecurity.SelectedUser.Role == UserRole.User)
|
||||
|
@ -69,6 +74,8 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
|
||||
if (Request.UrlReferrer.Query.Equals(queryBuilder.ToString(), StringComparison.InvariantCultureIgnoreCase) && gvOrgs.Rows.Count > 0)
|
||||
{
|
||||
if (CurrentDefaultOrgId > 0) Response.Redirect(GetOrganizationEditUrl(CurrentDefaultOrgId.ToString()));
|
||||
|
||||
Response.Redirect(((HyperLink)gvOrgs.Rows[0].Cells[1].Controls[1]).NavigateUrl);
|
||||
}
|
||||
}
|
||||
|
@ -139,5 +146,33 @@ namespace WebsitePanel.Portal.ExchangeServer
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnSetDefaultOrganization_Click(object sender, EventArgs e)
|
||||
{
|
||||
// get org
|
||||
int newDefaultOrgId = Utils.ParseInt(Request.Form["DefaultOrganization"], CurrentDefaultOrgId);
|
||||
|
||||
try
|
||||
{
|
||||
ES.Services.Organizations.SetDefaultOrganization(newDefaultOrgId, CurrentDefaultOrgId);
|
||||
|
||||
ShowSuccessMessage("REQUEST_COMPLETED_SUCCESFULLY");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowErrorMessage("ORGANIZATION_SET_DEFAULT_ORG", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public string IsChecked(string val, string itemId)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(val) && val.ToLowerInvariant() == "true")
|
||||
{
|
||||
CurrentDefaultOrgId = Utils.ParseInt(itemId, 0);
|
||||
return "checked";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,31 +1,3 @@
|
|||
// Copyright (c) 2014, 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.
|
||||
|
@ -165,5 +137,14 @@ namespace WebsitePanel.Portal.ExchangeServer {
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::WebsitePanel.Portal.Quota orgsQuota;
|
||||
|
||||
/// <summary>
|
||||
/// btnSetDefaultOrganization 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 btnSetDefaultOrganization;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue