Exemplo n.º 1
0
        private void bt_cuota_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cmb_cuota.Text))
            {
                MessageBox.Show("Elija cantidad de cuotas");
            }
            else
            {
                //Compra
                DateTime fechaSistema = DataBase.ObtenerFechaSistema();
                Compra   compra       = new Compra();
                compra.com_fecha   = fechaSistema;
                compra.com_cli     = this.idCliente;
                compra.com_tipoDoc = this.tipoDoc;
                compra.cabinas     = cabinasCompradas;
                compra.com_mp      = CompraFunc.ObtenerIDMp(cmb_mp.Text);
                compra.com_detalle = String.Concat("N° Cuotas: ", cmb_cuota.Text);
                SqlDataReader reader = CompraFunc.CrearCompra(compra);

                Int32 idCompra = 0;

                if (reader.Read())
                {
                    idCompra = Convert.ToInt32(reader.GetDecimal(0));
                }

                MessageBox.Show("Compra realizada");
                MostrarVoucher mv = new MostrarVoucher(compra, null, idCompra, this.esCompra);
                this.Hide();
                mv.ShowDialog();
                this.Close();
            }
        }
Exemplo n.º 2
0
        private void bt_cuota_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cmb_cuota.Text))
            {
                MessageBox.Show("Elija cantidad de cuotas");
            }
            else
            {
                //Compra
                DateTime fechaSistema = DataBase.ObtenerFechaSistema();
                Compra   compra       = new Compra();
                compra.com_fecha = fechaSistema;
                DataGridViewRow dataRow = dgv_cabina.Rows[(dgv_cabina.CurrentRow.Index)];
                compra.com_cli     = Convert.ToInt32(dataRow.Cells["Documento"].Value.ToString());
                compra.com_tipoDoc = Convert.ToInt32(Client.ObtenerIDTipoDoc(dataRow.Cells["TipoDoc"].Value.ToString()));
                compra.cabinas     = this.cabinasCompradas;
                compra.com_mp      = CompraFunc.ObtenerIDMp(cmb_mp.Text);
                compra.com_detalle = String.Concat("N° Cuotas: ", cmb_cuota.Text);
                SqlDataReader reader = CompraFunc.CrearCompra(compra);

                Int32 idCompra = 0;

                if (reader.Read())
                {
                    idCompra = Convert.ToInt32(reader.GetDecimal(0));
                }
                CompraFunc.ComprarReserva(Convert.ToInt32(txt_reserva.Text.Trim()));
                MessageBox.Show("Compra realizada");
                MostrarVoucher mv = new MostrarVoucher(compra, null, idCompra, true);
                this.Hide();
                mv.ShowDialog();
                this.Close();
            }
        }
 private void ContenedorPrincipal_Load(object sender, EventArgs e)
 {
     if (this.id_rol == 1)
     { //Es admin
         CompraFunc.CancelarReserva();
         CruceroFunc.HabilitarCrucero();
     }
 }
Exemplo n.º 4
0
        private void btCabDisponibles_Click(object sender, EventArgs e)
        {
            dgv_cabina.Refresh();
            //dgv_cabina.Rows.Clear();

            if (txt_reserva.Text == "")
            {
                MessageBox.Show("Ingrese Reserva");
            }
            else
            {
                dgv_cabina.AllowUserToAddRows = true;
                dgv_cabina.DataSource         = CompraFunc.VerificarReserva(Convert.ToInt32(txt_reserva.Text.Trim())).Tables[0];
            }

            dgv_cabina.AllowUserToAddRows = false;
        }
Exemplo n.º 5
0
        public MostrarVoucher(Compra compra, Reserva reserva, int idCompra, bool esCompra)
        {
            InitializeComponent();

            if (esCompra)
            {
                //Compra
                label1.Text            = "Compra";
                dgv_listado.DataSource = CompraFunc.VoucherCompra(compra, idCompra).Tables[0];
            }
            else
            {
                //Reserva
                label1.Text            = "Reserva";
                dgv_listado.DataSource = CompraFunc.VoucherReserva(reserva).Tables[0];
            }
        }
