loading time fix

This commit is contained in:
vfedosevich 2015-04-23 03:14:01 -07:00
parent cbff6f5964
commit 9c9fad9ba7
12 changed files with 257 additions and 14 deletions

View file

@ -80,6 +80,8 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
private System.Threading.SendOrPostCallback SetDefaultOrganizationOperationCompleted;
private System.Threading.SendOrPostCallback GetUserGeneralSettingsWithExtraDataOperationCompleted;
private System.Threading.SendOrPostCallback AddOrganizationDomainOperationCompleted;
private System.Threading.SendOrPostCallback ChangeOrganizationDomainTypeOperationCompleted;
@ -229,6 +231,9 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
/// <remarks/>
public event SetDefaultOrganizationCompletedEventHandler SetDefaultOrganizationCompleted;
/// <remarks/>
public event GetUserGeneralSettingsWithExtraDataCompletedEventHandler GetUserGeneralSettingsWithExtraDataCompleted;
/// <remarks/>
public event AddOrganizationDomainCompletedEventHandler AddOrganizationDomainCompleted;
@ -1310,6 +1315,50 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetUserGeneralSettingsWithExtraData", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public OrganizationUser GetUserGeneralSettingsWithExtraData(int itemId, int accountId) {
object[] results = this.Invoke("GetUserGeneralSettingsWithExtraData", new object[] {
itemId,
accountId});
return ((OrganizationUser)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetUserGeneralSettingsWithExtraData(int itemId, int accountId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetUserGeneralSettingsWithExtraData", new object[] {
itemId,
accountId}, callback, asyncState);
}
/// <remarks/>
public OrganizationUser EndGetUserGeneralSettingsWithExtraData(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((OrganizationUser)(results[0]));
}
/// <remarks/>
public void GetUserGeneralSettingsWithExtraDataAsync(int itemId, int accountId) {
this.GetUserGeneralSettingsWithExtraDataAsync(itemId, accountId, null);
}
/// <remarks/>
public void GetUserGeneralSettingsWithExtraDataAsync(int itemId, int accountId, object userState) {
if ((this.GetUserGeneralSettingsWithExtraDataOperationCompleted == null)) {
this.GetUserGeneralSettingsWithExtraDataOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetUserGeneralSettingsWithExtraDataOperationCompleted);
}
this.InvokeAsync("GetUserGeneralSettingsWithExtraData", new object[] {
itemId,
accountId}, this.GetUserGeneralSettingsWithExtraDataOperationCompleted, userState);
}
private void OnGetUserGeneralSettingsWithExtraDataOperationCompleted(object arg) {
if ((this.GetUserGeneralSettingsWithExtraDataCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetUserGeneralSettingsWithExtraDataCompleted(this, new GetUserGeneralSettingsWithExtraDataCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AddOrganizationDomain", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int AddOrganizationDomain(int itemId, string domainName) {
@ -3816,6 +3865,32 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetDefaultOrganizationCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetUserGeneralSettingsWithExtraDataCompletedEventHandler(object sender, GetUserGeneralSettingsWithExtraDataCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetUserGeneralSettingsWithExtraDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetUserGeneralSettingsWithExtraDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public OrganizationUser Result {
get {
this.RaiseExceptionIfNecessary();
return ((OrganizationUser)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void AddOrganizationDomainCompletedEventHandler(object sender, AddOrganizationDomainCompletedEventArgs e);

View file

@ -1581,11 +1581,7 @@ namespace WebsitePanel.EnterpriseServer
UserInfo owner = PackageController.GetPackageOwner(org.PackageId);
OrganizationUser user = OrganizationController.GetAccount(itemId, accountId);
OrganizationUser settings = orgProxy.GetUserGeneralSettings(user.AccountName, org.OrganizationId);
user.PasswordExpirationDateTime = settings.PasswordExpirationDateTime;
OrganizationUser user = OrganizationController.GetUserGeneralSettingsWithExtraData(itemId, accountId);
if (string.IsNullOrEmpty(mailTo))
{
@ -1658,6 +1654,8 @@ namespace WebsitePanel.EnterpriseServer
}
}
public static AccessToken GetAccessToken(Guid accessToken, AccessTokenTypes type)
{
return ObjectUtils.FillObjectFromDataReader<AccessToken>(DataProvider.GetAccessTokenByAccessToken(accessToken, type));
@ -2668,6 +2666,50 @@ namespace WebsitePanel.EnterpriseServer
return (account);
}
public static OrganizationUser GetUserGeneralSettingsWithExtraData(int itemId, int accountId)
{
OrganizationUser account = null;
Organization org = null;
try
{
// load organization
org = GetOrganization(itemId);
if (org == null)
return null;
// load account
account = GetAccount(itemId, accountId);
}
catch (Exception) { }
try
{
// get mailbox settings
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
string accountName = GetAccountName(account.AccountName);
OrganizationUser retUser = orgProxy.GetOrganizationUserWithExtraData(accountName, org.OrganizationId);
retUser.AccountId = accountId;
retUser.AccountName = account.AccountName;
retUser.PrimaryEmailAddress = account.PrimaryEmailAddress;
retUser.AccountType = account.AccountType;
retUser.CrmUserId = CRMController.GetCrmUserId(accountId);
retUser.IsOCSUser = DataProvider.CheckOCSUserExists(accountId);
retUser.IsLyncUser = DataProvider.CheckLyncUserExists(accountId);
retUser.IsBlackBerryUser = BlackBerryController.CheckBlackBerryUserExists(accountId);
retUser.SubscriberNumber = account.SubscriberNumber;
retUser.LevelId = account.LevelId;
retUser.IsVIP = account.IsVIP;
return retUser;
}
catch { }
return (account);
}
public static int SetUserGeneralSettings(int itemId, int accountId, string displayName,
string password, bool hideAddressBook, bool disabled, bool locked, string firstName, string initials,
string lastName, string address, string city, string state, string zip, string country,

View file

@ -57,11 +57,6 @@ namespace WebsitePanel.EnterpriseServer
}
}
}
// send mail message
// MailHelper.SendMessage(mailFrom, mailTo, mailSubject, mailBody, false);
}
}
}

View file

@ -93,7 +93,7 @@ namespace WebsitePanel.EnterpriseServer
[WebMethod]
public SystemSettings GetWebDavSystemSettings()
{
return OrganizationController.GetWebDavSystemSettings();
return OrganizationController.GetWebDavSystemSettings();
}
[WebMethod]
@ -185,7 +185,13 @@ namespace WebsitePanel.EnterpriseServer
OrganizationController.SetDefaultOrganization(newDefaultOrganizationId, currentDefaultOrganizationId);
}
#endregion
[WebMethod]
public OrganizationUser GetUserGeneralSettingsWithExtraData(int itemId, int accountId)
{
return OrganizationController.GetUserGeneralSettingsWithExtraData(itemId, accountId);
}
#endregion
#region Domains

View file

@ -102,5 +102,7 @@ namespace WebsitePanel.Providers.HostedSolution
void ApplyPasswordSettings(string organizationId, OrganizationPasswordSettings passwordSettings);
bool CheckPhoneNumberIsInUse(string phoneNumber, string userSamAccountName = null);
OrganizationUser GetOrganizationUserWithExtraData(string loginName, string organizationId);
}
}

