예제 #1
0
 internal void SaveResourceTranslated(GetWordForTranslate_Result data, CallBankService objectT)
 {
     entity.WordTranslates.Add(new WordTranslate
     {
         WordID     = data.WordID,
         LanguageId = data.LangId,
         Translated = objectT.Text,
         AllWords   = objectT.All.Aggregate((x, y) => x + ", " + y).Trim(' ', ','),
         AllData    = data.Translated,
         CreateDate = DateTime.Now
     });
     entity.SaveChanges();
     try
     {
         if (entity.WordTranslates.Count(x => x.WordID == data.WordID) == entity.Languages.Count())
         {
             entity.AllWordFromPaymons.Where(x => x.ID == data.WordID)
             .UpdateFromQuery(x => new AllWordFromPaymon {
                 Translated = true
             });
         }
     }
     catch
     {
     }
 }
예제 #2
0
        internal void SaveResourceTranslatedCompare(GetWordForTranslate_Result data, CallBankService objectT)
        {
            var ob = new WordTranslateCompare {
                WordID = data.WordID,

                LanguageId = data.LangId,
                Translated = objectT.Text,
                AllWords   = objectT.All.Aggregate((x, y) => x + ", " + y).Trim(' ', ','),
                AllData    = data.Translated,
                CreateDate = DateTime.Now
            };
            var ret = TranslatorServiceCompare.ProcessTranslateFiles(ob.Translated, ob);

            ob.Translated = ret.First;
            ob.AllWords   = ret.AllWords;

            entity.WordTranslateCompares.Add(ob);
            entity.SaveChanges();
            try
            {
                if (entity.WordTranslateCompares.Count(x => x.WordID == data.WordID) == 1)
                {
                    ;//entity.Languages.Count())
                }
                {
                    entity.AllWordFromPaymonCompares.Where(x => x.ID == data.WordID)
                    .UpdateFromQuery(x => new AllWordFromPaymonCompare {
                        Translated = true
                    });
                }
            } catch
            {
            }
        }