public Tarjeta GeTarjetaByUniquecode(string uniqueCode) { try { var terminal = new TerminalManager(); var tipoTarjeta = new TipoTarjetaManager(); var card = _crudFactory.Retrieve <Tarjeta>(new Tarjeta { CodigoUnico = uniqueCode }); if (card != null) { card.Terminal = terminal.RetrieveById(card.Terminal); card.TipoTarjeta = tipoTarjeta.GetCardTypeById(card.TipoTarjeta); if (card.Convenio != null && card.Convenio.CedulaJuridica != -1) { var convenioManger = new ConvenioManager(); card.Convenio = convenioManger.GetById(card.Convenio); } } return(card); } catch (Exception e) { ExceptionManager.GetInstance().Process(e); } return(null); }
public List <Tarjeta> GetTarjetas() { try { var terminal = new TerminalManager(); var tipoTarjeta = new TipoTarjetaManager(); var convenioManger = new ConvenioManager(); var listTarjetas = _crudFactory.RetrieveAll <Tarjeta>(); listTarjetas.ForEach(x => { x.TipoTarjeta = tipoTarjeta.GetCardTypeById(x.TipoTarjeta); x.Terminal = terminal.RetrieveById(x.Terminal); if (x.Convenio != null && x.Convenio.CedulaJuridica != -1) { x.Convenio = convenioManger.GetById(x.Convenio); } }); return(listTarjetas); } catch (Exception e) { ExceptionManager.GetInstance().Process(e); } return(new List <Tarjeta>()); }
public List <Solicitud> GetAll(int terminal = 0) { try { var solicitudes = _crudFactory.RetrieveAll <Solicitud>(); var terminalManger = new TerminalManager(); var convenioManager = new ConvenioManager(); solicitudes.ForEach(s => { s.Terminal = terminalManger.RetrieveById(s.Terminal); s.Convenio = convenioManager.GetById(s.Convenio); }); if (terminal != 0) { return(solicitudes.Where(s => s.Terminal.Id == terminal).ToList()); } return(solicitudes); } catch (Exception e) { ExceptionManager.GetInstance().Process(e); } return(new List <Solicitud>()); }
public Solicitud GetSolicitudById(Solicitud solicitud) { try { var solicitudResponse = _crudFactory.Retrieve <Solicitud>(solicitud); var terminalManger = new TerminalManager(); var convenioManager = new ConvenioManager(); if (solicitudResponse == null) { return(null); } solicitudResponse.Terminal = terminalManger.RetrieveById(solicitudResponse.Terminal); solicitudResponse.Convenio = convenioManager.GetById(solicitudResponse.Convenio); return(solicitudResponse); } catch (Exception e) { ExceptionManager.GetInstance().Process(e); } return(new Solicitud()); }