Exemplo n.º 6
0
        private void bt_mp_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cmb_mp.Text))
            {
                MessageBox.Show("Elija medio de pago");
            }
            else
            {
                //Credito
                if (CompraFunc.ObtenerIDMp(cmb_mp.Text) == 2)
                {
                    lb_cuota.Visible  = true;
                    bt_cuota.Visible  = true;
                    cmb_cuota.Visible = true;
                    bt_mp.Enabled     = false;
                    cmb_mp.Enabled    = false;
                }
                else
                {
                    //Compra
                    DateTime fechaSistema = DataBase.ObtenerFechaSistema();
                    Compra   compra       = new Compra();
                    compra.com_fecha   = fechaSistema;
                    compra.com_cli     = this.idCliente;
                    compra.com_tipoDoc = this.tipoDoc;
                    compra.cabinas     = cabinasCompradas;
                    compra.com_mp      = CompraFunc.ObtenerIDMp(cmb_mp.Text);
                    SqlDataReader reader = CompraFunc.CrearCompra(compra);

                    Int32 idCompra = 0;

                    if (reader.Read())
                    {
                        idCompra = Convert.ToInt32(reader.GetDecimal(0));
                    }

                    MessageBox.Show("Compra realizada");
                    MostrarVoucher mv = new MostrarVoucher(compra, null, idCompra, this.esCompra);
                    this.Hide();
                    mv.ShowDialog();
                    this.Close();
                }
            }
        }
Exemplo n.º 7
0
        private void CargarComboMp()
        {
            SqlDataReader reader = CompraFunc.ObtenerMp();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    MedioPago mp = new MedioPago();
                    mp.mp_id   = Convert.ToInt32(reader.GetDecimal(0));
                    mp.mp_desc = reader.GetString(1);
                    ComboboxItem item = new ComboboxItem();
                    item.Text  = mp.mp_desc;
                    item.Value = mp;
                    cmb_mp.Items.Add(item);
                }
            }
            reader.Close();
        }
Exemplo n.º 8
0
        private void btComprar_Click(object sender, EventArgs e)
        {
            if (this.cabinasCompradas.Rows.Count == 0)
            {
                MessageBox.Show("No hay cabinas agregadas para la compra");
            }
            else
            {
                if (esCompra)
                {
                    dgv_cabina.Enabled        = false;
                    btAgregarCabina.Enabled   = false;
                    btCabDisponibles.Enabled  = false;
                    cmb_tipo.Enabled          = false;
                    btComprarReservar.Enabled = false;

                    //Medio de pago
                    lb_mp.Visible    = true;
                    lb_selec.Visible = true;
                    bt_mp.Visible    = true;
                    cmb_mp.Visible   = true;
                }
                else
                {
                    //Reserva
                    DateTime fechaSistema = DataBase.ObtenerFechaSistema();
                    Reserva  reserva      = new Reserva();
                    reserva.res_fecha   = fechaSistema;
                    reserva.res_cli     = this.idCliente;
                    reserva.res_tipoDoc = this.tipoDoc;
                    reserva.cabinas     = cabinasCompradas;
                    CompraFunc.CrearReserva(reserva);
                    MessageBox.Show("Reserva realizada");

                    MostrarVoucher mv = new MostrarVoucher(null, reserva, 0, this.esCompra);
                    this.Hide();
                    mv.ShowDialog();
                    this.Close();
                }
            }
        }
