Exemplo n.º 1
0
        void UpdateGroupType(GroupTypeEnum value)
        {
            var header = _meshNode.MeshModel.Header;

            header.MaterialId          = value;
            _meshNode.MeshModel.Header = header;
        }
 protected void InitalCustomDBProxyConfigManagement(GroupTypeEnum groupTypeEnum, string dbNodeName)
 {
     _currentDBGroup = GetCurrentDBGroup(groupTypeEnum);
     _listDBNode     = _currentDBGroup.DBNodes.Cast <DBNode>().ToList();
     _currentDBNode  = SetActionNodesCompositeWeight(_currentDBGroup, dbNodeName, out _dbNodeTotalCompositeWeight, out _currentReadWriteActionNodes, out _dbNodeReadWriteTotalCompositeWeight);
     _randomDBNodeTotalCompositeWeight          = new Random(1);
     _randomDBNodeReadWriteTotalCompositeWeight = new Random(1);
     _boolInital = true;
 }
        protected DBNode GetCurrentDBNode(GroupTypeEnum groupTypeEnum, string dbNodeName)
        {
            CustomDBGroup objGroup = GetCurrentDBGroup(groupTypeEnum);

            var objList = from dbNode in objGroup.DBNodes.Cast <DBNode>()
                          where dbNode.Name.Equals(dbNodeName, StringComparison.CurrentCultureIgnoreCase)
                          select dbNode;

            DBNode node = null;

            node = objList.FirstOrDefault <DBNode>();

            return(node);
        }
Exemplo n.º 4
0
        public List <P_GROUP_MEMBER> GetGroupMembersByType(GroupTypeEnum GroupType)
        {
            List <P_GROUP_MEMBER> rtnData;
            var sqlServerTemplate = sqlServerTemplFactory.CreateDbTemplate();

            using (var conn = sqlServerTemplate.GetSqlConnection())
            {
                conn.Open();
                rtnData = sqlServerTemplate.Load <P_GROUP_MEMBER>(
                    "SELECT ID, GroupType, UserId, UserName, CreateDate, CreateUserId FROM P_GROUP_MEMBER WHERE (GroupType = @GroupType) ",
                    new SqlParameter[]
                {
                    SqlParameterFactory.GetSqlParameter("@GroupType", GroupType.ToString("D"))
                });
            }
            return(rtnData);
        }
 /// <summary>
 /// Gets the Name of the Group, from the Unique Id, 
 /// which is Group Type and the Id of the grouping
 /// </summary>
 /// <param name="Id">The Id of the Group</param>
 /// <param name="Type">The Type of the Group</param>
 /// <returns>Returns the Group name, Artist, Genre or Playlist</returns>
 public async Task<string> LoadGroupNameAsync(int Id, GroupTypeEnum Type)
 {
     string name = string.Empty;
     switch (Type)
     {
         case GroupTypeEnum.Artist:
             var artist = await _artistRepository.GetById(Id);
             name = artist.Name;
             break;
         case GroupTypeEnum.Genre:
             var Genre = await _genreRepository.GetById(Id);
             name = Genre.Name;
             break;
         case GroupTypeEnum.Playlist:
             var Playlist = await _playlistRepository.GetById(Id);
             name = Playlist.Name;
             break;
     }
     return name;
 }
Exemplo n.º 6
0
        public IDb GetDb(string sqlConnectionString, GroupTypeEnum groupTypeEnum = GroupTypeEnum.MSSQLServer)
        {
            IProvider sqlProvider = null;

            switch (groupTypeEnum)
            {
            case GroupTypeEnum.MSSQLServer:
                sqlProvider = new SqlProvider(sqlConnectionString);
                break;

            case GroupTypeEnum.OracleServer:
                sqlProvider = new OrlProvider(sqlConnectionString);
                break;

            case GroupTypeEnum.LiteSQLServer:
                sqlProvider = new LitProvider(sqlConnectionString);
                break;
            }

            return(sqlProvider.OpenDb());
        }
