public static DataSetEntity Converter(DataSet ds) { var dataSetEntity = new DataSetEntity(); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow row in ds.Tables[0].Rows) { dataSetEntity.Usuario.CodUsuario = Convert.ToInt64(row["CodUsuario"]); } } if (ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0) { foreach (DataRow row in ds.Tables[1].Rows) { dataSetEntity.Contatos.Add(new Contato(Convert.ToInt64(row["CodContato"]))); } } if (ds.Tables[2] != null && ds.Tables[2].Rows.Count > 0) { foreach (DataRow row in ds.Tables[2].Rows) { dataSetEntity.Enderecos.Add(new Endereco(Convert.ToInt64(row["CodEndereco"]))); } } return(dataSetEntity); }
protected override void PopularListaDataSet(DataSet dataSet, DataSetEntity dataSetEntity) { foreach (DataRow row in dataSet.Tables[1].Rows) { dataSetEntity.Contatos.Add(new Contato(Convert.ToInt64(row["CodContato"]))); } }
protected override void PopularListaDataSet(DataSet dataSet, DataSetEntity dataSetEntity) { foreach (DataRow row in dataSet.Tables[2].Rows) { dataSetEntity.Enderecos.Add(new Endereco(Convert.ToInt64(row["CodEndereco"]))); } }
public static DataSetEntity ConverterDataSet(DataSet dataSet) { var dataSetEntity = new DataSetEntity(); new DataSetUsuario().Converter(dataSet, dataSetEntity); new DataSetContato().Converter(dataSet, dataSetEntity); new DataSetEndereco().Converter(dataSet, dataSetEntity); return(dataSetEntity); }
public void Converter(DataSet dataSet, DataSetEntity dataSetEntity) { if (VerificarSeDevoPopularUmaLista(dataSet)) { PopularListaDataSet(dataSet, dataSetEntity); } else { PopularDadaset(dataSet, dataSetEntity); } }
protected override void PopularDadaset(DataSet dataSet, DataSetEntity dataSetEntity) { }
protected override void PopularDadaset(DataSet dataSet, DataSetEntity dataSetEntity) { dataSetEntity.Usuario = new Usuario(Convert.ToInt64(dataSet.Tables[0].Rows[0]["CodUsuario"])); }
protected override void PopularListaDataSet(DataSet dataSet, DataSetEntity dataSetEntity) { }
protected abstract void PopularListaDataSet(DataSet dataSet, DataSetEntity dataSetEntity);
protected abstract void PopularDadaset(DataSet dataSet, DataSetEntity dataSetEntity);