Beispiel #1
0
        //VER LISTA DE PAGOS
        //public List<Pago> obtenerPago()
        //{

        //    NpgsqlConnection conn = DAO.getInstanceDAO();
        //    conn.Open();
        //    string sql = "SELECT p.\"COD\", p.\"Peso\", p.\"Volumen\", tp.\"Clasificacion\", p.\"FK-EnvioP\", s.\"Nombre\", " +
        //                  "FROM \"Paquete\" p, \"TipoPaquete\" tp, \"Cliente\" c1, \"Cliente\" c2, \"Sucursal\" s " +
        //                  "WHERE p.\"FK - TipoPaquete\"= tp.\"COD\" and p.\"FK - Sucursal\"=s.\"COD\" and " +
        //                  "Order by p.\"COD\" ";
        //    NpgsqlCommand cmd = new NpgsqlCommand(sql, conn);
        //    NpgsqlDataReader dr = cmd.ExecuteReader();

        //    List<Pago> data = new List<Pago>();

        //    while (dr.Read())
        //    {
        //        System.Diagnostics.Debug.WriteLine("connection established");
        //        data.Add(new Pago()
        //        {
        //            cod = Int32.Parse(dr[0].ToString()),
        //            peso = Int32.Parse(dr[1].ToString()),
        //            volumen = Int32.Parse(dr[2].ToString()),
        //            ClasificacionTipoPaquete = dr[3].ToString(),
        //            fkEnvioP = Int32.Parse(dr[4].ToString()),
        //            NombreSucursal = dr[5].ToString(),
        //            NombreClienteEnvia = dr[6].ToString(),
        //            NombreClienteRecibe = dr[7].ToString(),
        //        });
        //    }
        //    dr.Close();
        //    conn.Close();
        //    return data;
        //}

        //BUSCAR A UNO
        public Pago buscarPago(int cod)
        {
            NpgsqlConnection conn = DAO.getInstanceDAO();

            conn.Open();
            string sql = "SELECT p.\"COD\", p.\"MontoTotal\", to_char(p.\"Fecha\", 'DD-MM-YYYY'), p.\"PagoDest\", pm.\"CODTarjeta\", " +
                         "pm.\"CODCheque\", pm.\"CODTrans\", pm.\"CODEfect\" " +
                         "FROM \"Pago\" p, \"Pago-Metodo\" pm " +
                         "WHERE p.\"COD\" = " + cod + " and p.\"COD\"=pm.\"CODPago\"";
            NpgsqlCommand    cmd = new NpgsqlCommand(sql, conn);
            NpgsqlDataReader dr  = cmd.ExecuteReader();

            Pago data = new Pago();

            while (dr.Read())
            {
                System.Diagnostics.Debug.WriteLine("connection established");
                data.cod           = Int32.Parse(dr[0].ToString());
                data.montoTotal    = Int32.Parse(dr[1].ToString());
                data.fecha         = dr[2].ToString();
                data.pagoEnDestino = dr[3].ToString();
                data.codMetodoPago = dr[4].ToString();
                data.metodoPago    = "Tarjeta";
                if (data.codMetodoPago == "")
                {
                    data.codMetodoPago = dr[5].ToString();
                    data.metodoPago    = "Cheque";
                }
                if (data.codMetodoPago == "")
                {
                    data.codMetodoPago = dr[6].ToString();
                    data.metodoPago    = "Transferencia";
                }
                if ((data.codMetodoPago == "") || (data.pagoEnDestino == "True"))
                {
                    data.codMetodoPago = dr[7].ToString();
                    data.metodoPago    = "Efectivo";
                }
                if (data.pagoEnDestino == "True")
                {
                    data.pagoEnDestino = "Si";
                }
                else
                {
                    data.pagoEnDestino = "No";
                }
            }
            dr.Close();
            conn.Close();
            return(data);
        }
Beispiel #2
0
        //BUSCAR A UNO POR CODIGO DE ENVIO
        public Pago buscarPagoEnvio(int cod)
        {
            NpgsqlConnection conn = DAO.getInstanceDAO();

            conn.Open();
            string sql = "SELECT p.\"COD\" " +
                         "FROM \"Pago\" p " +
                         "WHERE p.\"FK-EnvioP\" = " + cod + " ";
            NpgsqlCommand    cmd = new NpgsqlCommand(sql, conn);
            NpgsqlDataReader dr  = cmd.ExecuteReader();

            Pago data = new Pago();

            while (dr.Read())
            {
                System.Diagnostics.Debug.WriteLine("connection established");
                data.cod = Int32.Parse(dr[0].ToString());
            }
            dr.Close();
            conn.Close();
            return(data);
        }
Beispiel #3
0
        //BUSCANDO ULTIMO PAGO
        public Pago buscarUltimoPago()
        {
            NpgsqlConnection conn = DAO.getInstanceDAO();

            conn.Open();
            string sql = "SELECT  e.\"COD\", \"MontoTotal\" " +
                         "FROM \"Pago\" e " +
                         "Order by \"COD\" DESC " +
                         "LIMIT 1 ";
            NpgsqlCommand    cmd = new NpgsqlCommand(sql, conn);
            NpgsqlDataReader dr  = cmd.ExecuteReader();

            Pago data = new Pago();

            while (dr.Read())
            {
                System.Diagnostics.Debug.WriteLine("connection established");
                data.cod        = Int32.Parse(dr[0].ToString());
                data.montoTotal = Int32.Parse(dr[1].ToString());
            }
            dr.Close();
            conn.Close();
            return(data);
        }