public CollectionEndPointSetCollectionCommand(
            ICollectionEndPoint modifiedEndPoint,
            DomainObjectCollection newCollection,
            IDomainObjectCollectionData modifiedCollectionData,
            ICollectionEndPointCollectionManager collectionEndPointCollectionManager,
            IClientTransactionEventSink transactionEventSink)
            : base(
                ArgumentUtility.CheckNotNull("modifiedEndPoint", modifiedEndPoint),
                null,
                null,
                ArgumentUtility.CheckNotNull("transactionEventSink", transactionEventSink))
        {
            ArgumentUtility.CheckNotNull("newCollection", newCollection);
            ArgumentUtility.CheckNotNull("modifiedCollectionData", modifiedCollectionData);
            ArgumentUtility.CheckNotNull("collectionEndPointCollectionManager", collectionEndPointCollectionManager);

            if (modifiedEndPoint.IsNull)
            {
                throw new ArgumentException("Modified end point is null, a NullEndPointModificationCommand is needed.", "modifiedEndPoint");
            }

            _newCollection          = newCollection;
            _modifiedCollectionData = modifiedCollectionData;
            _collectionEndPointCollectionManager = collectionEndPointCollectionManager;

            var oldOppositeObjects = ModifiedCollectionData;

            _removedObjects = oldOppositeObjects.Where(oldObject => !NewCollection.Contains(oldObject.ID)).ToArray();

            var newOppositeObjects = NewCollection.Cast <DomainObject> ();

            _addedObjects = newOppositeObjects.Where(newObject => !ModifiedCollectionData.ContainsObjectID(newObject.ID)).ToArray();
        }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     number    = 0;
     correct   = 0;
     allPuzzle = new NewCollection();
     allPuzzle.init();
     rollPuzzle();
 }
Ejemplo n.º 3
0
 private void UpdateButtonState()
 {
     NewCollection.RaiseCanExecuteChanged();
     OpenCollection.RaiseCanExecuteChanged();
     SaveCollection.RaiseCanExecuteChanged();
     EditCollection.RaiseCanExecuteChanged();
     DeleteCollection.RaiseCanExecuteChanged();
     CommitCollection.RaiseCanExecuteChanged();
     ReviewCollection.RaiseCanExecuteChanged();
 }
Ejemplo n.º 4
0
        public void deveRetornarMenosUmParaValorInexistente()
        {
            NewCollection collection = new NewCollection();

            collection.Add("ano", "1979");
            collection.Add("mes", "Agosto");
            collection.Add("mes", "Fevereiro");
            long retorno = collection.IndexOf("ano", "2017");

            Assert.AreEqual(-1, retorno);
        }
Ejemplo n.º 5
0
        private bool IsNeedSave()
        {
            var isNeedSave = false;

            if (!NewCollection.IsNullOrEmpty() ||
                !ModifiedCollection.IsNullOrEmpty() ||
                !DeletedCollection.IsNullOrEmpty())
            {
                isNeedSave = true;
            }
            return(isNeedSave);
        }
Ejemplo n.º 6
0
        private void UpdateButtonState()
        {
            NewCollection.RaiseCanExecuteChanged();
            OpenCollection.RaiseCanExecuteChanged();
            SaveCollection.RaiseCanExecuteChanged();
            EditCollection.RaiseCanExecuteChanged();
            DeleteCollection.RaiseCanExecuteChanged();
            CommitCollection.RaiseCanExecuteChanged();
            ReviewCollection.RaiseCanExecuteChanged();
            ViewRecordCommand.RaiseCanExecuteChanged();

            //IsSaveVisible = FormArgs == null ? false : FormArgs.HasNoRecords == false && FormArgs.ViewMode != FormMode.DELETEMODE;
            OnPropertyChanged("IsCommitVisible");
        }
Ejemplo n.º 7
0
        public void CountChangedTest()
        {
            NewCollection <Place> places = new NewCollection <Place>("Тестовая коллекция");
            Journal j = new Journal("Тестовый журнал");

            places.CollectionCountChanged += new CollectionHandler(j.CollectionCountChanged);

            //Act
            places.Add(new Place());
            places.Remove(new Place());

            //Assert
            Assert.AreEqual(2, j.Count);
        }
