private static WebUserConfiguration GetConfiguration()
 {
     if (_Config == null)
     {
         Sage.Platform.Data.IDataService data = ApplicationContext.Current.Services.Get <Sage.Platform.Data.IDataService>();
         if (data != null)
         {
             Sage.Platform.VirtualFileSystem.VFSQuery.ConnectToVFS(data.GetConnectionString());
         }
         Sage.Platform.Configuration.ConfigurationManager manager = ApplicationContext.Current.Services.Get <Sage.Platform.Configuration.ConfigurationManager>(true);
         if (!manager.IsConfigurationTypeRegistered(typeof(WebUserConfiguration)))
         {
             manager.RegisterConfigurationType(typeof(WebUserConfiguration));
         }
         _Config = (WebUserConfiguration)manager.GetConfiguration(typeof(WebUserConfiguration));
     }
     return(_Config);
 }
Beispiel #2
0
 private static WebUserConfiguration GetConfiguration()
 {
     if (_Config == null)
     {
         Sage.Platform.Data.IDataService data = ApplicationContext.Current.Services.Get<Sage.Platform.Data.IDataService>();
         if (data != null)
         {
             Sage.Platform.VirtualFileSystem.VFSQuery.ConnectToVFS(data.GetConnectionString());
         }
         Sage.Platform.Configuration.ConfigurationManager manager = ApplicationContext.Current.Services.Get<Sage.Platform.Configuration.ConfigurationManager>(true);
         if (!manager.IsConfigurationTypeRegistered(typeof(WebUserConfiguration)))
             manager.RegisterConfigurationType(typeof(WebUserConfiguration));
         _Config = (WebUserConfiguration)manager.GetConfiguration(typeof(WebUserConfiguration));
     }
     return _Config;
 }
    private string GetConfigValue(WebUserConfigOptions opt)
    {
        WebUserConfiguration co = GetConfiguration();

        switch (opt)
        {
        case WebUserConfigOptions.AccountType:
            if (co.AccountType != null)
            {
                return(co.AccountType);
            }
            else
            {
                return("Lead");
            }

        case WebUserConfigOptions.AccountSubType:
            if (co.AccountSubType != null)
            {
                return(co.AccountSubType);
            }
            else
            {
                return("Not Contacted");
            }

        case WebUserConfigOptions.AccountManagerId:
            if (co.AccountManagerId != null)
            {
                IUser user = Sage.SalesLogix.Security.User.GetUser(co.AccountManagerId);
                if ((user != null) && (user.Id != null))
                {
                    return(user.Id.ToString());
                }
                else
                {
                    return("ADMIN");
                }
            }
            else
            {
                return("ADMIN");
            }

        case WebUserConfigOptions.LeadOwner:
            if (co.LeadOwner != null)
            {
                IOwner owner = Sage.SalesLogix.Security.Owner.GetByOwnerDescription(co.LeadOwner);
                if ((owner != null) && (owner.Id != null))
                {
                    return(owner.Id.ToString());
                }
                else
                {
                    return("SYST00000001");
                }
            }
            else
            {
                return("SYST00000001");
            }
        }
        return("");
    }