private void SincronizaPresentacion() { try { migrationTable = migrationTableController.SelectOne(1); migrationFields = migrationFieldController.SelectByTableId(migrationTable.MigrationTableId); Sql = "SELECT "; foreach (var f in migrationFields) { if (migrationFields.Last() == f) { Sql += f.Expresion + " FROM " + migrationTable.Tabla; } else { Sql += f.Expresion + " , "; } } Sql += " " + migrationTable.Condicion; GetDataTable(Sql); presentacion = null; presentaciones = presentacionController.SelectAll(); foreach (DataRow row in dataTable.Rows) { Ambiente.S1 = row["clave"].ToString().Trim().ToUpper(); Ambiente.S2 = row["descrip"].ToString().Trim().ToUpper(); presentacion = presentaciones.FirstOrDefault(x => x.PresentacionId.ToUpper().Equals(Ambiente.S1)); if (presentacion == null) { presentacion = new Presentacion(); presentacion.PresentacionId = Ambiente.S1; presentacion.Nombre = Ambiente.S2; presentacion.IsDeleted = false; presentacionController.InsertOne(presentacion); } else { presentacion.Nombre = Ambiente.S2; presentacion.IsDeleted = false; presentacionController.Update(presentacion); } } Ambiente.Mensaje("Proceso concluido"); } catch (Exception ex) { Ambiente.Mensaje(ex.ToString()); } }