Ejemplo n.º 8
0
        public override void Commit()
        {
            if (!Committed)
            {
                var newList      = NewCollection.Select(pre => pre.Value).ToList();
                var modifiedList = ModifiedCollection.Select(pre => pre.Value).ToList();
                var deleteList   = DeletedCollection.Select(pre => pre.Value).ToList();

                localPersistenceDAL.Value.PersistenceToDatabase(newList, modifiedList, deleteList);

                //执行事务操作。
                Committed = true;
            }
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            NewCollection = await _context.NewCollection.FirstOrDefaultAsync(m => m.Id == id);

            if (NewCollection == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Ejemplo n.º 10
0
        public void deveRetornarIndiceCorreto()
        {
            NewCollection collection = new NewCollection();

            collection.Add("ano", "1979");
            collection.Add("mes", "Agosto");
            collection.Add("ano", "2007");
            collection.Add("mes", "Fevereiro");
            collection.Add("ano", "1994");
            collection.Add("mes", "Março");
            collection.Add("ano", "2004");
            collection.Add("ano", "1978");
            long retorno = collection.IndexOf("ano", "2007");

            Assert.AreEqual(4, retorno);
        }
Ejemplo n.º 11
0
        public void deveRemoverChavePassada()
        {
            NewCollection collection = new NewCollection();

            collection.Add("ano", "1979");
            collection.Add("mes", "Agosto");
            collection.Add("dia", "02");
            collection.Remove("ano");
            IList <string> retorno = new List <string>();

            retorno = collection.Get("ano", 0, 2);

            IList <string> result = new List <string>();

            Assert.AreEqual(result.ToString(), retorno.ToString());
        }
Ejemplo n.º 12
0
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            NewCollection = await _context.NewCollection.FindAsync(id);

            if (NewCollection != null)
            {
                _context.NewCollection.Remove(NewCollection);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 13
0
        public void deveRetornarListaDoPrimeiroAoPenultimo()
        {
            NewCollection collection = new NewCollection();

            collection.Add("ano", "1979");
            collection.Add("ano", "1994");
            collection.Add("ano", "2007");
            IList <string> retorno = new List <string>();

            retorno = collection.Get("ano", -1, -2);

            IList <string> result = new List <string>();

            result.Add("1979");
            result.Add("1994");

            Assert.AreEqual(result.ToString(), retorno.ToString());
        }
Ejemplo n.º 14
0
        public void ReferenceChangedTest()
        {
            NewCollection <Place> places = new NewCollection <Place>("Тестовая коллекция");
            Journal j = new Journal("Тестовый журнал");

            places.CollectionReferenceChanged += new CollectionHandler(j.CollectionReferenceChanged);
            places.Add(new Place());
            places.Add(new Region());

            places.Add(new Place());
            places.Add(new Region());
            places.Add(new Place());
            places.Add(new Address());

            places[1] = new Address();

            //Assert
            Assert.AreEqual(1, j.Count);
        }
Ejemplo n.º 15
0
        public void deveRetornarListaComTodosItensDaChave()
        {
            NewCollection collection = new NewCollection();

            collection.Add("ano", "1979");
            collection.Add("ano", "1994");
            collection.Add("ano", "2007");
            IList <string> retorno = new List <string>();

            retorno = collection.Get("ano", 0, 4);

            IList <string> result = new List <string>();

            result.Add("1979");
            result.Add("1994");
            result.Add("2007");

            Assert.AreEqual(result.ToString(), retorno.ToString());
        }
Ejemplo n.º 16
0
        static void chapter1()
        {
            NewCollection names = new NewCollection();

            names.Add("David");
            names.Add("Bernica");
            names.Add("Raymond");
            names.Add("Clayton");
            foreach (Object name in names)
            {
                Console.WriteLine(name);
            }
            String numOfNames = "Number of names: {0}";

            Console.WriteLine(numOfNames, names.Count());
            names.Remove("Raymond");
            Console.WriteLine(numOfNames, names.Count());
            names.Clear();
            Console.WriteLine(numOfNames, names.Count());
        }
Ejemplo n.º 17
0
 public void Test()
 {
     CollectionAssert.AreEquivalent(NewCollection.Concat(AnotherCollection), Uniter);
 }