Пример #1
0
        public static DataTable listarCupondesDeProveedor(int proveeedor_id, string codigo = null)
        {
            SqlConnection conn  = ConexionBD.getConexion();
            var           tabla = new DataTable();

            try
            {
                SqlCommand cmd = new SqlCommand("JARDCOUD.listar_cupones_de_proveedor", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@proveedor_id", proveeedor_id);
                if (codigo != "" && codigo != null)
                {
                    cmd.Parameters.AddWithValue("@codigo", codigo);
                }
                cmd.Parameters.AddWithValue("@fecha", FechaAplicacion.get());

                using (var adaptador = new SqlDataAdapter(cmd))
                {
                    adaptador.Fill(tabla);
                }
            }
            catch (SqlException e)
            {
                MessageBox.Show(e.Message);
                return(tabla);
            }
            conn.Close();
            return(tabla);
        }
Пример #2
0
        private void btnSeleccionar_Click(object sender, EventArgs e)
        {
            if (dgvClientes.RowCount != 0)
            {
                Cliente cliente_seleccionado = this.get_cliente_seleccionado();
                cupon.fecha_de_consumo = FechaAplicacion.get();

                if (CuponDAO.darBajaCupon(cliente_seleccionado, cupon))
                {
                    MessageBox.Show("Cupon cajenado correctamente");
                    form_anterior.cargarDatos();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("No se pudo dar de baja el cupon");
                    form_anterior.cargarDatos();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Seleccione un Cliente");
            }
        }
Пример #3
0
 public frmABM()
 {
     InitializeComponent();
     this.selectorFechaNacimiento.MaxDate      = (FechaAplicacion.obtenerFechaAplicacion()).AddYears(-18);
     this.selectorFechaNacimiento.Value        = (FechaAplicacion.obtenerFechaAplicacion()).AddYears(-18);
     this.selectorFechaNacimiento.Format       = DateTimePickerFormat.Custom;
     this.selectorFechaNacimiento.CustomFormat = "dd 'de' MMMM 'de' yyyy";
 }
Пример #4
0
        private void CargaCredito_Load(object sender, EventArgs e)
        {
            cmbTipoPago.DataSource    = TipoPagoDAO.listarDatosTarjetas();
            cmbTipoPago.DisplayMember = "descripcion"; //muestra solo los datos de esa columna
            cmbTipoPago.ValueMember   = "id";
            cmbTipoPago.SelectedIndex = -1;            // para que no seleccione nada

            txtNombreCliente.Text = cliente.nombre + " " + cliente.apellido;
            txtFecha.Text         = FechaAplicacion.get().ToString("dd/MM/yyyy");

            txtNumeroTarjeta1.MaxLength  = 4;
            txtNumeroTarjeta2.MaxLength  = 4;
            txtNumeroTarjeta3.MaxLength  = 4;
            txtNumeroTarjeta4.MaxLength  = 4;
            txtMes.MaxLength             = 2;
            txtAño.MaxLength             = 2;
            txtCodigoSeguridad.MaxLength = 3;
        }
Пример #5
0
        private void btnGenerar_Click(object sender, EventArgs e)
        {
            if (dgvOfertas.RowCount != 0)
            {
                double total_facturacion  = 0;
                List <Item_Factura> items = new List <Item_Factura> {
                };

                foreach (DataGridViewRow row in dgvOfertas.Rows)
                {
                    Item_Factura item = new Item_Factura();
                    item.oferta = new Oferta()
                    {
                        id = Int32.Parse(row.Cells[0].Value.ToString())
                    };
                    item.importe       = Double.Parse(row.Cells[5].Value.ToString());
                    item.cantidad      = Int32.Parse(row.Cells[4].Value.ToString());
                    total_facturacion += Double.Parse(row.Cells[5].Value.ToString());

                    items.Add(item);
                }

                Factura factura = new Factura();
                factura.total     = total_facturacion;
                factura.numero    = this.obtenerNumeroFacturacionAleatorio();
                factura.proveedor = proveedor;
                factura.fecha     = FechaAplicacion.get();

                if (FacturacionFacadeDAO.agregarFacturacion(factura, items))
                {
                    (new Facturacion(this, factura)).ShowDialog();
                }
                else
                {
                    MessageBox.Show("Error al agragar Facturación");
                }
            }
            else
            {
                MessageBox.Show("No se encontraron ofertas");
                this.Close();
            }
        }
Пример #6
0
        private void btnPagar_Click(object sender, EventArgs e)
        {
            if (this.datosValidos())
            {
                MessageBox.Show("Hay campos incompletos o campos invalidos");
            }
            else
            {
                Modelo.CargaCredito cargaCredito = new Modelo.CargaCredito();
                cargaCredito.cliente   = cliente;
                cargaCredito.fecha     = FechaAplicacion.get();
                cargaCredito.monto     = int.Parse(numMonto.Value.ToString());
                cargaCredito.tipo_pago = new TipoPago()
                {
                    id = Int32.Parse(cmbTipoPago.SelectedValue.ToString())
                };
                cargaCredito.numero_tarjeta    = txtNumeroTarjeta1.Text + "-" + txtNumeroTarjeta2.Text + "-" + txtNumeroTarjeta3.Text + "-" + txtNumeroTarjeta4.Text;
                cargaCredito.fecha_vencimiento = txtMes.Text + "/" + txtAño.Text;
                cargaCredito.cod_seguridad     = txtCodigoSeguridad.Text;


                cliente.credito += cargaCredito.monto = int.Parse(numMonto.Value.ToString());

                if (CargaCreditoDAO.agregarcargaCredito(cargaCredito) && ClienteDAO.actualizarCreditos(cliente))
                {
                    MessageBox.Show("Carga de credito realizada correctamente", "Oferta", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (form_clientes != null)
                    {
                        form_clientes.cargarDatos();
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Error al realizar Carga de Credito");
                }
            }
        }
Пример #7
0
 private static DateTime obtenerFechaHora(String hora)
 {
     return(DateTime.Parse((FechaAplicacion.obtenerFechaAplicacion()).ToString("dd/MM/yyyy ") + (!hora.Equals("24") ? hora + ":00:00" : "23:59:59")));
 }
Пример #8
0
 public frmRendirViaje()
 {
     InitializeComponent();
     this.selectorDiaRendicionAChofer.MaxDate = FechaAplicacion.obtenerFechaAplicacion();
 }
Пример #9
0
 public frmFacturarViaje()
 {
     InitializeComponent();
     this.selectorFechaFacturacionHasta.MinDate = new DateTime((FechaAplicacion.obtenerFechaAplicacion()).Year, (FechaAplicacion.obtenerFechaAplicacion()).Month, 1);
     this.selectorFechaFacturacionHasta.MaxDate = FechaAplicacion.obtenerFechaAplicacion();
 }
Пример #10
0
 public frmListados()
 {
     InitializeComponent();
     this.selectorAnio.MaxDate = FechaAplicacion.obtenerFechaAplicacion();
     armarComboListados();
 }
Пример #11
0
        private void btnComprar_Click(object sender, EventArgs e)
        {
            if (this.siguiente())
            {
                Oferta oferta_seleccionada = this.get_oferta_seleccionada();
                int    cantidad_ingresada  = int.Parse(numCantidad.Value.ToString());

                if (cantidad_ingresada <= 0)
                {
                    MessageBox.Show("La cantidad ingresada es invalida");
                    return;
                }

                if (cantidad_ingresada <= oferta_seleccionada.cantidad_disponible)
                {
                    if (cantidad_ingresada <= oferta_seleccionada.cantidad_max_cliente)
                    {
                        double total_importe = oferta_seleccionada.precio_oferta * cantidad_ingresada;
                        if (cliente.credito >= (total_importe))
                        {
                            if (MessageBox.Show("¿Está a punto de comprar " + cantidad_ingresada.ToString() + " unidad/es de " + oferta_seleccionada.descripcion + " por $" + total_importe + " en total, desea continuar?", "ComprarOferta", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                            {
                                Compra compra = new Compra();
                                compra.oferta   = oferta_seleccionada;
                                compra.cliente  = cliente;
                                compra.fecha    = FechaAplicacion.get();
                                compra.cantidad = cantidad_ingresada;

                                Cupon cupon = new Cupon();
                                //cupon.codigo = this.obtenerCodigoCuponAleatorio().ToString();
                                cupon.fecha_vencimiento = FechaAplicacion.get().AddDays(15); //15 dias desde la compra
                                cupon.canjeado          = false;

                                if (CompraFacadeDAO.agregarCompraYGenerarCupon(compra, cupon))
                                {
                                    if (form_clientes != null)
                                    {
                                        form_clientes.cargarDatos();
                                    }
                                    (new CompraDetalle(this, compra, cupon)).ShowDialog();
                                }
                                else
                                {
                                    MessageBox.Show("Error al realizar la compra");
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("No dispone de credito suficiente para realizar la compra");
                        }
                    }
                    else
                    {
                        MessageBox.Show("La cantidad ingresada supera la cantidad maxima por cliente de la oferta");
                    }
                }
                else
                {
                    MessageBox.Show("La cantidad ingresada supera la cantidad disponible de la oferta");
                }
            }
            else
            {
                MessageBox.Show("Datos invalidos");
            }
        }
Пример #12
0
 private bool fechasValidas()
 {
     return(dtmFechaPublicacion.Value.Date >= FechaAplicacion.get().Date&& dtmFechaVencimiento.Value.Date > dtmFechaPublicacion.Value.Date);
 }