示例#1
0
        private void button_Guardar_Click(object sender, EventArgs e)
        {
            if (numericUpDown_NroTarjeta.Value == 0 || comboBox_Tipo.SelectedItem == null)
            {
                MessageBox.Show("Falta uno de los campos obligatorios");
                return;
            }

            if (textBox_Descripcion.Text.Length > 255)
            {
                MessageBox.Show("Descripcion supera los 255 caracteres (Debe ser menor a 255)");
                return;
            }

            bool existe_tarjeta = false;

            existe_tarjeta = _tarjetaManager.ExisteTarjeta(int.Parse(numericUpDown_NroTarjeta.Value.ToString())
                                                           , comboBox_Tipo.Text.ToString());


            if (existe_tarjeta == true)
            {
                MessageBox.Show("Tarjeta existente");
                return;
            }

            Tarjeta tarj = new Tarjeta();

            tarj.numero = int.Parse(numericUpDown_NroTarjeta.Value.ToString());
            tarj.tipo   = comboBox_Tipo.Text.ToString();

            if (textBox_Descripcion.Text.Length == 0)
            {
                tarj.descripcion = " ";
            }
            else
            {
                tarj.descripcion = textBox_Descripcion.Text.ToString();
            }


            _tarjetaManager.InsertarTarjeta(tarj);

            MessageBox.Show("Su tarjeta ha sido cargada, pruebe de realizar la factura ahora");

            this.Close();
        }
示例#2
0
        private void Facturar_Click(object sender, EventArgs e)
        {
            decimal valor_estadia  = 0;
            bool    Estado_Tarjeta = false;

            if (string.IsNullOrEmpty(textBox_estadia.Text))
            {
                MessageBox.Show("Ingrese numero de estadia");
                return;
            }

            if (comboBox_FormaDePago.SelectedItem == null || (comboBox_Cuotas.Enabled == true && (comboBox_Cuotas.SelectedItem == null)))
            {
                MessageBox.Show("Faltan seleccionar campos");
            }
            else
            {
                if (int.Parse(numericUpDown_Tarjeta.Text.ToString()) == 0 && (comboBox_FormaDePago.Text.ToString() == tarj_cred || comboBox_FormaDePago.Text.ToString() == tarj_deb))
                {
                    MessageBox.Show("Numero de tarjeta no valido, ingrese un numero valido");
                }
                else
                {
                    Estado_Tarjeta = _tarjetaManager.ExisteTarjeta(int.Parse(numericUpDown_Tarjeta.Value.ToString())
                                                                   , comboBox_FormaDePago.Text.ToString());
                    if (Estado_Tarjeta == false && comboBox_FormaDePago.Text.ToString() != "Efectivo")
                    {
                        MessageBox.Show("Su tarjeta no esta cargada en el sistema, ingresela a continuacion");
                        Form abrir_tarj = new FrbaHotel.Registrar_Consumible.TarjetaFacturas();
                        abrir_tarj.ShowDialog();
                        return;
                    }

                    if (comboBox_FormaDePago.Text.ToString() == tarj_cred || comboBox_FormaDePago.Text.ToString() == tarj_deb)
                    {
                        valor_estadia = _estadiaManager.GetValorEstadiaFinal(
                            comboBox_FormaDePago.Text.ToString(),
                            int.Parse(textBox_estadia.Text.ToString()),
                            int.Parse(comboBox_Cuotas.Text.ToString()),
                            int.Parse(numericUpDown_Tarjeta.Text.ToString())
                            );
                    }
                    else
                    {
                        valor_estadia = _estadiaManager.GetValorEstadiaFinal(
                            comboBox_FormaDePago.Text.ToString(),
                            int.Parse(textBox_estadia.Text.ToString()),
                            0, 0
                            );
                    }
                    //MessageBox.Show( String.Format("Monto Total:{0}",valor_estadia.ToString()));
                    //Muestro la factura
                    //
                    Form abrir = new FrbaHotel.Registrar_Consumible.Factura_Final(valor_estadia, int.Parse(textBox_estadia.Text.ToString()));
                    abrir.ShowDialog();
                    //
                    //Recargo ventanas
                    comboBox_FormaDePago.Enabled  = false;
                    comboBox_Cuotas.Enabled       = false;
                    numericUpDown_Tarjeta.Enabled = false;
                    panel_Tarjeta.Hide();
                    textBox_estadia.Text      = "";
                    comboBox_FormaDePago.Text = "";
                    comboBox_Cuotas.Text      = "";
                }
            }
        }