public void atualiza_status_das_mesas() { MesaBLL cmd = new MesaBLL(); cmd.id = 1; if (cmd.verifica_se_mesa_esta_aberta()) { button1.ForeColor = Color.Red; button1.Text = "1 Indisponível"; } else { button1.ForeColor = Color.Green; button1.Text = "1 Disponível"; } // cmd.id = 2; // if (cmd.verifica_se_mesa_esta_aberta()) // btn_mesa_2.ForeColor = Color.Green; // else // btn_mesa_2.ForeColor = Color.Red; // // cmd.id = 3; // if (cmd.verifica_se_mesa_esta_aberta()) // btn_mesa_3.ForeColor = Color.Green; // else // btn_mesa_3.ForeColor = Color.Red; }
private void Btn_deletemesa_Click(object sender, RoutedEventArgs e) { Generic gen = new Generic(); MesaBLL mb = new MesaBLL(); if (txt_numeromesa.Text.Trim() == "") { lb1.Content = "Debe seleccionar un numero de mesa"; } else { DataTable da = mb.GetmesaNum(Int32.Parse(txt_numeromesa.Text)); DataRow row = da.Rows[0]; string rutt = row[0].ToString(); gen.ACCION.Content = "deletemesa"; gen.ACCION.Visibility = Visibility.Hidden; gen.lb_titulo.FontSize = 18; gen.lb_confirmacion.FontSize = 16; gen.lb_contenido.FontSize = 16; gen.lb_titulo.Content = "¿Desea eliminar esta mesa?"; gen.lb_confirmacion.Content = "Al realizar esta accion, se eliminará la mesa:"; gen.lb_contenido.Content = "Número : " + rutt; gen.Title = "Confirmación"; gen.btn_Cancelar.Content = "Volver"; gen.btn_Confirmar.Content = "Eliminar"; gen.lb_rut.Content = txt_numeromesa.Text; gen.Owner = this; gen.ShowDialog(); DataTable dt = mb.GetAllmesas(); dtg_mesadelete.ItemsSource = dt.DefaultView; } }
private void btnGuardar_Click(object sender, EventArgs e) { Mesa mesa = new Mesa(); mesa.Nombre = txtNombre.Text; MesaBLL mesaBLL = new MesaBLL(); if (id <= 0) { try { mesaBLL.Guardar(mesa); } catch (SqlException) { MessageBox.Show("Ha ocurrido un error en la base de datos"); } catch (Exception) { MessageBox.Show("Verifique los datos ingresados"); } } else { mesa.Id = id; mesaBLL.Editar(mesa); } this.Close(); }
private void RbNuevaReserva_Checked(object sender, RoutedEventArgs e) { lbIdReserva.Content = "Numero Mesa:"; txtIdReserva.Visibility = Visibility.Visible; lbRutCliente.Visibility = Visibility.Visible; txtrut.Visibility = Visibility.Visible; lbFecha.Visibility = Visibility.Visible; lbHora.Visibility = Visibility.Visible; cbHora.Visibility = Visibility.Visible; cbMinuto.Visibility = Visibility.Visible; dtpFecha.Visibility = Visibility.Visible; dtpFecha.IsEnabled = false; cbHora.IsEnabled = false; cbMinuto.IsEnabled = false; dtpFecha.IsEnabled = true; btnAgregar.Content = "Agregar Reserva"; MesaBLL mesBLL = new MesaBLL(); dtgReservas.ItemsSource = mesBLL.GetlAllMesas().DefaultView; }
private void Windeletemesa_Loaded(object sender, RoutedEventArgs e) { MesaBLL mb = new MesaBLL(); DataTable dt = mb.GetAllmesas(); dtg_mesadelete.ItemsSource = dt.DefaultView; }
private void CargarListaMesas() { MesaBLL mesaBLL = new MesaBLL(); List <Mesa> listaMesas = mesaBLL.ObtenerMesas(); dgvListaMesas.DataSource = null; dgvListaMesas.DataSource = listaMesas; this.Text = "Administración de Mesas - Total: " + mesaBLL.ObtenerCantidadMesas(); }
private void btnBorrar_Click(object sender, EventArgs e) { if (dgvListaMesas.SelectedRows.Count == 1) { DataGridViewRow o = dgvListaMesas.SelectedRows[0]; Mesa mesa = (Mesa)o.DataBoundItem; MesaBLL mesaBLL = new MesaBLL(); mesaBLL.Borrar(mesa); CargarListaMesas(); } }
private void Rdb_todas(object sender, RoutedEventArgs e) { if (rdb_todas.IsChecked == true) { MesaBLL mb = new MesaBLL(); txt_num.Visibility = Visibility.Hidden; cbb_sala.Visibility = Visibility.Hidden; btn_buscar.Visibility = Visibility.Hidden; DataTable dt = mb.GetAllmesas(); dtg_mesas.ItemsSource = dt.DefaultView; } else { } }
private void loadGarzones() { MesaBLL mesabll = new MesaBLL(); dtgMesas.ItemsSource = mesabll.getmesasvacias().DefaultView; cbox_cantidad.ItemsSource = mesabll.getmesasvacias().DefaultView; cbox_cantidad.DisplayMemberPath = "ID_MESA"; cbox_cantidad.SelectedValuePath = "ID_MESA"; usuarioBLL usrBLL = new usuarioBLL(); cbGarzon.ItemsSource = usrBLL.getGarzones().DefaultView; cbGarzon.DisplayMemberPath = "Nombre"; cbGarzon.SelectedValuePath = "ID_USER"; }
private void FrmAtencionDetalle_Load(object sender, EventArgs e) { EmpleadoBLL empleadoBLL = new EmpleadoBLL(); List <Empleado> empleados = empleadoBLL.ObtenerEmpleados(); MesaBLL mesaBLL = new MesaBLL(); List <Mesa> mesas = mesaBLL.ObtenerMesas(); cmbMesas.DisplayMember = "Nombre"; cmbMesas.ValueMember = "Id"; cmbMesas.DataSource = mesas; cmbEmpleados.DisplayMember = "Apellido"; cmbEmpleados.ValueMember = "Id"; cmbEmpleados.DataSource = empleados; }
private void Winaddmesa_Loaded(object sender, RoutedEventArgs e) { try { MesaBLL mb = new MesaBLL(); DataTable dt1 = mb.GetMesaComedor(); dtg_ComedorPrincipal.ItemsSource = dt1.DefaultView; DataTable dt2 = mb.GetMesaterra(); dtg_Terra.ItemsSource = dt2.DefaultView; DataTable dt3 = mb.GetMesaTerra2(); dtg_Terra2.ItemsSource = dt3.DefaultView; } catch (Exception ex) { MessageBox.Show("" + ex); } }
private void button2_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Deseja realmente devolver este produto ? Essa ação não poderá ser desfeita", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes) { MesaBLL cmd = new MesaBLL(); cmd.id = Int32.Parse(dataGridView1.SelectedRows[0].Cells[0].Value.ToString()); cmd.deleta_item_mesa(); carrega_dados_mesa(); } } catch (Exception ee) { } }
//int x = 0; private void BtnGuardar_Click(object sender, RoutedEventArgs e) { if (txtId.Text.Trim() != "") { if (txtCapacidad.Text.Trim() != "") { MesaBLL mesaBLL = new MesaBLL(); /* MessageBox.Show(mesaBLL.TomarDatosMesa( * // txtId.Text, * //txtCapacidad.Text, * // txtEstado.Text, * x));*/ } } }
private void btnAgregarMesa_Click(object sender, EventArgs e) { try { Mesa mesa = new Mesa(); if (TxtNumMesa.Text == "") { TxtNumMesa.Text = "0"; } mesa.numeroMesa = Convert.ToInt32(TxtNumMesa.Text.ToString()); mesa.nombreMesa = TxtNombreMesa.Text.ToString(); if (mesa.numeroMesa != 0 && mesa.nombreMesa != "") { Result resultado = new Result(); MesaBLL mesaBLL = new MesaBLL(); resultado = mesaBLL.AgregarMesas(mesa); Utilidades.MuestraInfo(resultado.mensaje); if (resultado.estatus == 200) { this.Close(); } } else { if (mesa.numeroMesa == 0) { Utilidades.MuestraAdvertencias("Debes de ingresar un número de Mesa"); } else if (mesa.nombreMesa == "") { Utilidades.MuestraAdvertencias("Debes de ingresar un nombre de Mesa"); } } } catch (Exception ex) { Utilidades.MuestraErrores(ex.Message); } }
private void WindModmesa_Loaded(object sender, RoutedEventArgs e) { MesaBLL mb = new MesaBLL(); dtg_ComedorPrincipal.IsReadOnly = true; dtg_Terra.IsReadOnly = true; dtg_Terra2.IsReadOnly = true; mb.Alter_Mesa(mb); DataTable dt1 = mb.GetMesaComedor(); dtg_ComedorPrincipal.ItemsSource = dt1.DefaultView; DataTable dt2 = mb.GetMesaterra(); dtg_Terra.ItemsSource = dt2.DefaultView; DataTable dt3 = mb.GetMesaTerra2(); dtg_Terra2.ItemsSource = dt3.DefaultView; txt_capacidad.Text = ""; txt_numeromesa.Text = ""; cbb_sala.SelectedIndex = -1; }
public void carrega_dados_mesa() { MesaBLL cmd = new MesaBLL(); cmd.id = this.id_mesa; DataTable dt = cmd.seleciona_dados_mesa(); this.total = 0; this.quantidade = 0; DataTable dt_produtos = cmd.seleciona_produtos_mesa(); dataGridView1.DataSource = dt_produtos; for (int i = 0; i < dt_produtos.Rows.Count; i++) { this.total += decimal.Parse(dt_produtos.Rows[i].ItemArray[4].ToString()); this.quantidade += int.Parse(dt_produtos.Rows[i].ItemArray[2].ToString()); } lbl_quantidade.Text = "" + this.quantidade; lbl_total.Text = "R$ " + this.total; }
public void Abrir_gerencia_mesa(Int32 mesa) { // Mesa //MesaBll cmd = new MesaBll(); MesaBLL cmd = new MesaBLL(); cmd.id = mesa; frmPDV_Mesa_Gerencia frm = new frmPDV_Mesa_Gerencia(); if (cmd.verifica_se_mesa_esta_aberta()) { frm.id_mesa = mesa; frm.carrega_dados_mesa(); atualiza_status_das_mesas(); frm.ShowDialog(); } else { if (MessageBox.Show("Esta mesa não esta aberta, deseja abrir a mesa ?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes) { cmd.id = mesa; cmd.abrir_mesa(); frm.id_mesa = mesa; frm.carrega_dados_mesa(); atualiza_status_das_mesas(); frm.ShowDialog(); } } if (frm.fecha_mesa) { this.fecha_mesa = true; this.numero_mesa = frm.id_mesa; this.Close(); } }
private void button1_Click(object sender, EventArgs e) { frmPesquisaProdutoNovo cmd = new frmPesquisaProdutoNovo(this); cmd.ShowDialog(); if (cmd.Codigo != null && cmd.Codigo != "") { frm_quantidade cmd_qtd = new frm_quantidade(); cmd_qtd.ShowDialog(); if (cmd_qtd.quantidade > 0) { MesaBLL xcmd = new MesaBLL(); xcmd.id = this.id_mesa; xcmd.quantidade = cmd_qtd.quantidade; xcmd.codigo_produto = cmd.id_produto; xcmd.adicionar_produto_mesa(); } else { MessageBox.Show("Quantidade informada não pode ser 0."); cmd_qtd.ShowDialog(); if (cmd_qtd.quantidade > 0) { MesaBLL xcmd = new MesaBLL(); xcmd.id = this.id_mesa; xcmd.codigo_produto = cmd.id_produto; xcmd.adicionar_produto_mesa(); } } } carrega_dados_mesa(); }
private void Btn_Confirmar_Click(object sender, RoutedEventArgs e) { usuarioBLL us = new usuarioBLL(); string act = ACCION.Content.ToString(); if (act == "eliminar") { int rut = Int32.Parse(lb_rut.Content.ToString()); lb_titulo.VerticalAlignment = VerticalAlignment.Center; us.rut = rut; us.DeleteUser(us); PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Aviso"; popup.Image = Properties.Resources.delete; popup.ContentText = "Se ha Eliminado el usuario con rut: " + rut; popup.AnimationDuration = 800; popup.Delay = 1400; popup.Popup(); Close(); } else if (act == "eliminarprov") { ProveedorBLL pb = new ProveedorBLL(); int id = Int32.Parse(lb_rut.Content.ToString()); pb.deleteprov(id); PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Aviso"; popup.Image = Properties.Resources.delete; popup.ContentText = "Se ha Eliminado el Proveedor con id: " + id; popup.AnimationDuration = 500; popup.Delay = 2500; popup.Popup(); Close(); } else if (act == "deletemesa") { MesaBLL mb = new MesaBLL(); int num = Int32.Parse(lb_rut.Content.ToString()); mb.DeleteMesa(num); PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Aviso"; popup.Image = Properties.Resources.delete; popup.ContentText = "Se ha Eliminado la mesa número: " + num; popup.AnimationDuration = 500; popup.Delay = 2500; popup.Popup(); Close(); } else if (act == "Modificarbebi") { int id = Int32.Parse(lb_rut.Content.ToString()); BebestibleBLL bb = new BebestibleBLL(); lb_titulo.VerticalAlignment = VerticalAlignment.Center; PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Aviso"; popup.Image = Properties.Resources.add; popup.ContentText = "Se ha Deshabilitado el bebestible con id: " + id; popup.AnimationDuration = 500; popup.Delay = 2000; popup.Popup(); bb.id_bebestible = id; bb.Alterinhabilitado(bb); Close(); } else if (act == "Modificaring") { int id = Int32.Parse(lb_rut.Content.ToString()); lb_titulo.VerticalAlignment = VerticalAlignment.Center; IngredienteBLL ib = new IngredienteBLL(); ib.id_ingrediente = id; PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Aviso"; popup.Image = Properties.Resources.add; popup.ContentText = "Se ha Deshabilitado el ingrediente con id: " + id; popup.AnimationDuration = 500; popup.Delay = 2000; popup.Popup(); ib.Alterinhabilitadoing(ib); Close(); } else if (act == "deshabilitar") { PlatoBLL pb = new PlatoBLL(); pb.Id_plato = Int32.Parse(lb_rut.Content.ToString()); pb.DesPlato(pb); Close(); PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Aviso"; popup.Image = Properties.Resources.delete; popup.ContentText = "Se ha Deshabilitado el plato con id: " + Int32.Parse(lb_rut.Content.ToString()); popup.AnimationDuration = 500; popup.Delay = 2000; popup.Popup(); Close(); } else if (act == "go_list") { ListarMesas lm = new ListarMesas(); lm.Owner = this; lm.rdb_todas.IsChecked = true; lm.ShowDialog(); Close(); } else { } }
private void dgvProductos_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex >= 6) { string NombreFrm = this.dgvProductos.Columns[e.ColumnIndex].Tag.ToString().Replace(" ", ""); switch (NombreFrm) { case "InformacionProducto": //""; FrmAgregarProducto frmAgregarProducto = new FrmAgregarProducto(); frmAgregarProducto.producto = productoBLL.ObtenerInfoProducto(Convert.ToInt64(dgvProductos[0, e.RowIndex].Value)); frmAgregarProducto.mostrarInfo = true; frmAgregarProducto.ShowDialog(); break; case "EditarProducto": //""; /* * FrmAsignarMesa frmAsignarMesaEditar = new FrmAsignarMesa(); * frmAsignarMesaEditar.numMesa = Convert.ToInt32(dgvProductos[0, e.RowIndex].Value); * frmAsignarMesaEditar.nombreMesa = dgvProductos[1, e.RowIndex].Value.ToString(); * frmAsignarMesaEditar.reservar = false; * frmAsignarMesaEditar.editarMesa = true; * frmAsignarMesaEditar.eliminarMesa = false; * * frmAsignarMesaEditar.ShowDialog(); */ MessageBox.Show("Editar Producto"); break; case "EliminarProducto": //""; /* * Result resultado = new Result(); * producto.idProducto = Convert.ToInt32(dgvProductos[0, e.RowIndex].Value); * producto.nombreProducto = dgvProductos[1, e.RowIndex].Value.ToString(); * * bool editarMesa = false; * bool eliminarMesa = true; * DialogResult confirmarOperacion = Utilidades.MuestraPregunta("¿Estas Seguro de eliminar el producto " + producto.idProducto.ToString() + "?"); * * if (confirmarOperacion == DialogResult.OK) * { * resultado = productoBLL.AsignarMesas(producto, editarMesa, eliminarMesa); * Utilidades.MuestraInfo(resultado.mensaje); * } */ MessageBox.Show("Eliminar Producto"); break; case "AgregarProducto": //MessageBox.Show("Agregar Producto"); MesaBLL mesaBLL = new MesaBLL(); Result resultado = new Result(); int totalproductos = Convert.ToInt32(dgvProductos[6, e.RowIndex].Value); if (totalproductos < 1) { Utilidades.MuestraAdvertencias("Debes de ingresar una cantidad a de productos"); } else { if (agregarProductoMesa) { for (int i = 0; i < totalproductos; i++) { resultado = mesaBLL.AgregarProductoAMesas(numMesa, Convert.ToInt64(dgvProductos[1, e.RowIndex].Value)); } Utilidades.MuestraInfo(resultado.mensaje); } } break; /* * case "ProductosAAgregar": * //Utilidades.MuestraInfo("ProductosAAgregar"); * dgvProductos[6, e.RowIndex].ReadOnly = false; * break; */ default: break; } this.CargaProductosGrid(""); } } catch (Exception ex) { throw ex; } }
private void Btn_altermesa_Click(object sender, RoutedEventArgs e) { MesaBLL mb = new MesaBLL(); bool sal = true; bool num = true; bool capacidad = true; if (ComedorPrincipal.IsSelected || Terraza.IsSelected || Terraza2.IsSelected) { sal = true; } else { sal = false; } if (txt_numeromesa.Text.Trim() == "") { num = false; } if (txt_capacidad.Text.Trim() == "") { capacidad = false; } if (num == false) { lb1.Content = "Ingrese número de mesa"; lb1.FontSize = 12; } if (sal == false) { lb2.Content = "Seleccione una sala para la mesa"; } if (capacidad == false) { lb3.Content = "Debe darle una capacidad a la mesa"; } if (num == true && sal == true && capacidad == true) { mb.Id_mesa = Int32.Parse(txt_numeromesa.Text); string sala = ""; if (ComedorPrincipal.IsSelected) { sala = "Comedor Principal"; } else if (Terraza.IsSelected) { sala = "Terraza"; } else if (Terraza2.IsSelected) { sala = "Terraza 2"; } mb.Nombre_sala = sala; mb.Capacidad = Int32.Parse(txt_capacidad.Text); bool existe = mb.Get_nume(Int32.Parse(txt_numeromesa.Text)); if (existe == false) { Generic g = new Generic(); g.Owner = this; g.lb_titulo.Content = "Advertencia"; g.lb_confirmacion.Content = "No existe una mesa con este número. Lo que puede hacer es:"; g.lb_contenido.Content = "* Volver atrás y probar con una mesa existente" + "\n" + "* Ver la lista de mesas Existentes"; g.btn_Confirmar.Content = ""; g.ACCION.Content = "go_list"; g.ACCION.Visibility = Visibility.Hidden; g.btn_Confirmar.Content = "Ver listas"; g.ShowDialog(); } else { mb.Alter_Mesa(mb); DataTable dt1 = mb.GetMesaComedor(); dtg_ComedorPrincipal.ItemsSource = dt1.DefaultView; DataTable dt2 = mb.GetMesaterra(); dtg_Terra.ItemsSource = dt2.DefaultView; DataTable dt3 = mb.GetMesaTerra2(); dtg_Terra2.ItemsSource = dt3.DefaultView; txt_capacidad.Text = ""; txt_numeromesa.Text = ""; cbb_sala.SelectedIndex = -1; } } }
private void Btn_buscar_Click(object sender, RoutedEventArgs e) { MesaBLL mb = new MesaBLL(); if (rdb_num.IsChecked == true) { bool num = true; if (txt_num.Text.Trim() == "") { lb1.Content = "Ingrese un numero para filtrar"; num = false; } if (num == true) { int nume = Int32.Parse(txt_num.Text); bool existe = mb.Get_nume(nume); if (existe == true) { DataTable dt = mb.GetmesaNum(nume); dtg_mesas.ItemsSource = dt.DefaultView; } else { lb1.Content = "Esta mesa no existe"; } } } else if (rdb_sala.IsChecked == true) { string sala = ""; bool sal = true; if (ComedorPrincipal.IsSelected || Terraza.IsSelected || Terraza2.IsSelected) { sal = true; } else { sal = false; } if (sal == true) { if (ComedorPrincipal.IsSelected) { sala = "Comedor Principal"; } else if (Terraza.IsSelected) { sala = "Terraza"; } else if (Terraza2.IsSelected) { sala = "Terraza 2"; } DataTable dt = mb.Getmesasala(sala); dtg_mesas.ItemsSource = dt.DefaultView; } else { lb1.Content = "Debe ingresar una sala para filtrar"; } } }