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(); } }
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(); } } }
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(); } } }