Ejemplo n.º 1
0
        internal void RemoveSingleFromCollection(SingleViewModel singleToRemove)
        {
            int     artistId       = GetArtistId(singleToRemove);
            Singles recordToRemove = MapSingleData(singleToRemove, artistId);

            _connection.Delete(recordToRemove);
        }
Ejemplo n.º 2
0
        public List <string> GetSingles()
        {
            Singles = new();

            string sign = "";

            for (int i = 0; i < 13; i++)
            {
                Random random = new();

                int number = random.Next(1, 3 + 1);
                switch (number)
                {
                case 1:
                    sign = "1";
                    break;

                case 2:
                    sign = "X";
                    break;

                case 3:
                    sign = "2";
                    break;

                default:
                    break;
                }
                Singles.Add(sign);
            }
            return(Singles);
        }
Ejemplo n.º 3
0
        internal void UpdateSingle(SingleViewModel recordToUpdate)
        {
            int     artistId       = GetArtistId(recordToUpdate);
            Singles singleToChange = MapSingleData(recordToUpdate, artistId);

            UpdateGenres(recordToUpdate);
            _connection.Update(singleToChange);
        }
Ejemplo n.º 4
0
        internal int AddSingleToCollection(SingleViewModel recordToAdd)
        {
            int     artistId    = GetArtistId(recordToAdd);
            Singles singleToAdd = MapSingleData(recordToAdd, artistId);

            _connection.Insert(singleToAdd);
            return(_connection.ExecuteScalar <int>("SELECT LAST_INSERT_ROWID()"));
        }
Ejemplo n.º 5
0
 public static Singles SetInstance()
 {
     if (uniqueInstance == null)
     {
         uniqueInstance = new Singles();
     }
     return(uniqueInstance);
 }
Ejemplo n.º 6
0
 Operation_Single GetStopOperate(IOperator oper, EOperationMask mask)
 {
     if (Singles != null)
     {
         return(Singles.Find(ret => ret != null && ret.m_Mask == mask && ret.ContainsOperator(oper)));
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 7
0
 public Operation_Single GetStartOperate(EOperationMask mask)
 {
     if (Singles != null)
     {
         return(Singles.Find(ret => ret != null && ret.CanOperateMask(mask)));
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 8
0
 public bool IsBelongsToMe(Version version)
 {
     foreach (var range in Ranges)
     {
         if (range.Item1 <= version && range.Item2 >= version)
         {
             return(true);
         }
     }
     return(Singles.Exists(p => p == version));
 }
Ejemplo n.º 9
0
        public void Test1()
        {
            //Arrange, Act, Assert
            var MyArray      = new int[] { 2, 4, 6, 8, 10, 2, 6, 10 };
            var singlesArray = new Singles();

            //Act
            var result   = singlesArray.GetSingles(MyArray);
            var expected = new int[] { 4, 8 };

            //Assert
            Assert.Equal(result, expected);
        }
Ejemplo n.º 10
0
        public void Test2()
        {
            //Arrange
            var MyArray      = new int[] { 1, 2, 3, 2, 1, 4, 4, 6, 7, 8, 7, 6, 9, 9 };
            var singlesArray = new Singles();

            //Act
            var result   = singlesArray.GetSingles(MyArray);
            var expected = new int[] { 3, 8 };

            //Assert
            Assert.Equal(result, expected);
        }
Ejemplo n.º 11
0
 public ArtistSinglesViewModel(Artist artist)
 {
     PlayAudioTrack = delegate(Track track)
     {
         var l =
             MediaPropertiesLibrary.Audio.Library.Library.Songs.Where(t => t.Artists.Contains(artist))
             .ToList();
         DispatcherLibrary.Dispatcher.Dispatch("Multiple Track Selected For Play", l, l.FindIndex(t => t == track));
     };
     _singles.Source = new ObservableCollection <Track>(artist.Singles);
     Singles.Refresh();
     OnPropertyChanged(nameof(Singles));
 }
Ejemplo n.º 12
0
        private Singles MapSingleData(SingleViewModel recordToUpdate, int artistId)
        {
            Singles singleToChange = new Singles()
            {
                SingleId           = recordToUpdate.singleId,
                ASideTitle         = recordToUpdate.aSideTitle,
                BSideTitle         = recordToUpdate.bSideTitle,
                SingleYear         = recordToUpdate.singleYear,
                Dinked             = recordToUpdate.dinked,
                JukeboxCardPrinted = recordToUpdate.jukeboxCardPrinted,
                PictureCover       = recordToUpdate.pictureCover,
                SingleLabelPrinted = recordToUpdate.singleLabelPrinted,
                ArtistId           = artistId
            };

            return(singleToChange);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 解析一个mono实例。
        /// 优先从单例字典中获取。
        /// </summary>
        /// <param name="implType"></param>
        /// <param name="path"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        private object ResloveMono(Type implType, string path, GameObject parent)
        {
            object targetMono = null;
            var    isSingle   = implType.IsSingle();

            if (isSingle && Singles.ContainsKey(implType))
            {
#if UNITY_EDITOR
                targetMono = OnSingleMonoAtEditor(implType, path, parent);
#else
                targetMono = OnSingleMonoAtPlay(implType, path, parent);
#endif
            }

            if (targetMono != null)
            {
                return(targetMono);
            }

            if (!string.IsNullOrEmpty(path) && PathMapObjs.ContainsKey(path))
            {
                var mono = PathMapObjs[path];
                return(mono);
            }

            targetMono = CreateNewMono(path, implType, isSingle, parent);
            if (isSingle)
            {
                CacheToSingles(implType, targetMono);
            }
            else
            {
                CacheToPathMapObjs(path, targetMono);
            }

            var fieldInfos    = GetInjectFieldInfos(implType);
            var propertyInfos = GetInjectPropertyInfos(implType);
            InjectMonoFields(targetMono, fieldInfos);
            InjectMonoPropertys(targetMono, propertyInfos);
            InvokeInit(targetMono);

            return(targetMono);
        }
Ejemplo n.º 14
0
 public bool UpdateCronogramaCompetidor(int cronogramaId, int competidorId, string posicion, int parametromedallaId, int Sembrado, int esGanador, bool esRecord, decimal marca, string tiempo)
 {
     return(Singles.UpdateCronograma(cronogramaId, competidorId, posicion, parametromedallaId, Sembrado, marca, esGanador, esRecord, tiempo));
 }