Ejemplo n.º 1
0
        public void DataPortal_Fetch(MultiLineTextList mltList)
        {
            using (var dalManager = DalFactory.GetDalManager())
            {
                var beliefDal = dalManager.GetProvider <IPhraseBeliefDal>();

                ///SLOW METHOD RIGHT NOW. ITERATE THROUGH ALL PHRASES
                ///IN LINES OF MLTS, AND GET ALL BELIEFS ABOUT THOSE PHRASES.
                for (int i = 0; i < mltList.Count; i++)
                {
                    var mlt = mltList[i];
                    for (int j = 0; j < mlt.Lines.Count; j++)
                    {
                        var phrase = mlt.Lines[j].Phrase;
                        Result <ICollection <PhraseBeliefDto> > result =
                            beliefDal.FetchAllRelatedToPhrase(phrase.Id);

                        //IF ERROR
                        if (!result.IsSuccess || result.IsError)
                        {
                            if (result.Info != null)
                            {
                                var ex = result.GetExceptionFromInfo();
                                if (ex != null)
                                {
                                    throw new FetchFailedException(ex.Message);
                                }
                                else
                                {
                                    throw new FetchFailedException();
                                }
                            }
                            else
                            {
                                throw new FetchFailedException();
                            }
                        }

                        //NO ERROR, SO ADD THESE BELIEFS TO OUR LIST
                        AddDtos(result.Obj);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        GetBeliefsAboutPhrasesInMultiLineTextsAsync(MultiLineTextList mltList)
        {
            var result = await DataPortal.FetchAsync <PhraseBeliefList>(mltList);

            return(result);
        }