コード例 #1
0
        private void Btn_ingresar_Click(object sender, RoutedEventArgs e)
        {
            if (rbClienteNuevo.IsChecked == true)
            {
                if (MessageBox.Show("Ingresar Cliente " + txt_nombre.Text + " " + "a mesa " + cbox_cantidad.SelectedValue + "?", "Seguro?", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                {
                    usuarioBLL usrBLL   = new usuarioBLL();
                    int        rut      = int.Parse(txt_rut.Text);
                    string     nombre   = txt_nombre.Text;
                    string     apellido = txt_apellido.Text;
                    string     email    = txt_email.Text;
                    bool       status   = usrBLL.CreateCliente(rut, nombre, apellido, email);
                    if (status)
                    {
                        BoletaBLL bolBLL = new BoletaBLL();

                        int id_mesa   = int.Parse(cbox_cantidad.SelectedValue.ToString());
                        int id_garzon = int.Parse(cbGarzon.SelectedValue.ToString());
                        if (bolBLL.insertBoleta(id_mesa, id_garzon, rut))
                        {
                            MessageBox.Show("Asignacion Ingresada Correctamente");
                        }
                        else
                        {
                            MessageBox.Show("El Cliente Fue ingresado, Pero ocurrio un error al ingresar la asignacion de mesa");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Ocurrio un error al ingresar el cliente");
                    }
                }
                loadGarzones();
            }
            else if (rbClienteRegistrado.IsChecked == true)
            {
                BoletaBLL bolBLL    = new BoletaBLL();
                int       id_mesa   = int.Parse(cbox_cantidad.SelectedValue.ToString());
                int       id_garzon = int.Parse(cbGarzon.SelectedValue.ToString());
                int       rut       = int.Parse(txt_rut.Text);
                if (bolBLL.insertBoleta(id_mesa, id_garzon, rut))
                {
                    MessageBox.Show("Asignacion Ingresada Correctamente");
                }
                else
                {
                    MessageBox.Show("Ocurrio un error al ingresar la asignacion de mesa");
                }
            }
        }
コード例 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (rbNuevaReserva.IsChecked == true)
            {
                DateTime?fecha = dtpFecha.SelectedDate;
                if (fecha.HasValue)
                {
                    bool createcli = false;
                    if (clienteexiste == false && txtNom.Text.Length > 0 && txtApe.Text.Length > 0 && txtEmail.Text.Length > 0)
                    {
                        usuarioBLL usrBLL = new usuarioBLL();
                        createcli = usrBLL.CreateCliente(Int32.Parse(txtrut.Text), txtNom.Text, txtApe.Text, txtEmail.Text);
                        if (createcli)
                        {
                            clienteexiste = true;
                        }
                    }

                    if (clienteexiste == true && cbHora.SelectedIndex != 0 && cbMinuto.SelectedIndex > 0)
                    {
                        string formatted = fecha.Value.ToString("dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
                        string hora      = cbHora.Text;
                        string minuto    = cbMinuto.Text;
                        formatted += " " + hora + ":" + minuto + ":00";
                        DateTime fechahora = DateTime.Parse(formatted);

                        int         numMesa = int.Parse(txtIdReserva.Text);
                        ReservasBLL resBLL  = new ReservasBLL();
                        int         rut     = int.Parse(txtrut.Text);
                        bool        stado   = resBLL.InsertReserva(rut, fechahora, numMesa);
                        if (stado)
                        {
                            MessageBox.Show("Reserva Ingresada Correctamente");
                        }
                        else
                        {
                            MessageBox.Show("Ocurrio un error al Ingresar la Reserva");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("ingrese un valor para la fecha");
                }
            }
            else if (rbCancelarReserva.IsChecked == true)
            {
                if (txtIdReserva.Text.Length > 0)
                {
                    int         idreserva = Int32.Parse(txtIdReserva.Text);
                    ReservasBLL resBLL    = new ReservasBLL();
                    if (resBLL.DeleteReserva(idreserva))
                    {
                        MessageBox.Show("Reserva Eliminada Correctamente");
                    }
                    else
                    {
                        MessageBox.Show("Ocurrio un error al eliminar la resevra");
                    }
                }
            }
        }