Пример #1
0
        public SingleResponse <IList <AsegModel> > ConsultaAseguradoras(ClienteAsegModel clienteAseg)
        {
            SingleResponse <IList <AsegModel> > response = new SingleResponse <IList <AsegModel> >();

            try
            {
                IList <AsegModel> listAseg = iGestionDataAccess.ConsultaAseguradoras(clienteAseg);
                response.Done(listAseg, string.Empty);
                response.ThrowIfNotOk();
            }
            catch (DalException e)
            {
                response.Error(e);
            }
            catch (DomainValidationsException e)
            {
                response.SetValidations(e.Validations);
            }
            catch (DomainException e)
            {
                response.Error(e);
            }
            catch (Exception e)
            {
                response.Error(new DomainException(CodesTickets.ERR_00_17, e));
            }
            return(response);
        }
Пример #2
0
        public SingleResponse <IList <AsegModel> > ConsultaAseguradoras(ClienteAsegModel clienteAseg)
        {
            SingleResponse <IList <AsegModel> > response = new SingleResponse <IList <AsegModel> >();

            try
            {
                return(iGestionBussiness.ConsultaAseguradoras(clienteAseg));
            }
            catch (Exception)
            {
                response.Error(new DomainException(Codes.ERR_00_00));
            }
            return(response);
        }
Пример #3
0
 public IList <AsegModel> ConsultaAseguradoras(ClienteAsegModel clienteAseg)
 {
     try
     {
         var consulta = new StringBuilder();
         consulta.Append("SELECT AC.AsegId  AS AseguradoraId ");
         consulta.Append(",AC.Aseguradora AS Nombre  ");
         consulta.Append("FROM dbo.nePersonas PPC  ");
         consulta.Append("INNER JOIN (SELECT NC.PersonaID AS ClienteId ");
         consulta.Append(", NC.Nombre AS Cliente    ");
         consulta.Append(", NA.PersonaID AS AsegId   ");
         consulta.Append(", NA.Nombre AS Aseguradora ");
         consulta.Append("FROM dbo.RelacionDatos RD  ");
         consulta.Append("INNER JOIN dbo.nePersonas NA  ");
         consulta.Append("ON RD.OpcionA = 1169 ");
         consulta.Append("AND RD.OpcionB = 2059  ");
         consulta.Append("AND RD.ValorB = CAST(NA.PersonaID  AS VARCHAR(15))  ");
         consulta.Append("INNER JOIN dbo.nePersonas NC ");
         consulta.Append("ON  RD.ValorA = CAST(NC.PersonaID  AS VARCHAR(15))) AC  ");
         consulta.Append("ON AC.ClienteId = PPC.PersonaID ");
         consulta.Append("WHERE AC.ClienteId =  " + clienteAseg.ClienteId);
         iGenericDataAccess.OpenConnection();
         IList <VwAsegModel> lista = iGenericDataAccess.ExecuteQuery <VwAsegModel>(consulta.ToString());
         iGenericDataAccess.CloseConnection();
         IList <AsegModel> listAseg = lista.Select(
             x => new AsegModel()
         {
             AseguradoraId = x.AseguradoraId,
             Nombre        = x.Nombre
         }).ToList();
         listAseg.Add(new AsegModel()
         {
             AseguradoraId = 0,
             Nombre        = "NA"
         });
         return(listAseg.OrderBy(x => x.AseguradoraId).ToList());
     }
     catch (Exception e)
     {
         iGenericDataAccess.CloseConnection();
         throw new DalException(CodesTickets.ERR_00_16, e);
     }
 }