예제 #1
0
        /// <summary>
        /// Gets all of the translations that contain the given phrase, using that phrase's id.  This in
        /// contrast to searching through all translations' texts and matching up the phrase.text or regex, etc.
        /// THIS DOES NOT THROW AN EXCEPTION IF THE PHRASE IS NOT FOUND.
        /// </summary>
        public static async Task <TranslationList> GetAllTranslationsContainingPhraseByIdAsync(PhraseEdit phrase)
        {
            var criteria = new Criteria.PhraseCriteria(phrase);
            var result   = await DataPortal.FetchAsync <TranslationList>(criteria);

            return(result);
        }
예제 #2
0
        protected void DataPortal_Fetch(Criteria.PhraseCriteria phraseCriteria)
        {
            using (var dalManager = DalFactory.GetDalManager())
            {
                var TranslationDal = dalManager.GetProvider <ITranslationDal>();
                Result <ICollection <TranslationDto> > result = TranslationDal.FetchByPhraseId(phraseCriteria.Phrase.Id);
                if (!result.IsSuccess)
                {
                    Exception error = result.GetExceptionFromInfo();
                    if (error != null)
                    {
                        throw error;
                    }
                    else
                    {
                        throw new FetchFailedException(result.Msg);
                    }
                }

                //RESULT WAS SUCCESSFUL
                var translationDtos = result.Obj;
                foreach (var translationDto in translationDtos)
                {
                    //var TranslationEdit = DataPortal.CreateChild<TranslationEdit>(TranslationDto);
                    var translationEdit = DataPortal.FetchChild <TranslationEdit>(translationDto);
                    this.Add(translationEdit);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Gets all of the translations that contain the given phrase, using that phrase's id.  This in
        /// contrast to searching through all translations' texts and matching up the phrase.text or regex, etc.
        /// THIS DOES NOT THROW AN EXCEPTION IF THE PHRASE IS NOT FOUND.
        /// </summary>
        public static TranslationList GetAllTranslationsContainingPhraseById(PhraseEdit phrase)
        {
            var criteria = new Criteria.PhraseCriteria(phrase);

            return(DataPortal.Fetch <TranslationList>(criteria));
        }