コード例 #1
0
ファイル: frmReservacion.cs プロジェクト: geor8jl/Resume-CV
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            IBLLReservacion _IBLLReservacion = new BLLReservacion();

            try
            {
                if (this.dgvDetalleReserva.SelectedRows.Count > 0)
                {
                    Reservacion oReservacion = this.dgvDetalleReserva.SelectedRows[0].DataBoundItem as Reservacion;
                    if (MessageBox.Show($"¿Seguro que desea borrar el registro de Reservacion :  {oReservacion.ID} ?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        _IBLLReservacion.DeleteReserva(oReservacion.ID);
                        this.CargarDatos();
                    }
                }
                else
                {
                    MessageBox.Show("Seleccione el registro !", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);
                msg.AppendFormat("Source         {0}\n", er.Source);
                msg.AppendFormat("InnerException {0}\n", er.InnerException);
                msg.AppendFormat("StackTrace     {0}\n", er.StackTrace);
                msg.AppendFormat("TargetSite     {0}\n", er.TargetSite);
                // Log error
                //_MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                // Mensaje de Error
                MessageBox.Show("Se ha producido el siguiente error " + er.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
ファイル: frmFacturacion.cs プロジェクト: geor8jl/Resume-CV
        private void frmFacturacion_Load(object sender, EventArgs e)
        {
            IBLLReservacion _BLLReservacion = new BLLReservacion();

            try
            {
                // Mostar Numero de factura
                CargarTarjeta();

                CargarDatos();
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);
                msg.AppendFormat("Source         {0}\n", er.Source);
                msg.AppendFormat("InnerException {0}\n", er.InnerException);
                msg.AppendFormat("StackTrace     {0}\n", er.StackTrace);
                msg.AppendFormat("TargetSite     {0}\n", er.TargetSite);
                // Log error
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                // Mensaje de Error
                MessageBox.Show("Se ha producido el siguiente error " + er.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
ファイル: frmReservacion.cs プロジェクト: geor8jl/Resume-CV
        private void CargarDatos()
        {
            IBLLReservacion _BLLReserva = new BLLReservacion();


            // Configuracion del DataGridView para que se vea bien la imagen.
            dgvDetalleReserva.AutoGenerateColumns = true;



            // Cargar el DataGridView
            this.dgvDetalleReserva.DataSource = _BLLReserva.GetAllReservacion();
        }
コード例 #4
0
ファイル: frmReservacion.cs プロジェクト: geor8jl/Resume-CV
        private void toolStripBtnNuevo_Click(object sender, EventArgs e)
        {
            IBLLReservacion _BLLReservacion = new BLLReservacion();

            try
            {
                _Huesped = null;
                this.txtHuespedId.Text         = "";
                this.txtNumeroReservacion.Text = "";
                this.mskCantidad.Text          = "";
                this.mskNUMHabitacion.Text     = "";
                this.mskCantidad.Text          = "";
                this.dtpCheckIN.Value          = DateTime.Now;
                this.dtpCheckOut.Value         = DateTime.Now;
                txtNumeroReservacion.Focus();

                this.txtHuespedId.Enabled         = true;
                this.txtNumeroReservacion.Enabled = true;
                this.mskCantidad.Enabled          = true;
                this.mskNUMHabitacion.Enabled     = true;
                this.btnBuscarHuesped.Enabled     = true;
                this.btnBuscarProducto.Enabled    = true;


                // Mostar Numero de factura
                this.txtNumeroReservacion.Text = _BLLReservacion.GetNextNumeroReserva().ToString();
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);
                msg.AppendFormat("Source         {0}\n", er.Source);
                msg.AppendFormat("InnerException {0}\n", er.InnerException);
                msg.AppendFormat("StackTrace     {0}\n", er.StackTrace);
                msg.AppendFormat("TargetSite     {0}\n", er.TargetSite);
                // Log error
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                // Mensaje de Error
                MessageBox.Show("Se ha producido el siguiente error " + er.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #5
0
        private void toolStripBtnBuscar_Click(object sender, EventArgs e)
        {
            IBLLReservacion _BLLReserva = new BLLReservacion();
            double          filtro      = 0;

            try
            {
                //filtro = Double.Parse(this.txtFiltro.Text);

                this.dgvDatos.AutoGenerateColumns = false;
                this.dgvDatos.DataSource          = _BLLReserva.GetAllReservacion();
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);
                msg.AppendFormat("Source         {0}\n", er.Source);
                msg.AppendFormat("InnerException {0}\n", er.InnerException);
                msg.AppendFormat("StackTrace     {0}\n", er.StackTrace);
                msg.AppendFormat("TargetSite     {0}\n", er.TargetSite);
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                MessageBox.Show(msg.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #6
0
ファイル: frmFacturacion.cs プロジェクト: geor8jl/Resume-CV
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            //IBLLImpuesto _BLLImpuesto = new BLLImpuesto();
            DetFactura oFacturaDetalle = new DetFactura();

            IBLLEncFactura _BLLFactura = new BLLEncFactura();

            IBLLReservacion _BLLReservacion = new BLLReservacion();

            IBLLTarjeta _BLLTarjeta = new BLLTarjeta();

            _FacturaEncabezado = new EncFactura();



            try
            {
                erpError.Clear();

                _FacturaEncabezado = new EncFactura()
                {
                    IDFactura  = _BLLFactura.GetCurrentNumeroFactura(),
                    _Tarjeta   = _BLLTarjeta.GetTarjetaById(Double.Parse(this.txtNumeroTarjeta.Text)),
                    Fecha      = DateTime.Now.Date,
                    EstadoFact = this.cmbEstado.SelectedIndex.ToString()
                };

                if (_FacturaEncabezado == null)
                {
                    MessageBox.Show("Debe agregar los datos del encabezado de la factura para continuar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Validar que el Producto ya no se haya agregado
                if (_FacturaEncabezado._ListaFacturaDetalle.Count > 0)
                {
                    // Si ya se agrego no permitir agregarlo nuevamente
                    if (_FacturaEncabezado._ListaFacturaDetalle.FindAll(p => p._Reservacion.ID == double.Parse(this.mskIDReserva.Text)).Count > 0)
                    {
                        MessageBox.Show("La Reservacion ya fue agregado previamente.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }

                oFacturaDetalle._EncFactura  = _BLLFactura.GetFactura(Double.Parse(this.txtNumeroFactura.Text));
                oFacturaDetalle._Reservacion = _BLLReservacion.GetReserva(Double.Parse(this.mskIDReserva.Text.ToString()));



                oFacturaDetalle.Precio = Double.Parse(this.txtPrecio.Text.ToString());

                // Calcular el Impuesto
                IBLLImpuesto _BLLImpuestotest = new BLLImpuesto();
                oFacturaDetalle._Impuesto = _BLLImpuestotest.GetImpuesto();//((double)_BLLImpuesto.GetImpuesto().Porcentaje / 100D) * oFacturaDetalle.Precio * 1;
                // Enumerar la secuencia
                oFacturaDetalle.Numero = _FacturaEncabezado._ListaFacturaDetalle.Count == 0 ?
                                         1 : _FacturaEncabezado._ListaFacturaDetalle.Max(p => p.Numero) + 1;


                // Agregar
                _FacturaEncabezado.AddDetalle(oFacturaDetalle);

                if (oFacturaDetalle._Reservacion.CheckOUT.Day < this.dtpOut.Value.Day)
                {
                    MessageBox.Show(

                        "  Ha sobrepasado la fecha para realizar su Check Out , por lo que se realizara un cobro equivalente a $50 adicional. Disculpe. "

                        , "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                this.txtNUMDetalle.Text = (cont++ + 1).ToString();

                string[] lineaFactura = { _BLLFactura.GetCurrentNumeroFactura().ToString(),
                                          (cont).ToString(),
                                          oFacturaDetalle.Precio.ToString(),
                                          oFacturaDetalle._Reservacion.ID.ToString(),
                                          this.txtNumeroTarjeta.Text,
                                          DateTime.Now.Date.ToString(),
                                          this.cmbEstado.SelectedItem.ToString() };

                this.dgvDetalleFactura.Rows.Add(lineaFactura);
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);
                msg.AppendFormat("Source         {0}\n", er.Source);
                msg.AppendFormat("InnerException {0}\n", er.InnerException);
                msg.AppendFormat("StackTrace     {0}\n", er.StackTrace);
                msg.AppendFormat("TargetSite     {0}\n", er.TargetSite);
                // Log error
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                // Mensaje de Error
                MessageBox.Show("Se ha producido el siguiente error " + er.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
ファイル: frmFacturacion.cs プロジェクト: geor8jl/Resume-CV
        private void toolStripBtnFacturar_Click(object sender, EventArgs e)
        {
            IBLLEncFactura _BLLFactura    = new BLLEncFactura();
            IBLLTarjeta    _BLLTarjeta    = new BLLTarjeta();
            IBLLHuesped    _BLLHuesped    = new BLLHuesped();
            IBLLHabitacion _BLLHabitacion = new BLLHabitacion();

            IBLLImpuesto _BLLImpuesto = new BLLImpuesto();

            DetFactura oFacturaDetalle = new DetFactura();

            this.cmbEstado.SelectedIndex = 1;

            IBLLReservacion _BLLReservacion = new BLLReservacion();


            Tarjeta oTarjeta      = new Tarjeta();
            string  rutaImagen    = @"c:\temp\qr.png";
            double  numeroFactura = 0d;

            try
            {
                _FacturaEncabezado = new EncFactura()
                {
                    IDFactura  = Double.Parse(this.txtNumeroFactura.Text),
                    _Tarjeta   = cmbTarjeta.SelectedItem as Tarjeta,//_BLLTarjeta.GetTarjetaById(Double.Parse(this.txtNumeroTarjeta.Text)),
                    Fecha      = DateTime.Now.Date,
                    EstadoFact = this.cmbEstado.SelectedIndex.ToString(),
                };

                oFacturaDetalle._EncFactura  = _BLLFactura.GetFactura(Double.Parse(this.txtNumeroFactura.Text));
                oFacturaDetalle._Reservacion = _BLLReservacion.GetReserva(Double.Parse(this.mskIDReserva.Text.ToString()));



                oFacturaDetalle.Precio = Double.Parse(this.txtPrecio.Text.ToString());

                // Calcular el Impuesto
                IBLLImpuesto _BLLImpuestotest = new BLLImpuesto();
                oFacturaDetalle._Impuesto = _BLLImpuestotest.GetImpuesto();
                // Enumerar la secuencia
                oFacturaDetalle.Numero = _FacturaEncabezado._ListaFacturaDetalle.Count == 0 ?
                                         1 : _FacturaEncabezado._ListaFacturaDetalle.Max(p => p.Numero) + 1;

                ;
                // Agregar
                _FacturaEncabezado.AddDetalle(oFacturaDetalle);


                if (_FacturaEncabezado == null)
                {
                    MessageBox.Show("No hay datos por facturar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (_FacturaEncabezado._ListaFacturaDetalle.Count == 0)
                {
                    MessageBox.Show("No hay items en la factura ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }



                this.txtSubtotal.Text = _FacturaEncabezado.GetSubTotal().ToString();
                this.txtImpuesto.Text = _FacturaEncabezado.GetImpuesto().ToString();
                this.txtTotal.Text    = (_FacturaEncabezado.GetSubTotal() + (_FacturaEncabezado.GetImpuesto())).ToString();

                _FacturaEncabezado = _BLLFactura.SaveFactura(_FacturaEncabezado);

                numeroFactura = _BLLFactura.GetCurrentNumeroFactura();

                EstadoHabitaciones();

                if (_FacturaEncabezado == null)
                {
                    MessageBox.Show("Error al crear factura!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                //toolStripBtnNuevo_Click(null, null);


                // Si existe borrelo
                if (File.Exists(rutaImagen))
                {
                    File.Delete(rutaImagen);
                }


                // Crear imagen quickresponse
                Image quickResponseImage = QuickResponse.QuickResponseGenerador(numeroFactura.ToString(), 53);



                // Salvarla en c:\temp para luego ser leida
                quickResponseImage.Save(rutaImagen, ImageFormat.Png);

                frmFacturaImpresion ofrmFacturaImpresion = new frmFacturaImpresion((int)numeroFactura, _BLLHuesped.GetHuespedById(Double.Parse(this.txtIdHuesped.Text)).Nombre);


                ofrmFacturaImpresion.ShowDialog();


                this.txtNumeroTarjeta.Text    = "";
                this.txtNumHabitacion.Text    = "";
                this.txtNUMDetalle.Text       = "1";
                this.txtImpuesto.Text         = "";
                this.txtIdHuesped.Text        = "";
                this.txtCantDias.Text         = "";
                this.txtPrecio.Text           = "";
                this.txtSubtotal.Text         = "";
                this.txtTotal.Text            = "";
                this.cmbEstado.SelectedIndex  = 0;
                this.cmbTarjeta.SelectedIndex = 0;
                this.Subtotal.Text            = "";
                this.mskIDReserva.Text        = "";
                this.dgvDetalleFactura.Rows.Clear();
                this.dgvDetalleFactura.Refresh();
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);
                msg.AppendFormat("Source         {0}\n", er.Source);
                msg.AppendFormat("InnerException {0}\n", er.InnerException);
                msg.AppendFormat("StackTrace     {0}\n", er.StackTrace);
                msg.AppendFormat("TargetSite     {0}\n", er.TargetSite);
                // Log error
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                // Mensaje de Error
                MessageBox.Show("Se ha producido el siguiente error " + er.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #8
0
ファイル: frmReservacion.cs プロジェクト: geor8jl/Resume-CV
        private void toolStripBtnReservar_Click(object sender, EventArgs e)
        {
            try
            {
                Reservacion oReservacion = null;

                IBLLReservacion _IBLLReservacion = new BLLReservacion();

                IBLLHabitacion _BLLHabitacion = new BLLHabitacion();

                IBLLHuesped _BLLHuesped = new BLLHuesped();

                if (this.txtHuespedId == null)
                {
                    MessageBox.Show(" Es un dato requerido !", "Atención");
                    return;
                }



                oReservacion = new Reservacion();

                oReservacion.ID = double.Parse(this.txtNumeroReservacion.Text);

                oReservacion._Huesped = _BLLHuesped.GetHuespedById(double.Parse(this.txtHuespedId.Text.ToString()));

                oReservacion._Habitacion = _BLLHabitacion.GetHabitacionById(double.Parse(this.mskNUMHabitacion.Text.ToString()));


                foreach (var item in _IBLLReservacion.GetAllReservacion())
                {
                    if (item.CheckIN.DayOfYear <= this.dtpCheckIN.Value.DayOfYear && item.CheckOUT.DayOfWeek > this.dtpCheckOut.Value.DayOfWeek &&


                        item.CheckIN.Month == this.dtpCheckIN.Value.Month

                        && item._Habitacion.NUM == _BLLHabitacion.GetHabitacionById(double.Parse(this.mskNUMHabitacion.Text.ToString())).NUM)
                    {
                        MessageBox.Show(" La Habitacion se encuantra Ocupada !", "Atención");
                        return;
                    }
                    //else
                    //{

                    //    if (item.CheckIN.Day < this.dtpCheckIN.Value.Day &&

                    //    item.CheckIN.Month == this.dtpCheckIN.Value.Month)
                    //    {
                    //        MessageBox.Show(" La Habitacion se encuantra Ocupada !", "Atención");
                    //        return;
                    //    }

                    //}


                    if (item.CheckOUT.DayOfYear == this.dtpCheckOut.Value.DayOfYear && item.CheckOUT.Month == this.dtpCheckOut.Value.Month &&

                        item._Habitacion.NUM == _BLLHabitacion.GetHabitacionById(double.Parse(this.mskNUMHabitacion.Text.ToString())).NUM)
                    {
                        MessageBox.Show(" La Habitacion se encuantra Ocupada !", "Atención");
                        return;
                    }
                    //else
                    //{

                    //    if (item.CheckOUT.Day > this.dtpCheckOut.Value.Day

                    //    && item.CheckOUT.Month == this.dtpCheckOut.Value.Month)
                    //    {
                    //        MessageBox.Show(" La Habitacion se encuantra Ocupada !", "Atención");
                    //        return;
                    //    }

                    //}
                }



                if (this.dtpCheckIN.Value.DayOfYear < DateTime.Now.DayOfYear || this.dtpCheckIN.Value.Month < DateTime.Now.Month)
                {
                    MessageBox.Show(" No puede reservar fechas anteriores a la actual !", "Atención");
                    return;
                }


                if (this.dtpCheckOut.Value.DayOfYear < DateTime.Now.DayOfYear || this.dtpCheckOut.Value.Month < DateTime.Now.Month

                    || this.dtpCheckOut.Value.DayOfYear < this.dtpCheckIN.Value.DayOfYear || this.dtpCheckOut.Value.Month < dtpCheckIN.Value.Month)
                {
                    MessageBox.Show(" No puede reservar fechas anteriores a la actual !", "Atención");
                    return;
                }


                oReservacion.CheckIN = (DateTime)this.dtpCheckIN.Value;

                oReservacion.CheckOUT = (DateTime)this.dtpCheckOut.Value;

                oReservacion.CantDias = double.Parse(this.mskCantidad.Text);

                oReservacion.Subtotal = double.Parse(this.mskCantidad.Text) * _BLLHabitacion.GetHabitacionById(double.Parse(this.mskNUMHabitacion.Text.ToString())).Precio;

                txtSub.Text = oReservacion.Subtotal.ToString();

                _IBLLReservacion.SaveReserva(oReservacion);

                if (oReservacion != null)
                {
                    this.CargarDatos();
                }
            }
            catch (Exception er)
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("Message        {0}\n", er.Message);
                msg.AppendFormat("Source         {0}\n", er.Source);
                msg.AppendFormat("InnerException {0}\n", er.InnerException);
                msg.AppendFormat("StackTrace     {0}\n", er.StackTrace);
                msg.AppendFormat("TargetSite     {0}\n", er.TargetSite);
                // Log error
                _MyLogControlEventos.ErrorFormat("Error {0}", msg.ToString());
                // Mensaje de Error
                MessageBox.Show("Se ha producido el siguiente error " + er.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }