public override bool Buscar(int IdBuscado)
{
DataTable dtMetas = new DataTable();
DataTable dtMetasDetalle = new DataTable();
bool retorno = false;
try
{
dtMetas = conexion.ObtenerDatos(string.Format("select * from Metas where MetaId = {0}", IdBuscado));
if (dtMetas.Rows.Count > 0)
{
this.Descripcion = dtMetas.Rows[0]["Descripcion"].ToString();
this.UsuarioId = (int)dtMetas.Rows[0]["UsuarioId"];
dtMetasDetalle = conexion.ObtenerDatos(String.Format("select * from MetasDetalle where MetaId = {0}", IdBuscado));
LimpiarList();
foreach (DataRow row in dtMetasDetalle.Rows)
{
AgregarMetas((int)row["MetaId"], (int)row["TipoIngresoId"], (double)row["Monto"]);
}
retorno = true;
}
}
catch (Exception)
{
retorno = false;
}
return retorno;
}