private TranslateResultView convertResponseToTranslateResult(YandexTranslateScheme deserializedObject)
 {
     TranslateResultView result = new TranslateResultView();
     var translateVariants = new List<ResultLineData>();
     translateVariants.Add(new ResultLineData(deserializedObject.Text[0], DefinitionTypesEnum.translater));
     result.AddDefinition(sourceString, DefinitionTypesEnum.translater, string.Empty, translateVariants);
     return result;
 }
 public override TranslateResultView Parse(string responseText)
 {
     TranslateResultView result;
     YandexTranslateScheme deserializedResponse = JsonConvert.DeserializeObject<YandexTranslateScheme>(responseText);
     if (null != deserializedResponse)
         result = convertResponseToTranslateResult(deserializedResponse);
     else
         result = new TranslateResultView();
     return result;
 }
 //ToDo:ќшибка!ѕри записи тер¤ютс¤ заглавные буквы, к примеру Russian, из-за этого сбиваетс¤ разметка
 private TranslateResultView convertResponseToTranslateResult(YandexDictionaryScheme deserializedObject)
 {
     string originalString = deserializedObject.Def.Count > 0 ? deserializedObject.Def[0].Text : string.Empty;
     TranslateResultView result = new TranslateResultView();
     foreach (var def in deserializedObject.Def)
     {
         var translateVariantsSource = def.Tr;
         var translateVariants = new List<ResultLineData>();
         foreach (var tr in translateVariantsSource)
         {
             translateVariants.Add(new ResultLineData(tr.Text, DefinitionTypesManager.GetEnumDefinitionTypeFromName(tr.Pos)));
         }
         result.AddDefinition(def.Text, DefinitionTypesManager.GetEnumDefinitionTypeFromName(def.Pos), def.Ts, translateVariants);
     }
     return result;
 }
 private TranslateResultView createTranslateResult(string sourceString, List<SourceExpression> sourceList, List<SourceDefinition> definitionsList, List<Tuple<TranslatedExpression, Favorites>> translatedList)
 {
     TranslateResultView result = new TranslateResultView();
     foreach (var definition in definitionsList)
     {
         List<ResultLineData> translateVariants = new List<ResultLineData>();
         var viewVariants = from item in translatedList where item.Item1.SourceDefinitionID == definition.ID select new { item.Item1, item.Item2 };
         foreach (var item in viewVariants)
         {
             var dataLine = new ResultLineData(item.Item1.TranslatedText, (DefinitionTypesEnum)(item.Item1.DefinitionTypeID));
             dataLine.TranslatedExpressionId = item.Item1.ID;
             if(item.Item2!=null)
             {
                 dataLine.FavoritesId = item.Item2.ID;
             }
             translateVariants.Add(dataLine);
         }
         result.AddDefinition(sourceString, (DefinitionTypesEnum)definition.DefinitionTypeID, definition.TranscriptionText, translateVariants);
     }
     return result;
 }
 private void writeTranslatedExpression(int sourceItemID, TranslateResultView resultView)
 {
     DefinitionTypesManager defTypesManager = new DefinitionTypesManager(db);
     List<DefinitionTypes> defTypesList = defTypesManager.GetItems();
     Repository<SourceDefinition> reposSourceDefinition = new Repository<SourceDefinition>();
     Repository<TranslatedExpression> reposTranslatedExpression = new Repository<TranslatedExpression>();
     foreach (var curDefinition in resultView.Definitions)
     {
         SourceDefinition sourceDefinitionItem = new SourceDefinition();
         sourceDefinitionItem.SourceExpressionID = sourceItemID;
         sourceDefinitionItem.TranscriptionText = curDefinition.Transcription;
         sourceDefinitionItem.DefinitionTypeID = (int)curDefinition.Pos;
         reposSourceDefinition.Save(sourceDefinitionItem);
         int sourceDefId = getSourceDefinitionItemId(sourceItemID, curDefinition);
         foreach (var curVariant in curDefinition.TranslateVariants)
         {
             TranslatedExpression translatedItem = new TranslatedExpression();
             translatedItem.TranslatedText = curVariant.Text;
             translatedItem.SourceDefinitionID = sourceDefId;
             translatedItem.DefinitionTypeID = (int)curVariant.Pos;
             translatedItem.LanguageFromID = direction.LanguageFrom.ID;
             translatedItem.LanguageToID = direction.LanguageTo.ID;
             //translatedItem.DirectionID = direction.GetCurrentDirectionId();
             reposTranslatedExpression.Save(translatedItem);
             fillTranslateResultIdsForNewItem(translatedItem.SourceDefinitionID, translatedItem.DefinitionTypeID, curVariant);
         }
     }
 }
 public void SetTranslateResult(TranslateResultView translatedData)
 {
     TranslatedData = translatedData;
 }
        public string errorDescription; //ToDo:переделать на приватное

        #endregion Fields

        #region Constructors

        public TranslateRequestResult(string originalText)
        {
            this.OriginalText = originalText;
            TranslatedData = new TranslateResultView();
        }