View file

@ -1008,10 +1008,30 @@ namespace WebsitePanel.Providers.HostedSolution
retUser.UserPrincipalName = (string)entry.InvokeGet(ADAttributes.UserPrincipalName);
retUser.UserMustChangePassword = GetUserMustChangePassword(entry);
return retUser;
}
public OrganizationUser GetOrganizationUserWithExtraData(string loginName, string organizationId)
{
HostedSolutionLog.LogStart("GetOrganizationUserWithExtraData");
HostedSolutionLog.DebugInfo("loginName : {0}", loginName);
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
if (string.IsNullOrEmpty(loginName))
throw new ArgumentNullException("loginName");
var psoName = FormOrganizationPSOName(organizationId);
string path = GetUserPath(organizationId, loginName);
OrganizationUser retUser = GetUser(organizationId, path);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
retUser.PasswordExpirationDateTime = GetPasswordExpirationDate(psoName, entry);
HostedSolutionLog.LogEnd("GetOrganizationUserWithExtraData");
return retUser;
}

View file

@ -98,6 +98,8 @@ namespace WebsitePanel.Providers.HostedSolution {
private System.Threading.SendOrPostCallback CheckPhoneNumberIsInUseOperationCompleted;
private System.Threading.SendOrPostCallback GetOrganizationUserWithExtraDataOperationCompleted;
/// <remarks/>
public Organizations() {
this.Url = "http://localhost:9003/Organizations.asmx";
@ -196,6 +198,9 @@ namespace WebsitePanel.Providers.HostedSolution {
/// <remarks/>
public event CheckPhoneNumberIsInUseCompletedEventHandler CheckPhoneNumberIsInUseCompleted;
/// <remarks/>
public event GetOrganizationUserWithExtraDataCompletedEventHandler GetOrganizationUserWithExtraDataCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/OrganizationExists", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@ -1773,6 +1778,51 @@ namespace WebsitePanel.Providers.HostedSolution {
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetOrganizationUserWithExtraData", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public OrganizationUser GetOrganizationUserWithExtraData(string loginName, string organizationId) {
object[] results = this.Invoke("GetOrganizationUserWithExtraData", new object[] {
loginName,
organizationId});
return ((OrganizationUser)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetOrganizationUserWithExtraData(string loginName, string organizationId, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("GetOrganizationUserWithExtraData", new object[] {
loginName,
organizationId}, callback, asyncState);
}
/// <remarks/>
public OrganizationUser EndGetOrganizationUserWithExtraData(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((OrganizationUser)(results[0]));
}
/// <remarks/>
public void GetOrganizationUserWithExtraDataAsync(string loginName, string organizationId) {
this.GetOrganizationUserWithExtraDataAsync(loginName, organizationId, null);
}
/// <remarks/>
public void GetOrganizationUserWithExtraDataAsync(string loginName, string organizationId, object userState) {
if ((this.GetOrganizationUserWithExtraDataOperationCompleted == null)) {
this.GetOrganizationUserWithExtraDataOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationUserWithExtraDataOperationCompleted);
}
this.InvokeAsync("GetOrganizationUserWithExtraData", new object[] {
loginName,
organizationId}, this.GetOrganizationUserWithExtraDataOperationCompleted, userState);
}
private void OnGetOrganizationUserWithExtraDataOperationCompleted(object arg) {
if ((this.GetOrganizationUserWithExtraDataCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetOrganizationUserWithExtraDataCompleted(this, new GetOrganizationUserWithExtraDataCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@ -2188,4 +2238,30 @@ namespace WebsitePanel.Providers.HostedSolution {
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetOrganizationUserWithExtraDataCompletedEventHandler(object sender, GetOrganizationUserWithExtraDataCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetOrganizationUserWithExtraDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetOrganizationUserWithExtraDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public OrganizationUser Result {
get {
this.RaiseExceptionIfNecessary();
return ((OrganizationUser)(this.results[0]));
}
}
}
}

View file

@ -273,5 +273,11 @@ namespace WebsitePanel.Server
{
return Organization.CheckPhoneNumberIsInUse(phoneNumber, userSamAccountName);
}
[WebMethod, SoapHeader("settings")]
public OrganizationUser GetOrganizationUserWithExtraData(string loginName, string organizationId)
{
return Organization.GetOrganizationUserWithExtraData(loginName, organizationId);
}
}
}

View file

@ -338,7 +338,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
private UserProfile GetUserProfileModel(int itemId, int accountId)
{
var user = WspContext.Services.Organizations.GetUserGeneralSettings(itemId, accountId);
var user = WspContext.Services.Organizations.GetUserGeneralSettingsWithExtraData(itemId, accountId);
return Mapper.Map<OrganizationUser, UserProfile>(user);
}

View file

@ -627,6 +627,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Password never expires. If you want to change password then please click {0}..
/// </summary>
public static string PasswordNeverExpiresFormat {
get {
return ResourceManager.GetString("PasswordNeverExpiresFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Password reset.
/// </summary>

View file

@ -393,4 +393,7 @@
<data name="Login" xml:space="preserve">
<value>Login</value>
</data>
<data name="PasswordNeverExpiresFormat" xml:space="preserve">
<value>Password never expires. If you want to change password then please click {0}.</value>
</data>
</root>

View file

@ -5,8 +5,17 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
var passwordExpriationText = string.Empty;
var passwordExpriationText = string.Format(UI.PasswordExpirationFormat, Model.PasswordExpirationDateTime.ToString(Formats.DateFormatWithTime), Html.RouteLink(UI.Here.ToLowerInvariant(), AccountRouteNames.PasswordChange));
if (Model.PasswordExpirationDateTime == DateTime.MaxValue)
{
passwordExpriationText = string.Format(UI.PasswordNeverExpiresFormat, Html.RouteLink(UI.Here.ToLowerInvariant(), AccountRouteNames.PasswordChange));
}
else
{
passwordExpriationText = string.Format(UI.PasswordExpirationFormat, Model.PasswordExpirationDateTime.ToString(Formats.DateFormatWithTime), Html.RouteLink(UI.Here.ToLowerInvariant(), AccountRouteNames.PasswordChange));
}
}
<div class="container row">