示例#1
0
        private void FillModel(WordData model, Language language, List <Word> words, CategorizedWord catWord)
        {
            var category     = _context.Categories.Find(catWord.CategoryId);
            var translations = _context.Translations.Where(t => t.CategorizedWordId == catWord.Id).ToList();
            var helper       = new WordDataHelper(_context, _accessor);

            model.WordId         = catWord.WordId;
            model.Word           = words.Find(w => w.Id == catWord.WordId).ThisWord;
            model.LanguageId     = language.Id;
            model.Language       = language.Name;
            model.CategoryId     = catWord.CategoryId;
            model.Category       = catWord.Category.Name;
            model.CatWordId      = catWord.Id;
            model.TranslationIds = helper.TranslationIdsToString(translations);
            model.Translation    = helper.TranslationsToString(translations);
        }
示例#2
0
        private void FillWorksheet(IXLWorksheet worksheet, List <CategorizedWord> catWords)
        {
            worksheet.Cell(WORD_CELL).Value  = WORD;
            worksheet.Cell(LANG_CELL).Value  = LANG;
            worksheet.Cell(CAT_CELL).Value   = CAT;
            worksheet.Cell(TRAN_CELL).Value  = TRAN;
            worksheet.Row(1).Style.Font.Bold = true;

            for (int i = 0; i < catWords.Count; i++)
            {
                var word         = _context.Words.Find(catWords[i].WordId);
                var language     = _context.Languages.Find(word.LanguageId);
                var category     = _context.Categories.Find(catWords[i].CategoryId);
                var translations = _context.Translations.Where(t => t.CategorizedWordId == catWords[i].Id).ToList();

                worksheet.Cell(i + 2, WORD_IND).Value = word.ThisWord;
                worksheet.Cell(i + 2, LANG_IND).Value = language.Name;
                worksheet.Cell(i + 2, CAT_IND).Value  = category.Name;
                worksheet.Cell(i + 2, TRAN_IND).Value = _helper.TranslationsToString(translations);
            }
        }