Exemplo n.º 9
0
        private void btAceptar_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_nro_doc.Text) || string.IsNullOrEmpty(cmb_tipo.Text))
            {
                MessageBox.Show("Complete el tipo y número de documento");
            }
            else
            {
                if (txt_nro_doc.Text.Trim().Length >= 7)
                {
                    Int32 tipoDoc = 0;
                    if (String.Compare(cmb_tipo.Text, "DNI") == 0)
                    {
                        tipoDoc = 1;
                    }
                    if (String.Compare(cmb_tipo.Text, "DU") == 0)
                    {
                        tipoDoc = 2;
                    }
                    this.tipoDoc = tipoDoc;

                    if (Client.ExisteDoc(Convert.ToInt32(txt_nro_doc.Text.Trim()), tipoDoc) > 0)
                    //Traer cliente
                    {
                        //Validar si tiene un viaje
                        if (CompraFunc.ValidarClienteViaje(this.fr.FechaDesde, this.fr.FechaHasta, Convert.ToInt32(txt_nro_doc.Text.Trim()), this.tipoDoc, this.fr.puertoDesde, this.fr.puertoHasta))
                        {
                            this.esModificacion = true;

                            //Confirmar modificar
                            if (ConfirmarModificar())
                            {
                                btBuscar.Visible         = false;
                                btCancelarBuscar.Visible = false;
                                label3.Visible           = true;
                                label3.Text          = "Ingrese los datos a modificar del cliente:";
                                txt_nro_doc.Enabled  = false;
                                txt_apellido.Enabled = true;
                                txt_calle.Enabled    = true;
                                txt_mail.Enabled     = true;
                                txt_nombre.Enabled   = true;
                                txt_numero.Enabled   = true;
                                txt_tel.Enabled      = true;
                                btAceptar.Enabled    = true;
                                btCancelar.Enabled   = true;
                                fechaNac.Enabled     = true;

                                Int32 IDCliente = Convert.ToInt32(txt_nro_doc.Text.Trim());
                                if (String.Compare(cmb_tipo.Text, "DNI") == 0)
                                {
                                    tipoDoc = 1;
                                }
                                if (String.Compare(cmb_tipo.Text, "DU") == 0)
                                {
                                    tipoDoc = 2;
                                }
                                this.tipoDoc   = tipoDoc;
                                this.IDCliente = IDCliente;
                                //Modificar
                                Cliente cliente = new Cliente();

                                //Obtener Cliente
                                SqlDataReader reader = Client.ObtenerCliente(IDCliente, tipoDoc);

                                cliente = Client.ObtenerClienteDesdeUnReader(reader);

                                //Obtener Direccion
                                Int32     IDDireccion = cliente.IdDireccion;
                                Direccion direccion   = Adress.ObtenerDireccionDesdeUnReader(Adress.ObtenerDireccion(IDDireccion));
                                //Llenar textos
                                txt_nombre.Text                = cliente.Nombre.Trim();
                                txt_apellido.Text              = cliente.Apellido.Trim();
                                fechaNac.Value                 = cliente.FechaNac;
                                this.clienteModificado.NroDoc  = this.IDCliente;
                                this.clienteModificado.TipoDoc = this.tipoDoc;
                                this.direccionModificado.Id    = IDDireccion;
                                this.clienteBase               = cliente;
                                txt_calle.Text                 = direccion.Calle.Trim();
                                txt_numero.Text                = direccion.Numero.Trim();
                                if (!String.IsNullOrEmpty(direccion.Telefono))
                                {
                                    txt_tel.Text = direccion.Telefono.Trim();
                                }
                                if (!String.IsNullOrEmpty(direccion.Mail))
                                {
                                    txt_mail.Text = direccion.Mail.Trim();
                                }
                            }
                            else
                            {
                                this.fr.idCliente = Convert.ToInt32(txt_nro_doc.Text.Trim());
                                this.fr.tipoDoc   = this.tipoDoc;
                                MessageBox.Show("Se continua con la operación sin modificar los datos");
                                this.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Un cliente no puede viajar a más de un destino a la vez");
                            this.fr.idCliente = 0;
                            this.Close();
                        }
                    }
                    else
                    {
                        //Cargar Doc (Nuevo cliente)
                        btBuscar.Visible         = false;
                        btCancelarBuscar.Visible = false;
                        label3.Visible           = true;
                        txt_nro_doc.Enabled      = false;
                        cmb_tipo.Enabled         = false;
                        txt_apellido.Enabled     = true;
                        txt_calle.Enabled        = true;
                        txt_mail.Enabled         = true;
                        txt_nombre.Enabled       = true;
                        txt_numero.Enabled       = true;
                        txt_tel.Enabled          = true;
                        btAceptar.Enabled        = true;
                        btCancelar.Enabled       = true;
                        fechaNac.Enabled         = true;
                    }
                }
                else
                {
                    MessageBox.Show("El número de documento debe ser de 8 dígitos");
                }
            }
        }