public void AddAndEditTerm(IEntry term, string source, string target)
 {
     var dataGrid = new ExcelDataGrid
     {
         Term = target,
         Approved = null
     };
     AddAndEditAction?.Invoke(term, dataGrid);
 }
Пример #2
0
        public void AddAndEdit(IEntry entry, ExcelDataGrid excelDataGrid)
        {
            try
            {
                var selectedTerm = _terms.FirstOrDefault(item => item.Id == entry.Id);
                var termToAdd = new EntryTerm
                {
                    Value = excelDataGrid.Term
                };

                var excelTerm = new ExcelTerm
                {
                    SourceCulture = entry.Languages[0].Locale,
                    TargetCulture = entry.Languages[1].Locale,
                    Target = excelDataGrid.Term
                };
                var source = (ExcelEntry) entry;
                excelTerm.Source = source.SearchText;

                var exist = false;
                if (selectedTerm != null)
                {
                    foreach (var term in selectedTerm.Languages[1].Terms)
                    {
                        if (term.Value == excelDataGrid.Term)
                        {
                            exist = true;
                        }


                    }

                    if (exist == false)
                    {
                        selectedTerm.Languages[1].Terms.Add(termToAdd);

                        _terms[entry.Id].Languages = selectedTerm.Languages;
                    }

                }

                JumpToTerm(entry);
                Task.Run(Save);
            }
            catch (Exception ex)
            {
                TelemetryService.Instance.AddException(ex);
                throw;
            }
        }