예제 #1
0
        public IEnumerable <ProfileMme> GetMmeProfiles(long mmeCodeId)
        {
            lock (_locker)
            {
                var list = new List <ProfileMme>();
                if (_connection == null || _connection.State != ConnectionState.Open)
                {
                    return(list);
                }

                list = _profilesService.GetProfileItemsSuperficially(null).Select(p => new ProfileMme {
                    Id = p.ProfileId, Name = p.ProfileName
                }).ToList();

                _codesSelectCommand.Parameters["@MME_CODE_ID"].Value = mmeCodeId;
                using (var reader = _codesSelectCommand.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        var id   = (int)reader[0];
                        var item = list.FirstOrDefault(p => p.Id.Equals(id));
                        if (!ReferenceEquals(item, null))
                        {
                            item.IsSelected = true;
                        }
                    }
                }

                return(list);
            }
        }