private static int UpdateCustomFieldsSqlite(ProgressDialogContext context, TmFile tmFile, List <TmTranslationUnit> units) { if (units.Count == 0) { return(0); } int updatedCount; var service = new SqliteTmService(tmFile.Path, null, new SerializerService(), new SegmentService()); try { service.OpenConnection(); updatedCount = service.UpdateCustomFields(context, units); } catch (Exception ex) { Console.WriteLine(ex); throw; } finally { service.CloseConnection(); } return(updatedCount); }
private static int UpdateSystemFieldsSqlite(ProgressDialogContext context, TmFile tmFile, IEnumerable <TmTranslationUnit> units, List <User> uniqueUsers) { var updatedCount = 0; var service = new SqliteTmService(tmFile.Path, null, new SerializerService(), new SegmentService()); try { service.OpenConnection(); var updateList = units.Where(unit => UpdateSystemFields(uniqueUsers, unit)).ToList(); if (updateList.Count > 0) { updatedCount = service.UpdateSystemFields(context, updateList); } } catch (Exception ex) { Console.WriteLine(ex); throw; } finally { service.CloseConnection(); } return(updatedCount); }