private void ImportarCBO(DataEntities dataContext, List<string> linhas) { linhas = linhas.Where(l => l.StartsWith("CBO|")).ToList(); int i = 0; foreach (string linha in linhas) { string[] fields = linha.Split('|'); remag_cbo cbo = new remag_cbo(); cbo.descricao = fields[2]; cbo.cbo = Convert.ToInt32(fields[1]); dataContext.AddToremag_cbo(cbo); backgroundWorker1.ReportProgress(i++); } }
private remag_cbo GetCBO(DataEntities dataContext,int cbo) { remag_cbo cboDB = dataContext.remag_cbo.FirstOrDefault(c => c.cbo == cbo); if (cbo == null) { cboDB = new remag_cbo(); cboDB.cbo = cbo; cboDB.descricao = "CBO Importação RAIS"; dataContext.AddToremag_cbo(cboDB); } return cboDB; }