예제 #1
0
        public List <Estacion> RetrieveEstacionesByLinea(string linea)
        {
            EstacionMapper _estacionMapper = new EstacionMapper();

            try
            {
                var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.GetEstacionesRetriveByLineaStatement(linea));
                var lis       = new List <Estacion>();
                var i         = 0;

                if (lstResult.Count > 0)
                {
                    foreach (var dic in lstResult)
                    {
                        lis.Add((Estacion)Convert.ChangeType(_estacionMapper.BuildObject(lstResult[i]), typeof(Estacion)));
                        i++;
                    }
                }
                return(lis);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        public override T Retrieve <T>(string codigo)
        {
            try
            {
                var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.GetRetriveByIdStatement(codigo));
                var dic       = new Dictionary <string, object>();
                if (lstResult.Count > 0)
                {
                    dic = lstResult[0];

                    return((T)Convert.ChangeType(_mapper.BuildObject(dic), typeof(T)));
                }

                return(default(T));
            }
            catch (Exception ex)
            {
                AdministrarExcepcion(ex);
                throw ex;
            }
        }