Exemplo n.º 1
0
        public void DataPortal_Create(PhraseEdit criteria)
        {
            //INITIALIZE
            RetrieverId           = Guid.NewGuid();
            RetrievedPhrases      = null;
            RetrievedSinglePhrase = null;

            //GET ALL PHRASES (FOR THIS USER ONLY)
            PhraseList allPhrases = PhraseList.GetAll();

            var retrievedPhrase = FindPhraseInPhraseList(criteria.Text, criteria.Language.Text, allPhrases);

            //if we directly add this retrievedPhrase, then it will be a child
            //we need to get the non-child version of this
            //RetrievedPhrases.Add(criteriaPhrase.Id, retrievedPhrase);
            if (retrievedPhrase != null && retrievedPhrase.IsChild)
            {
                var nonChildVersion = PhraseEdit.GetPhraseEdit(retrievedPhrase.Id);
                RetrievedSinglePhrase = nonChildVersion;
            }
        }
Exemplo n.º 2
0
        public void DataPortal_Create(Criteria.PhraseTextsCriteria criteria)
        {
            RetrieverId = Guid.NewGuid();
            if (ExistenceDictionary == null)
            {
                ExistenceDictionary = new MobileDictionary <string, bool>();
            }

            PhraseList allPhrases           = PhraseList.GetAll();
            var        allPhrasesInLanguage = (from phrase in allPhrases
                                               where phrase.Language.Text == criteria.LanguageText
                                               select phrase);

            var phraseTextsNoDuplicates = criteria.PhraseTexts.Distinct();

            foreach (var phraseText in phraseTextsNoDuplicates)
            {
                var count = (from phrase in allPhrasesInLanguage
                             where phrase.Text == phraseText
                             select phrase).Count();
                var exists = count > 0;
                ExistenceDictionary.Add(phraseText, exists);
            }
        }