public override List <T> RetrieveAll <T>() { var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.GetRetrieveByallStatement()); var dic = new List <Dictionary <string, object> >(); List <T> list = new List <T>(); if (lstResult.Count > 0) { for (int i = 0; i < lstResult.Count; i++) { dic.Add(lstResult[i]); } var objs = _mapper.BuildObjects(dic); for (int i = 0; i < lstResult.Count; i++) { list.Add((T)Convert.ChangeType(objs[i], typeof(T))); } return(list); } return(default(List <T>)); }
public List <T> RetrieveAllPermisoPuestos <T>(int id) { var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.RetrieveAllPermisosPorUsuario(id)); var dic = new List <Dictionary <string, object> >(); List <T> list = new List <T>(); if (lstResult.Count > 0) { for (int i = 0; i < lstResult.Count; i++) { dic.Add(lstResult[i]); } var objs = _mapper.BuildObjects(dic); for (int i = 0; i < lstResult.Count; i++) { list.Add((T)Convert.ChangeType(objs[i], typeof(T))); } return(list); } return(default(List <T>)); }
public List <T> RetrieveAllPorLinea <T>(Linea linea) { try { var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.GetRetrieveByallByLineaStatement(linea.Codigo)); var dic = new List <Dictionary <string, object> >(); List <T> list = new List <T>(); if (lstResult.Count > 0) { for (int i = 0; i < lstResult.Count; i++) { dic.Add(lstResult[i]); } var objs = _mapper.BuildObjects(dic); for (int i = 0; i < lstResult.Count; i++) { list.Add((T)Convert.ChangeType(objs[i], typeof(T))); } return(list); } return(default(List <T>)); } catch (Exception ex) { AdministrarExcepcion(ex); throw ex; } }
public override T Retrieve <T>(string id) { var um = new UMedida { Simbolo = id }; try { var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.GetRetriveStatement(um)); 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) { throw ex; } }
public override List <T> RetrieveAll <T>() { try { var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.GetRetrieveByallStatement()); var dic = new Dictionary <string, object>(); List <T> lista = new List <T>(); if (lstResult.Count > 0) { for (int i = 0; i < lstResult.Count; i++) { dic = lstResult[i]; var objs = _mapper.BuildObject(dic); lista.Add((T)Convert.ChangeType(objs, typeof(T))); } return(lista); } return(default(List <T>)); } catch (Exception ex) { throw ex; } }
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; } }
public Vagon obtenerUltimoVagonRegistrado() { var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.obtenerUltimoVagonRegistrado()); var dic = new Dictionary <string, object>(); if (lstResult.Count > 0) { dic = lstResult[0]; return((Vagon)Convert.ChangeType(_mapper.BuildObject(dic), typeof(Vagon))); } return(default(Vagon)); }
public override EntidadBase RCreate(EntidadBase entidad) { try { var registro = SqlDao.ExecuteQueryProcedure(_mapper.GetRCreateStatement(entidad)); var dic = new Dictionary <string, object>(); if (registro.Count > 0) { return(_mapper.BuildObject(registro[0])); } return(default(EntidadBase)); } catch (Exception ex) { AdministrarExcepcion(ex); throw ex; } }
public override T RetrieveByIngrediente <T>(EntidadBase entidad) { try { var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.GetRetriveByIngredienteStatement(entidad)); 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) { throw ex; } }
public override T Retrieve <T>(string nombre) { try { var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.GetRetriveByIdStatement(nombre)); 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; } }
public List <int> obtenerCantidadPorTipo(int id) { try { var lista = new List <int>(); var listaAdulto = SqlDao.ExecuteQueryProcedure(_mapper.obtenerCantidadAsientosAdulto(id)); lista.Add(listaAdulto.Count); var listaAdultoMayor = SqlDao.ExecuteQueryProcedure(_mapper.obtenerCantidadAsientosAdultoMayor(id)); lista.Add(listaAdultoMayor.Count); var listaVIP = SqlDao.ExecuteQueryProcedure(_mapper.obtenerCantidadAsientosVIP(id)); lista.Add(listaVIP.Count); return(lista); } catch (Exception ex) { AdministrarExcepcion(ex); throw ex; } }
public T RetrieveAutentificacion <T>(Usuario usuario) { try { var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.RetrievePorAutentificacion(usuario)); var dic = new Dictionary <string, object>(); if (lstResult.Count > 0) { dic = lstResult[0]; return((T)Convert.ChangeType(_mapper.BuildObjectVerify(dic), typeof(T))); } return(default(T)); } catch (Exception ex) { //Administrar Conexion Data Base AdministrarExcepcion(ex); throw ex; } }
public T RetrieveNoFrecuente <T>(string cedula) { try { var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.GetRetriveByIdStatementNoFrecuente(cedula)); var dic = new Dictionary <string, object>(); if (lstResult.Count > 0) { dic = lstResult[0]; return((T)Convert.ChangeType(_mapper.BuildObjectNoFrecuente(dic), typeof(T))); } return(default(T)); } catch (Exception ex) { //Administrar Conexion Data Base AdministrarExcepcion(ex); throw ex; } }
public override EntidadBase RCreate(EntidadBase entidad) { try { var registro = SqlDao.ExecuteQueryProcedure(_mapper.GetRCreateStatement(entidad)); var dic = new Dictionary <string, object>(); if (registro.Count > 0) { dic = registro[0]; var objs = _mapper.BuildObject(dic); return((Incidencia)Convert.ChangeType(objs, typeof(Incidencia))); } return(null); } catch (Exception ex) { AdministrarExcepcion(ex); throw ex; } }