Exemplo n.º 7
0
        /// <summary>
        /// Formats the Description for the Group.  It is different for each of
        /// the Group categories: Artist, Genre, Playlist, Album.
        /// The string is localised to tha language and culture.
        /// </summary>
        /// <param name="number">The number of items in the group to be localised</param>
        /// <param name="duration">The total duration to be localised</param>
        /// <param name="groupType">The group type</param>
        /// <returns>The formatted string.</returns>
        public static string LocaliseDescription(int number, TimeSpan duration, GroupTypeEnum groupType)
        {
            StringBuilder bldr = new StringBuilder();
            bldr.AppendFormat("{0:d}", number);

            //  Get the localised text that joings the number.
            var counterStr = _loader.GetString("GroupCount");            
            if (groupType == GroupTypeEnum.Playlist)
                counterStr = _loader.GetString("GroupPlaylistCount");
            bldr.AppendFormat(" {0} ", counterStr);

//            TimeSpan totalDuration = duration;
            string localDuration = LocaliseDuration(duration);
//            bldr.AppendFormat("{0:t}", duration);
            bldr.Append(localDuration);

            var durationStr = _loader.GetString("GroupDurationMins");
            bldr.AppendFormat(" {0}", durationStr);

            return bldr.ToString();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateGroupReference" /> class.
 /// </summary>
 /// <param name="catalogItemId">Identifier of the ProductId to use as SubProduct (required).</param>
 /// <param name="groupType">Type of the SupProduct (required).</param>
 public CreateGroupReference(string catalogItemId = default(string), GroupTypeEnum groupType = default(GroupTypeEnum))
 {
     // to ensure "catalogItemId" is required (not null)
     if (catalogItemId == null)
     {
         throw new InvalidDataException("catalogItemId is a required property for CreateGroupReference and cannot be null");
     }
     else
     {
         this.CatalogItemId = catalogItemId;
     }
     // to ensure "groupType" is required (not null)
     if (groupType == null)
     {
         throw new InvalidDataException("groupType is a required property for CreateGroupReference and cannot be null");
     }
     else
     {
         this.GroupType = groupType;
     }
 }
        protected CustomDBGroup GetCurrentDBGroup(GroupTypeEnum groupTypeEnum)
        {
            CustomDBGroup objGroup = null;

            CustomDBProxyConfigSection section = CustomDBProxyConfigSection.GetConfigSection();

            foreach (CustomDBGroup grp in CustomDBProxyConfigSection.GetConfigSection().CustomDBGroups)
            {
                if (grp.GroupTypeEnum == groupTypeEnum)
                {
                    objGroup = grp;
                    break;
                }
            }

            if (objGroup == null)
            {
                objGroup = CustomDBProxyConfigSection.GetConfigSection().CustomDBGroups.DefaultCustomDBGroup;
            }

            return(objGroup);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Group" /> class.
 /// </summary>
 /// <param name="catalogGroupId">Unique catalog group id.</param>
 /// <param name="catalogItemId">Unique catalog item id.</param>
 /// <param name="isArchived">Returns true if the group is archived.</param>
 /// <param name="minSelectCount">Minimum number of items that the user has to select.</param>
 /// <param name="maxSelectCount">Maximum number of items that the user has to select.</param>
 /// <param name="products">Collection of items associated with this product.</param>
 /// <param name="metafields">Collection of metafields.</param>
 /// <param name="groupType">Type of group (ModifierGroup, etc) (required).</param>
 /// <param name="sku">Stock Keeping Unit (SKU) (required).</param>
 /// <param name="name">Group name (required).</param>
 /// <param name="autogenerateDisplayText">Autogenerate display text in ordering applications.</param>
 /// <param name="imageFileName">Image File Name.</param>
 public Group(string catalogGroupId = default(string), string catalogItemId = default(string), bool?isArchived = default(bool?), int?minSelectCount = default(int?), int?maxSelectCount = default(int?), List <ProductReference> products = default(List <ProductReference>), List <Metafield> metafields = default(List <Metafield>), GroupTypeEnum groupType = default(GroupTypeEnum), string sku = default(string), string name = default(string), bool?autogenerateDisplayText = default(bool?), string imageFileName = default(string))
 {
     // to ensure "groupType" is required (not null)
     if (groupType == null)
     {
         throw new InvalidDataException("groupType is a required property for Group and cannot be null");
     }
     else
     {
         this.GroupType = groupType;
     }
     // to ensure "sku" is required (not null)
     if (sku == null)
     {
         throw new InvalidDataException("sku is a required property for Group and cannot be null");
     }
     else
     {
         this.Sku = sku;
     }
     // to ensure "name" is required (not null)
     if (name == null)
     {
         throw new InvalidDataException("name is a required property for Group and cannot be null");
     }
     else
     {
         this.Name = name;
     }
     this.CatalogGroupId          = catalogGroupId;
     this.CatalogItemId           = catalogItemId;
     this.IsArchived              = isArchived;
     this.MinSelectCount          = minSelectCount;
     this.MaxSelectCount          = maxSelectCount;
     this.Products                = products;
     this.Metafields              = metafields;
     this.AutogenerateDisplayText = autogenerateDisplayText;
     this.ImageFileName           = imageFileName;
 }
Exemplo n.º 11
0
        public IDatabase GetDatabase(GroupTypeEnum type, string key)
        {
            ConnectionMultiplexer redis;
            if (this.ActiveConnectionMultiplexers.TryGetValue(this.ConvertMultiplexerKey(type, key), out redis)
                && redis.IsConnected)
            {
                return redis.GetDatabase();
            }

            var config = this.ConfigurationGroupList.First(g => g.Type == type).ConfigurationOptionsList.First(c => c.Key.ToLower() == key.ToLower());
            if (redis == null)
            {
                redis = ConnectionMultiplexer.Connect(config.ConfigurationOptions);
                this.ActiveConnectionMultiplexers.Add(this.ConvertMultiplexerKey(type, key), redis);
            }
            else
            {
                redis = ConnectionMultiplexer.Connect(config.ConfigurationOptions);
                this.ActiveConnectionMultiplexers[this.ConvertMultiplexerKey(type, key)] = redis;
            }

            return redis.GetDatabase();
        }
        protected DBNode GetCurrentDBNode(GroupTypeEnum groupTypeEnum,string dbNodeName)
        {
            CustomDBGroup objGroup = GetCurrentDBGroup(groupTypeEnum);

            var objList = from dbNode in objGroup.DBNodes.Cast<DBNode>()
                          where dbNode.Name.Equals(dbNodeName, StringComparison.CurrentCultureIgnoreCase)
                          select dbNode;

            DBNode node = null;

            node = objList.FirstOrDefault<DBNode>();

            return node;
        }
 public CustomDBProxyConfigManagement(string dbNodeName, GroupTypeEnum groupTypeEnum = GroupTypeEnum.MSSQLServer)
 {
     InitalCustomDBProxyConfigManagement(groupTypeEnum, dbNodeName);
 }
        protected CustomDBGroup GetCurrentDBGroup(GroupTypeEnum groupTypeEnum)
        {
            CustomDBGroup objGroup = null;

            CustomDBProxyConfigSection section = CustomDBProxyConfigSection.GetConfigSection();

            foreach (CustomDBGroup grp in CustomDBProxyConfigSection.GetConfigSection().CustomDBGroups)
            {
                if (grp.GroupTypeEnum == groupTypeEnum)
                {
                    objGroup = grp;
                    break;
                }
            }

            if (objGroup == null)
            {
                objGroup = CustomDBProxyConfigSection.GetConfigSection().CustomDBGroups.DefaultCustomDBGroup;
            }

            return objGroup;
        }
 protected void InitalCustomDBProxyConfigManagement(GroupTypeEnum groupTypeEnum, string dbNodeName)
 {
     _currentDBGroup = GetCurrentDBGroup(groupTypeEnum);
     _listDBNode = _currentDBGroup.DBNodes.Cast<DBNode>().ToList();
     _currentDBNode = SetActionNodesCompositeWeight(_currentDBGroup, dbNodeName, out _dbNodeTotalCompositeWeight, out _currentReadWriteActionNodes, out _dbNodeReadWriteTotalCompositeWeight);
     _randomDBNodeTotalCompositeWeight = new Random(1);
     _randomDBNodeReadWriteTotalCompositeWeight = new Random(1);
     _boolInital = true;
 }
        public string GetCustomDBConnectionString(ref System.Data.IDbCommand iCommand, ActionEnum actionEnum, string dbNodeName, GroupTypeEnum groupTypeEnum=GroupTypeEnum.MSSQLServer)
        {
            if (!_boolInital)
            {
                InitalCustomDBProxyConfigManagement(groupTypeEnum, dbNodeName);
            }

            string strRegEx = "[.\\n]*[\\s]*[select][\\s]+";
            string strSQL = iCommand.CommandText;

            string strRtnConn = string.Empty;

            Regex reg = new Regex(strRegEx);

            TimeSpan tsEnd = TimeSpan.FromTicks(DateTime.Now.Ticks);

            if (reg.IsMatch(strSQL.ToLower()) && iCommand.CommandType == System.Data.CommandType.Text && iCommand.Transaction == null && actionEnum == ActionEnum.Read)
            {
                if (tsEnd.Subtract(LastWriteOprationTimeSpan).TotalSeconds >= CurrentDBNode.Duration)
                {
                    int actionNodeNewCompositeWeight = _randomDBNodeTotalCompositeWeight.Next(1,_dbNodeTotalCompositeWeight);
                    ActionNode actionNode = GetActionNodeByNewCompositeWeight(actionNodeNewCompositeWeight, _currentDBNode);
                    iCommand.Connection.ConnectionString = actionNode.ConnectionString;
                    return actionNode.ConnectionString;
                }
                else
                {
                    strRtnConn = iCommand.Connection.ConnectionString;
                    return strRtnConn;
                }
            }
            else
            {
                if (tsEnd.Subtract(LastWriteOprationTimeSpan).TotalSeconds >= CurrentDBNode.Duration)
                {
                    int readWriteActionNodeNewCompositeWeight = _randomDBNodeReadWriteTotalCompositeWeight.Next(1,_dbNodeReadWriteTotalCompositeWeight);
                    ActionNode actionNode = GetReadWriteActionNodeByNewCompositeWeight(readWriteActionNodeNewCompositeWeight, _currentReadWriteActionNodes);
                    iCommand.Connection.ConnectionString = actionNode.ConnectionString;
                    LastWriteOprationTimeSpan = TimeSpan.FromTicks(DateTime.Now.Ticks);
                    return actionNode.ConnectionString;
                }
                else
                {
                    strRtnConn = iCommand.Connection.ConnectionString;
                    return strRtnConn;
                }
            }
        }
        /// <summary>
        /// Helper method to load the GroupModel that supports the MainViewModel
        /// with the corresponding group category.
        /// </summary>
        /// <param name="Id">The Id of the Group</param>
        /// <param name="Type">The Type of the Group</param>
        /// <returns>A collection of the AlbumModel used in the page.</returns>
        public async Task<List<AlbumModel>> LoadAlbumsAsync(int Id, GroupTypeEnum Type)
        {
            var albumsViewModel = new List<AlbumModel>();

            //  Call the repository 
            //  Check, this should include the albums, there is no Lazy loading strategy for this.
            IEnumerable<Album> albums = new List<Album>();
            switch (Type)
            {
                case GroupTypeEnum.Artist:
                    albums = await _albumRepository.GetAlbumsForArtist(Id);
                    break;
                case GroupTypeEnum.Genre:
                    albums = await _albumRepository.GetAlbumsForGenre(Id);
                    break;
                case GroupTypeEnum.Playlist:
                    albums = await _albumRepository.GetAlbumsForPlaylist(Id);
                    break;
            }
            //  Map the albums to the albumsViewModel
            albumsViewModel = MapAlbumsToAlbumModels(albums);
            return albumsViewModel;
        }
 public RedisConfigurationGroup(GroupTypeEnum type)
 {
     this.Type = type;
     this.ConfigurationOptionsList = new List<RedisConfigurationOption>();
 }
Exemplo n.º 19
0
 public GroupColumn(string colName, GroupTypeEnum groupType)
 {
     _colName   = colName;
     _groupType = groupType;
 }
Exemplo n.º 20
0
        public IDb GetDb(string sqlConnectionString,GroupTypeEnum groupTypeEnum=GroupTypeEnum.MSSQLServer)
        {
            IProvider sqlProvider=null;

            switch (groupTypeEnum)
            {
                case GroupTypeEnum.MSSQLServer:
                    sqlProvider = new SqlProvider(sqlConnectionString);
                    break;
                case GroupTypeEnum.OracleServer:
                    sqlProvider = new OrlProvider(sqlConnectionString);
                    break;
                case GroupTypeEnum.LiteSQLServer:
                    sqlProvider = new LitProvider(sqlConnectionString);
                    break;
            }
            
            return sqlProvider.OpenDb();
        }
Exemplo n.º 21
0
        //  Take in the files and the current grouping
        //  Return the list of Id's for the current grouping
        /// <summary>
        /// Takes the selected audio files and processed them by retrieving the 
        /// metadata describing the track,  It calls the LastFMService to retrieve
        /// the image information and then calls the AlbumRepository to add the
        /// track to the album
        /// </summary>
        /// <param name="MusicFiles">The collection of audio files</param>
        /// <param name="Grouping">The grouping type currently showing on the main page</param>
        /// <returns>A list containing the id of the groups affected by the addition of the tracks</returns>
        public async Task<List<int>> ProcessMusicFiles(IReadOnlyList<StorageFile> MusicFiles, GroupTypeEnum Grouping)
        {
            //List<int> affectedGroups = new List<int>();
            var affectedGroups = new List<int>();

            //  Process all track selected.
            foreach (StorageFile musicFile in MusicFiles)
            {
                //  Import the music file and get the album class, it will be null if the music files
                //  has already been added.
                var album = await ImportAlbumAsync(musicFile);
                if (album != null)
                {
                    //  Add the Id of the relevent group to the affected groups
                    //      Ignore Playlists, as no new track would belong to a playlist
                    switch (Grouping)
                    {
                        case GroupTypeEnum.Artist:
                            //  Get the Artist Id, if it's not already been added
                            if (!affectedGroups.Contains(album.Artist.Id))
                                affectedGroups.Add(album.Artist.Id);
                            break;
                        case GroupTypeEnum.Genre:
                            //  Get the Ids of all genres and add them if theyre not already there.
                            foreach (var g in album.Genres)
                            {
                                if (!affectedGroups.Contains(g.Id))
                                    affectedGroups.Add(g.Id);
                            }
                            break;
                    }
                }
            }
            return affectedGroups;
        }
Exemplo n.º 22
0
 private string ConvertMultiplexerKey(GroupTypeEnum type, string key)
 {
     return string.Format("{0}{1}", type, key);
 }
        public string GetCustomDBConnectionString(ActionEnum actionEnum, string dbNodeName, GroupTypeEnum groupTypeEnum = GroupTypeEnum.MSSQLServer)
        {
            if (!_boolInital)
            {
                InitalCustomDBProxyConfigManagement(groupTypeEnum, dbNodeName);
            }

            TimeSpan tsEnd = TimeSpan.FromTicks(DateTime.Now.Ticks);

            if (actionEnum == ActionEnum.Read)
            {
                if (tsEnd.Subtract(LastWriteOprationTimeSpan).TotalSeconds >= CurrentDBNode.Duration)
                {
                    int        actionNodeNewCompositeWeight = _randomDBNodeTotalCompositeWeight.Next(1, _dbNodeTotalCompositeWeight);
                    ActionNode actionNode = GetActionNodeByNewCompositeWeight(actionNodeNewCompositeWeight, _currentDBNode);
                    return(actionNode.ConnectionString);
                }
                else
                {
                    return(_lastWriteOprationConnectionString);
                }
            }
            else
            {
                if (tsEnd.Subtract(LastWriteOprationTimeSpan).TotalSeconds >= CurrentDBNode.Duration)
                {
                    int        readWriteActionNodeNewCompositeWeight = _randomDBNodeReadWriteTotalCompositeWeight.Next(1, _dbNodeReadWriteTotalCompositeWeight);
                    ActionNode actionNode = GetReadWriteActionNodeByNewCompositeWeight(readWriteActionNodeNewCompositeWeight, _currentReadWriteActionNodes);
                    LastWriteOprationTimeSpan          = TimeSpan.FromTicks(DateTime.Now.Ticks);
                    _lastWriteOprationConnectionString = actionNode.ConnectionString;
                    return(actionNode.ConnectionString);
                }
                else
                {
                    return(_lastWriteOprationConnectionString);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateLdapServerXo" /> class.
 /// </summary>
 /// <param name="name">LDAP server name (required).</param>
 /// <param name="protocol">LDAP server connection Protocol to use (required).</param>
 /// <param name="useTrustStore">Whether to use certificates stored in Nexus Repository Manager&#39;s truststore.</param>
 /// <param name="host">LDAP server connection hostname (required).</param>
 /// <param name="port">LDAP server connection port to use (required).</param>
 /// <param name="searchBase">LDAP location to be added to the connection URL (required).</param>
 /// <param name="authScheme">Authentication scheme used for connecting to LDAP server (required).</param>
 /// <param name="authRealm">The SASL realm to bind to. Required if authScheme is CRAM_MD5 or DIGEST_MD5.</param>
 /// <param name="authUsername">This must be a fully qualified username if simple authentication is used. Required if authScheme other than none..</param>
 /// <param name="connectionTimeoutSeconds">How long to wait before timeout (required).</param>
 /// <param name="connectionRetryDelaySeconds">How long to wait before retrying (required).</param>
 /// <param name="maxIncidentsCount">How many retry attempts (required).</param>
 /// <param name="userBaseDn">The relative DN where user objects are found (e.g. ou&#x3D;people). This value will have the Search base DN value appended to form the full User search base DN..</param>
 /// <param name="userSubtree">Are users located in structures below the user base DN?.</param>
 /// <param name="userObjectClass">LDAP class for user objects.</param>
 /// <param name="userLdapFilter">LDAP search filter to limit user search.</param>
 /// <param name="userIdAttribute">This is used to find a user given its user ID.</param>
 /// <param name="userRealNameAttribute">This is used to find a real name given the user ID.</param>
 /// <param name="userEmailAddressAttribute">This is used to find an email address given the user ID.</param>
 /// <param name="userPasswordAttribute">If this field is blank the user will be authenticated against a bind with the LDAP server.</param>
 /// <param name="ldapGroupsAsRoles">Denotes whether LDAP assigned roles are used as Nexus Repository Manager roles.</param>
 /// <param name="groupType">Defines a type of groups used: static (a group contains a list of users) or dynamic (a user contains a list of groups). Required if ldapGroupsAsRoles is true. (required).</param>
 /// <param name="groupBaseDn">The relative DN where group objects are found (e.g. ou&#x3D;Group). This value will have the Search base DN value appended to form the full Group search base DN..</param>
 /// <param name="groupSubtree">Are groups located in structures below the group base DN.</param>
 /// <param name="groupObjectClass">LDAP class for group objects. Required if groupType is static.</param>
 /// <param name="groupIdAttribute">This field specifies the attribute of the Object class that defines the Group ID. Required if groupType is static.</param>
 /// <param name="groupMemberAttribute">LDAP attribute containing the usernames for the group. Required if groupType is static.</param>
 /// <param name="groupMemberFormat">The format of user ID stored in the group member attribute. Required if groupType is static.</param>
 /// <param name="userMemberOfAttribute">Set this to the attribute used to store the attribute which holds groups DN in the user object. Required if groupType is dynamic.</param>
 /// <param name="authPassword">The password to bind with. Required if authScheme other than none. (required).</param>
 /// <param name="id">LDAP server ID.</param>
 public UpdateLdapServerXo(string name = default(string), ProtocolEnum protocol = default(ProtocolEnum), bool?useTrustStore = default(bool?), string host = default(string), int?port = default(int?), string searchBase = default(string), AuthSchemeEnum authScheme = default(AuthSchemeEnum), string authRealm = default(string), string authUsername = default(string), int?connectionTimeoutSeconds = default(int?), int?connectionRetryDelaySeconds = default(int?), int?maxIncidentsCount = default(int?), string userBaseDn = default(string), bool?userSubtree = default(bool?), string userObjectClass = default(string), string userLdapFilter = default(string), string userIdAttribute = default(string), string userRealNameAttribute = default(string), string userEmailAddressAttribute = default(string), string userPasswordAttribute = default(string), bool?ldapGroupsAsRoles = default(bool?), GroupTypeEnum groupType = default(GroupTypeEnum), string groupBaseDn = default(string), bool?groupSubtree = default(bool?), string groupObjectClass = default(string), string groupIdAttribute = default(string), string groupMemberAttribute = default(string), string groupMemberFormat = default(string), string userMemberOfAttribute = default(string), string authPassword = default(string), string id = default(string))
 {
     // to ensure "name" is required (not null)
     if (name == null)
     {
         throw new InvalidDataException("name is a required property for UpdateLdapServerXo and cannot be null");
     }
     else
     {
         this.Name = name;
     }
     // to ensure "protocol" is required (not null)
     if (protocol == null)
     {
         throw new InvalidDataException("protocol is a required property for UpdateLdapServerXo and cannot be null");
     }
     else
     {
         this.Protocol = protocol;
     }
     // to ensure "host" is required (not null)
     if (host == null)
     {
         throw new InvalidDataException("host is a required property for UpdateLdapServerXo and cannot be null");
     }
     else
     {
         this.Host = host;
     }
     // to ensure "port" is required (not null)
     if (port == null)
     {
         throw new InvalidDataException("port is a required property for UpdateLdapServerXo and cannot be null");
     }
     else
     {
         this.Port = port;
     }
     // to ensure "searchBase" is required (not null)
     if (searchBase == null)
     {
         throw new InvalidDataException("searchBase is a required property for UpdateLdapServerXo and cannot be null");
     }
     else
     {
         this.SearchBase = searchBase;
     }
     // to ensure "authScheme" is required (not null)
     if (authScheme == null)
     {
         throw new InvalidDataException("authScheme is a required property for UpdateLdapServerXo and cannot be null");
     }
     else
     {
         this.AuthScheme = authScheme;
     }
     // to ensure "connectionTimeoutSeconds" is required (not null)
     if (connectionTimeoutSeconds == null)
     {
         throw new InvalidDataException("connectionTimeoutSeconds is a required property for UpdateLdapServerXo and cannot be null");
     }
     else
     {
         this.ConnectionTimeoutSeconds = connectionTimeoutSeconds;
     }
     // to ensure "connectionRetryDelaySeconds" is required (not null)
     if (connectionRetryDelaySeconds == null)
     {
         throw new InvalidDataException("connectionRetryDelaySeconds is a required property for UpdateLdapServerXo and cannot be null");
     }
     else
     {
         this.ConnectionRetryDelaySeconds = connectionRetryDelaySeconds;
     }
     // to ensure "maxIncidentsCount" is required (not null)
     if (maxIncidentsCount == null)
     {
         throw new InvalidDataException("maxIncidentsCount is a required property for UpdateLdapServerXo and cannot be null");
     }
     else
     {
         this.MaxIncidentsCount = maxIncidentsCount;
     }
     // to ensure "groupType" is required (not null)
     if (groupType == null)
     {
         throw new InvalidDataException("groupType is a required property for UpdateLdapServerXo and cannot be null");
     }
     else
     {
         this.GroupType = groupType;
     }
     // to ensure "authPassword" is required (not null)
     if (authPassword == null)
     {
         throw new InvalidDataException("authPassword is a required property for UpdateLdapServerXo and cannot be null");
     }
     else
     {
         this.AuthPassword = authPassword;
     }
     this.UseTrustStore             = useTrustStore;
     this.AuthRealm                 = authRealm;
     this.AuthUsername              = authUsername;
     this.UserBaseDn                = userBaseDn;
     this.UserSubtree               = userSubtree;
     this.UserObjectClass           = userObjectClass;
     this.UserLdapFilter            = userLdapFilter;
     this.UserIdAttribute           = userIdAttribute;
     this.UserRealNameAttribute     = userRealNameAttribute;
     this.UserEmailAddressAttribute = userEmailAddressAttribute;
     this.UserPasswordAttribute     = userPasswordAttribute;
     this.LdapGroupsAsRoles         = ldapGroupsAsRoles;
     this.GroupBaseDn               = groupBaseDn;
     this.GroupSubtree              = groupSubtree;
     this.GroupObjectClass          = groupObjectClass;
     this.GroupIdAttribute          = groupIdAttribute;
     this.GroupMemberAttribute      = groupMemberAttribute;
     this.GroupMemberFormat         = groupMemberFormat;
     this.UserMemberOfAttribute     = userMemberOfAttribute;
     this.Id = id;
 }
        public string GetCustomDBConnectionString(ref System.Data.IDbCommand iCommand, ActionEnum actionEnum, string dbNodeName, GroupTypeEnum groupTypeEnum = GroupTypeEnum.MSSQLServer)
        {
            if (!_boolInital)
            {
                InitalCustomDBProxyConfigManagement(groupTypeEnum, dbNodeName);
            }

            string strRegEx = "[.\\n]*[\\s]*[select][\\s]+";
            string strSQL   = iCommand.CommandText;

            string strRtnConn = string.Empty;

            Regex reg = new Regex(strRegEx);

            TimeSpan tsEnd = TimeSpan.FromTicks(DateTime.Now.Ticks);

            if (reg.IsMatch(strSQL.ToLower()) && iCommand.CommandType == System.Data.CommandType.Text && iCommand.Transaction == null && actionEnum == ActionEnum.Read)
            {
                if (tsEnd.Subtract(LastWriteOprationTimeSpan).TotalSeconds >= CurrentDBNode.Duration)
                {
                    int        actionNodeNewCompositeWeight = _randomDBNodeTotalCompositeWeight.Next(1, _dbNodeTotalCompositeWeight);
                    ActionNode actionNode = GetActionNodeByNewCompositeWeight(actionNodeNewCompositeWeight, _currentDBNode);
                    iCommand.Connection.ConnectionString = actionNode.ConnectionString;
                    return(actionNode.ConnectionString);
                }
                else
                {
                    strRtnConn = iCommand.Connection.ConnectionString;
                    return(strRtnConn);
                }
            }
            else
            {
                if (tsEnd.Subtract(LastWriteOprationTimeSpan).TotalSeconds >= CurrentDBNode.Duration)
                {
                    int        readWriteActionNodeNewCompositeWeight = _randomDBNodeReadWriteTotalCompositeWeight.Next(1, _dbNodeReadWriteTotalCompositeWeight);
                    ActionNode actionNode = GetReadWriteActionNodeByNewCompositeWeight(readWriteActionNodeNewCompositeWeight, _currentReadWriteActionNodes);
                    iCommand.Connection.ConnectionString = actionNode.ConnectionString;
                    LastWriteOprationTimeSpan            = TimeSpan.FromTicks(DateTime.Now.Ticks);
                    return(actionNode.ConnectionString);
                }
                else
                {
                    strRtnConn = iCommand.Connection.ConnectionString;
                    return(strRtnConn);
                }
            }
        }
Exemplo n.º 26
0
            private static void CustomBinaryEnd(MutagenFrame frame, ICellInternal obj)
            {
                if (frame.Reader.Complete)
                {
                    return;
                }
                if (!frame.TryGetGroup(out var groupMeta))
                {
                    return;
                }
                var formKey = FormKey.Factory(frame.MetaData.MasterReferences !, BinaryPrimitives.ReadUInt32LittleEndian(groupMeta.ContainedRecordTypeData));

                if (groupMeta.GroupType == (int)GroupTypeEnum.CellChildren)
                {
                    obj.Timestamp   = BinaryPrimitives.ReadInt32LittleEndian(groupMeta.LastModifiedData);
                    frame.Position += groupMeta.HeaderLength;
                    if (formKey != obj.FormKey)
                    {
                        throw new ArgumentException("Cell children group did not match the FormID of the parent cell.");
                    }
                }
                else
                {
                    return;
                }
                var subFrame = frame.SpawnWithLength(groupMeta.ContentLength);

                while (!subFrame.Complete)
                {
                    var persistGroupMeta = frame.GetGroup();
                    if (!persistGroupMeta.IsGroup)
                    {
                        throw new ArgumentException();
                    }
                    GroupTypeEnum type      = (GroupTypeEnum)persistGroupMeta.GroupType;
                    var           itemFrame = frame.SpawnWithLength(persistGroupMeta.TotalLength);
                    switch (type)
                    {
                    case GroupTypeEnum.CellPersistentChildren:
                        ParseTypical(
                            frame: itemFrame,
                            obj: obj,
                            coll: obj.Persistent,
                            persistentParse: true);
                        break;

                    case GroupTypeEnum.CellTemporaryChildren:
                        ParseTemporary(
                            itemFrame,
                            obj);
                        break;

                    case GroupTypeEnum.CellVisibleDistantChildren:
                        ParseTypical(
                            frame: itemFrame,
                            obj: obj,
                            coll: obj.VisibleWhenDistant,
                            persistentParse: false);
                        break;

                    default:
                        throw new NotImplementedException();
                    }
                }
            }
Exemplo n.º 27
0
 /// <summary>
 /// Localises the Application name and includes the current grouping
 /// on the MainPage
 /// </summary>
 /// <param name="groupType">The current grouping</param>
 /// <returns>appName string</returns>
 public static string LocaliseAppName(GroupTypeEnum groupType)
 {
     StringBuilder bldr = new StringBuilder();
     bldr.AppendFormat("{0} (", _loader.GetString("AppName"));
     bldr.Append(LocaliseGroupTypeEnum(groupType));
     bldr.Append(")");
     return bldr.ToString();
 }
        public string GetCustomDBConnectionString(ActionEnum actionEnum, string dbNodeName, GroupTypeEnum groupTypeEnum = GroupTypeEnum.MSSQLServer)
        {
            if (!_boolInital)
            {
                InitalCustomDBProxyConfigManagement(groupTypeEnum, dbNodeName);
            }

            TimeSpan tsEnd = TimeSpan.FromTicks(DateTime.Now.Ticks);

            if (actionEnum == ActionEnum.Read)
            {
                if (tsEnd.Subtract(LastWriteOprationTimeSpan).TotalSeconds >= CurrentDBNode.Duration)
                {
                    int actionNodeNewCompositeWeight = _randomDBNodeTotalCompositeWeight.Next(1, _dbNodeTotalCompositeWeight);
                    ActionNode actionNode = GetActionNodeByNewCompositeWeight(actionNodeNewCompositeWeight, _currentDBNode);
                    return actionNode.ConnectionString;
                }
                else
                {
                    return _lastWriteOprationConnectionString;
                }
            }
            else
            {
                if (tsEnd.Subtract(LastWriteOprationTimeSpan).TotalSeconds >= CurrentDBNode.Duration)
                {
                    int readWriteActionNodeNewCompositeWeight = _randomDBNodeReadWriteTotalCompositeWeight.Next(1, _dbNodeReadWriteTotalCompositeWeight);
                    ActionNode actionNode = GetReadWriteActionNodeByNewCompositeWeight(readWriteActionNodeNewCompositeWeight, _currentReadWriteActionNodes);
                    LastWriteOprationTimeSpan = TimeSpan.FromTicks(DateTime.Now.Ticks);
                    _lastWriteOprationConnectionString = actionNode.ConnectionString;
                    return actionNode.ConnectionString;
                }
                else
                {
                    return _lastWriteOprationConnectionString;
                }
            }
        }
Exemplo n.º 29
0
 public List <P_GROUP_MEMBER> GetGroupMembersByType(GroupTypeEnum GroupType)
 {
     return(groupMemberDao.GetGroupMembersByType(GroupType));
 }
Exemplo n.º 30
0
 public void SetGroupAlignment(GroupTypeEnum group, params RecordType[] recTypes)
 {
     GroupAlignment.GetOrAdd(group).SetTo(recTypes);
 }
Exemplo n.º 31
0
        //  ***************************  Supporting methods  ***************************
        //  ***************************  Supporting methods  ***************************
        //  ***************************  Supporting methods  ***************************

        /// <summary>
        /// Private method that initiates loading the data context on startup.
        /// This is done asynchronously.
        /// </summary>
        /// <param name="Id">The Id of the Group.</param>
        /// <param name="groupType">The Type of the Group (Artist, Genre or Playlist)</param>
        /// <remarks>
        /// This call is separated to a private method so the call can be 'await'ed.  To call 
        /// this from the mainViewModel constructor would require it to be decorated as 
        /// 'async' which is not possible.
        /// </remarks>
        private async void LoadViewModelAsync(int Id, GroupTypeEnum groupType)
        {
            //  Load the albums
            this.Albums = await _dataService.LoadAlbumsAsync(Id, groupType);
            //            this.Albums = await Helpers.AlbumModelHelper.LoadAlbumsAsync(Id, groupType, _albumRepository);
            this.CurrentAlbum = Albums[0];
            //  Load the Group Name
            this.GroupName = await _dataService.LoadGroupNameAsync(Id, groupType);
            //            this.GroupName = await Helpers.AlbumModelHelper.LoadGroupNameAsync(Id, groupType, _artistRepository);
        }
 public CustomDBProxyConfigManagement(string dbNodeName,GroupTypeEnum groupTypeEnum=GroupTypeEnum.MSSQLServer)
 {
     InitalCustomDBProxyConfigManagement(groupTypeEnum, dbNodeName);
 }
Exemplo n.º 33
0
 private GroupTypeEnum _grouping = GroupTypeEnum.Artist;  //    Default is grouped by Artist
 /// <summary>
 /// Sets the current display grouping
 /// </summary>
 /// <param name="selectedGrouping">The selected grouping</param>
 private void SetGrouping(GroupTypeEnum selectedGrouping)
 {
     //  Set the _grouping to that selected
     _grouping = selectedGrouping;
     //  Notify that all three properties have changed
     RaisePropertyChanged(() => IsGroupArtist);
     RaisePropertyChanged(() => IsGroupGenre);
     RaisePropertyChanged(() => IsGroupPlaylist);
     //  Now activate the Refresh button 
     _isRefreshVisible = true;
     RaisePropertyChanged(() => IsRefreshVisible);
 }
Exemplo n.º 34
0
 /// <summary>
 /// Localises the string representation of the GroupTypeEnum value
 /// </summary>
 /// <param name="groupType">The GroupTypeEnum value</param>
 /// <returns>Localised string representation</returns>
 public static string LocaliseGroupTypeEnum(GroupTypeEnum groupType)
 {
     switch (groupType)
     {
         case GroupTypeEnum.Artist:
             return _loader.GetString("GroupTypeEnumArtist");
         case GroupTypeEnum.Genre:
             return _loader.GetString("GroupTypeEnumGenre");
         case GroupTypeEnum.Playlist:
             return _loader.GetString("GroupTypeEnumPlaylist");
     }
     return string.Empty;
 }