private List <Rastreo> GetList()
 {
     try
     {
         List <Rastreo> list       = new List <Rastreo>();
         CN_Rastreo     cn_rastreo = new CN_Rastreo();
         Rastreo        rastreo    = new Rastreo();
         rastreo.Id_Emp       = session.Id_Emp;
         rastreo.Id_Cd        = session.Id_Cd_Ver;
         rastreo.Ras_TipoDoc  = Convert.ToInt32(cmbTipo.SelectedValue);
         rastreo.Ras_SerieDoc = cmbSerie.Text;
         rastreo.Ras_Doc      = txtDocumento.Text;
         cn_rastreo.Lista(rastreo, ref list, session.Emp_Cnx);
         return(list.Where(Rastreo => Rastreo.Doc_Fecha >= dpFecha.SelectedDate.Value.AddDays(-30)).ToList());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 private List <Rastreo> GetLogList()
 {
     try
     {
         List <Rastreo> list       = new List <Rastreo>();
         CN_Rastreo     cn_rastreo = new CN_Rastreo();
         Rastreo        rastreo    = new Rastreo();
         rastreo.Id_Emp       = session.Id_Emp;
         rastreo.Id_Cd        = session.Id_Cd_Ver;
         rastreo.Ras_TipoDoc  = Convert.ToInt32(cmbTipo.SelectedValue);
         rastreo.Ras_SerieDoc = cmbSerie.Text;
         rastreo.Ras_Doc      = txtDocumento.Text;
         cn_rastreo.LogDocumento(rastreo, ref list, session.Emp_Cnx);
         return(list);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 protected void imgAceptar_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         Sesion Sesion = new Sesion();
         Sesion = (Sesion)Session["Sesion" + Session.SessionID];
         if (cmbTipo.SelectedValue == "1")
         {
             CN_CapFactura cn_capfactura = new CN_CapFactura();
             CN_Rastreo    cn_rastreo    = new CN_Rastreo();
             Factura       fac           = new Factura();
             fac.Id_Emp      = session.Id_Emp;
             fac.Id_Cd       = session.Id_Cd_Ver;
             fac.Id_FacSerie = cmbSerie.Text + txtDocumento.Text;
             cn_capfactura.Rastreo(ref fac, session.Emp_Cnx);
             if (fac.Id_Cte != 0)
             {
                 txtClienteId.Value   = fac.Id_Cte;
                 txtCliente.Text      = fac.Cte_NomComercial;
                 txtIva.Value         = fac.Fac_ImporteIva;
                 txtImporte.Value     = fac.Fac_SubTotal;
                 txtTotal.Value       = fac.Fac_ImporteIva + fac.Fac_SubTotal;
                 txtSaldo.Value       = fac.Fac_ImporteIva + fac.Fac_SubTotal - fac.Fac_Pagado;
                 txtEstatus.Text      = fac.Fac_EstatusStr;
                 dpFecha.SelectedDate = fac.Fac_Fecha == default(DateTime) ? null : (DateTime?)fac.Fac_Fecha;
                 rgDocumentos.Rebind();
                 rgLogDocumento.Rebind();
             }
             else
             {
                 Limpiar();
                 Alerta("No se encontrĂ³ el documento");
             }
         }
         else
         {
             CN_CapNotaCargo cn_capnota = new CN_CapNotaCargo();
             NotaCargo       nca        = new NotaCargo();
             nca.Id_Emp      = Sesion.Id_Emp;
             nca.Id_Cd       = Sesion.Id_Cd_Ver;
             nca.Id_NcaSerie = cmbSerie.Text + txtDocumento.Text;
             cn_capnota.Rastreo(ref nca, Sesion.Emp_Cnx);
             if (nca.Id_Cte != 0)
             {
                 txtClienteId.Value   = nca.Id_Cte;
                 txtCliente.Text      = nca.Cte_NomComercial;
                 txtIva.Value         = nca.Nca_Iva;
                 txtImporte.Value     = nca.Nca_Subtotal;
                 txtTotal.Value       = nca.Nca_Iva + nca.Nca_Subtotal;
                 txtSaldo.Value       = nca.Nca_Iva + nca.Nca_Subtotal - nca.Nca_Pagado;
                 txtEstatus.Text      = nca.Nca_EstatusStr;
                 dpFecha.SelectedDate = nca.Nca_Fecha;
                 rgDocumentos.Rebind();
             }
             else
             {
                 Limpiar();
                 Alerta("No se encontrĂ³ el documento");
             }
         }
     }
     catch (Exception ex)
     {
         ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name);
     }
 }