private void Dtg_plato_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { var item = dtg_plato.SelectedItem as DataRowView; if (item != null) { string Orden = item.Row[0].ToString(); string bebes = item.Row[2].ToString(); PlatoBLL bb = new PlatoBLL(); int idb = bb.Platoidbynb(bebes); int ido = Int32.Parse(Orden); bb.Alter_Plato_Despachado(ido, idb); } else { } } catch (Exception ex) { MessageBox.Show("" + ex); } }
private void dtg_rec_SelectionChanged(object sender, SelectionChangedEventArgs e) { int id_plato = 0; try { PlatoBLL ub = new PlatoBLL(); DataGrid gd = (DataGrid)sender; DataRowView drv = gd.SelectedItem as DataRowView; if (drv != null) { id_plato = int.Parse(drv["ID"].ToString()); } DataTable dte = new DataTable(); dte = ub.platoRela(id_plato); dtg_rece_list.ItemsSource = dte.DefaultView; dtg_rece_list.Visibility = Visibility.Visible; } catch (Exception ex) { MessageBox.Show("" + ex); } }
private void btn_listar_Click(object sender, RoutedEventArgs e) { PlatoBLL ub = new PlatoBLL(); System.Data.DataTable dt = ub.AllplatosList(); dtg_rec.ItemsSource = dt.DefaultView; dtg_rec.Visibility = Visibility.Visible; }
private void txt_nom_rec_PreviewTextInput(object sender, TextCompositionEventArgs e) { PlatoBLL ub = new PlatoBLL(); string Nombre = (txt_nom_rec.Text); dtg_rec.Visibility = Visibility.Visible; System.Data.DataTable dt = ub.platoList(Nombre); dtg_rec.ItemsSource = dt.DefaultView; }
public void fillCbPlatos() { PlatoBLL plbll = new PlatoBLL(); DataTable dt = new DataTable(); dt = plbll.GetPlatosHabilitados(); cbPlatos.ItemsSource = dt.DefaultView; cbPlatos.DisplayMemberPath = "NOMBRE_PLATO"; cbPlatos.SelectedValuePath = "ID_PLATO"; cbPlatos.SelectedIndex = 0; }
private void Banner_Loaded_1(object sender, RoutedEventArgs e) { oDispatcherTimer.Interval = new TimeSpan(0, 0, 3); oDispatcherTimer.Tick += (a, b) => { BebestibleBLL bebBLL = new BebestibleBLL(); System.Data.DataTable dt = bebBLL.getbeb_garzon(); dtg_bebestible.ItemsSource = dt.DefaultView; PlatoBLL plaBLL = new PlatoBLL(); System.Data.DataTable dta = plaBLL.Getplato_garzon(); dtg_plato.ItemsSource = dta.DefaultView; }; }
private void btn_eliminar_Click(object sender, RoutedEventArgs e) { bool idre = true; Generic gen = new Generic(); gen.ACCION.Content = "deshabilitar"; gen.ACCION.Visibility = Visibility.Hidden; PlatoBLL us = new PlatoBLL(); if (txt_id_receta.Text.Trim() == "") { idre = false; lbl1.Content = "Debe ingresar una ID"; } if (idre) { int idplato = Int32.Parse(txt_id_receta.Text); try { DataTable da = us.DatosDesPlato(idplato); DataRow row = da.Rows[0]; string id = row[0].ToString(); string Nombre = row[1].ToString(); gen.lb_titulo.FontSize = 18; gen.lb_confirmacion.FontSize = 16; gen.lb_contenido.FontSize = 16; gen.lb_titulo.Content = "¿Desea deshabilitar este plato?"; gen.lb_confirmacion.Content = "Al realizar esta accion, se deshabilitara el plato:"; gen.lb_contenido.Content = "id : " + id + "\n" + "Nombre: " + Nombre; gen.Title = "Confirmación"; gen.btn_Cancelar.Content = "Volver"; gen.btn_Confirmar.Content = "Deshabilitar"; gen.lb_rut.Content = txt_id_receta.Text; gen.Owner = this; gen.ShowDialog(); PlatoBLL pb = new PlatoBLL(); dtg_receta.ItemsSource = pb.AllplatosList().DefaultView; } catch (Exception ex) { MessageBox.Show("Este plato no existe en el sistema"); MessageBox.Show("" + ex); } } }
private void Tablero_Loaded(object sender, RoutedEventArgs e) { lblusr.Content = "Nombre de usuario: " + username; oDispatcherTimer.Interval = new TimeSpan(0, 0, 5); oDispatcherTimer.Tick += (a, b) => { PlatoBLL espBLL = new PlatoBLL(); System.Data.DataTable dt = espBLL.Get_Orden_espera_plato(); dtg_espera.ItemsSource = dt.DefaultView; PlatoBLL prepBLL = new PlatoBLL(); System.Data.DataTable dta = prepBLL.Get_Orden_preparacion_plato(); dtg_prep.ItemsSource = dta.DefaultView; PlatoBLL lisBLL = new PlatoBLL(); System.Data.DataTable dtg = lisBLL.Get_Orden_listo_plato(); dtg_listo.ItemsSource = dtg.DefaultView; }; }
private void btn_agre_Click(object sender, RoutedEventArgs e) { dtg_ing.Visibility = Visibility.Visible; if (txt_cant_ing.Text.Length > 0) { bool coincide = false; foreach (DataRow line in dtl.Rows) { int id = int.Parse(line["id"].ToString()); int cant = int.Parse(line["cantidad"].ToString()); PlatoBLL ptbll = new PlatoBLL(); if (cbb_ingres.SelectedValue.ToString() == line["id"].ToString()) { line["cantidad"] = int.Parse(line["cantidad"].ToString()) + int.Parse(txt_cant_ing.Text); dtg_ing.ItemsSource = dtl.DefaultView; coincide = true; break; } else { } } if (coincide == false) { DataRow row = dtl.NewRow(); row["id"] = cbb_ingres.SelectedValue; row["nombre"] = cbb_ingres.Text; row["cantidad"] = txt_cant_ing.Text; dtl.Rows.Add(row); dtg_ing.ItemsSource = dtl.DefaultView; } dtl.AcceptChanges(); } else { MessageBox.Show("Por Favor Ingrese todos los Campos al Agregar un ingrediente."); } }
private void actualizadtgIngredientes(int id_plato) { PlatoBLL plBLL = new PlatoBLL(); DataTable DtIngredientesNecesarios = new DataTable(); DtIngredientesNecesarios = plBLL.GetIngredientesPlato(id_plato); bool coincide; foreach (DataRow ingNec in DtIngredientesNecesarios.Rows) { double cantidadNecesaria = double.Parse(ingNec[2].ToString()) * Int32.Parse(txtCantidad.Text); int id_ingredienteNec = Int32.Parse(ingNec[1].ToString()); string nombre = ingNec[3].ToString(); coincide = false; foreach (DataRow row in IngredientesAEnviar.Rows) { int id_ingrediente = Int32.Parse(row["id"].ToString()); if (id_ingrediente == id_ingredienteNec) { row["cantidad"] = double.Parse(row["cantidad"].ToString()) + cantidadNecesaria; dtgIngEnviar.ItemsSource = IngredientesAEnviar.DefaultView; coincide = true; break; } } if (!coincide) { DataRow row = IngredientesAEnviar.NewRow(); row["id"] = id_ingredienteNec; row["nombre"] = nombre; row["cantidad"] = cantidadNecesaria; IngredientesAEnviar.Rows.Add(row); dtgIngEnviar.ItemsSource = IngredientesAEnviar.DefaultView; } } }
private void CbPlatos_SelectionChanged(object sender, SelectionChangedEventArgs e) { int id_plato = Int32.Parse(cbPlatos.SelectedValue.ToString()); Ing1Plato.Clear(); PlatoBLL plBLL = new PlatoBLL(); DataTable DtIngredientesNecesarios = new DataTable(); DtIngredientesNecesarios = plBLL.GetIngredientesPlato(id_plato); foreach (DataRow row in DtIngredientesNecesarios.Rows) { DataRow line = Ing1Plato.NewRow(); line["Nombre"] = row[3]; line["Cantidad"] = row[2]; Ing1Plato.Rows.Add(line); } dtgingredientes1plato.ItemsSource = Ing1Plato.DefaultView; }
private void BtnEnviar_Click(object sender, RoutedEventArgs e) { try { DataTable UpdateIngredientes = ingredientesDT.GetChanges(); foreach (DataRow row in UpdateIngredientes.Rows) { ingredienteBLL ingBLL = new ingredienteBLL(); int id = int.Parse(row[0].ToString()); double cantidad = double.Parse(row[2].ToString()); ingBLL.UpdateStockIngrediente(id, cantidad); } } catch (Exception ex) { Console.WriteLine("Exception: {0}", ex.ToString()); } try { DataTable UpdatePlato = PlatosACocina; foreach (DataRow row in UpdatePlato.Rows) { PlatoBLL plaBLL = new PlatoBLL(); int id = int.Parse(row[0].ToString()); int cantidad = int.Parse(row[2].ToString()); plaBLL.SetStockPlato(id, cantidad); } } catch (Exception ex) { Console.WriteLine("Exception: {0}", ex.ToString()); } MessageBox.Show("Se han enviado correctamente el registro a cocina"); ReloadPage(); }
private void dtg_prep_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { object item = dtg_prep.SelectedItem; if (item != null) { string Orden = (dtg_prep.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text; string bebes = (dtg_prep.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text; PlatoBLL us = new PlatoBLL(); us.orden_id_orden = Int32.Parse(Orden); us.Id_plato = Int32.Parse(bebes); us.Alter_plato_Listo(us); } else { } } catch { } }
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 btn_crear_Click(object sender, RoutedEventArgs e) { bool nombre = true; bool precio = true; bool seleccionar = true; bool cantidad = true; bool descripcion = true; bool categ = true; bool hab = true; IngredienteBLL ib = new IngredienteBLL(); PlatoBLL plbll = new PlatoBLL(); if (txt_nomb.Text.Trim() == "") { nombre = false; lb12.Content = "Debe ingresar el Nombre del Plato"; } if (txt_precio.Text.Trim() == "") { precio = false; lb13.Content = "Debe ingresar el Precio del Plato"; } if (cbb_ingre.Text == "") { nombre = false; lb14.Content = "Debe ingresar Los Ingredientes del Plato"; } if (txt_cant.Text.Trim() == "") { cantidad = false; lb15.Content = "Debe ingresar la Cantidad del ingrediente"; } if (txt_desc.Text.Trim() == "") { descripcion = false; lb16.Content = "Debe ingresar una Descripcion para el plato"; } if (cbb_catego.Text == "") { categ = false; lb17.Content = "Debe ingresar una Categoria al plato"; } if (cbb_habi.Text.Trim() == "") { hab = false; lb18.Content = "Debe ingresar el estado del Pato"; } if (nombre && precio && seleccionar && cantidad && descripcion && categ && hab) { plbll.Categoria = cbb_catego.Text; plbll.Habilitado = cbb_habi.Text; plbll.Nombre_plato = txt_nomb.Text; plbll.Precio = int.Parse(txt_precio.Text); plbll.Imagen = imageBt; plbll.descripcion = txt_desc.Text; int cantinicial = Int32.Parse(txt_cantinicial.Text); plbll.insert_plato(plbll, cantinicial); foreach (DataRow line in dtl.Rows) { int id = int.Parse(line["id"].ToString()); int cant = int.Parse(line["cantidad"].ToString()); PlatoBLL ptbll = new PlatoBLL(); ptbll.crea_relacion_plato_ing(id, cant); } MessageBox.Show("Receta creada correctamente"); } }
private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { PlatoBLL pb = new PlatoBLL(); dtg_receta.ItemsSource = pb.AllplatosList().DefaultView; }
private void btn_mod_Click(object sender, RoutedEventArgs e) { bool idrec = true; bool nomb = true; bool habili = true; bool selec = true; bool canti = true; bool prec = true; bool cat = true; bool des = true; lb1.Content = ""; lb2.Content = ""; lb3.Content = ""; lb4.Content = ""; lb5.Content = ""; lb6.Content = ""; lb7.Content = ""; PlatoBLL ub = new PlatoBLL(); if (txt_id_rec.Text.Trim() == "") { idrec = false; lb1.Content = "Debe ingresar la ID"; } if (txt_nom_rec.Text.Trim() == "") { nomb = false; lb2.Content = "Debe ingresar el Nombre del Plato"; } if (cbb_habili.Text == "") { habili = false; lb3.Content = "Debe ingresar el Estado del Plato"; } if (rb_cons.IsChecked == false) { if (cbb_ingres.Text == "") { selec = false; lb4.Content = "Debe Seleccionar el/los Ingredientes del Plato"; } if (txt_cant_ing.Text.Trim() == "") { canti = false; lb5.Content = "Debe ingresar la Cantidad del Ingrediente a ingresar"; } } if (txt_prec.Text.Trim() == "") { prec = false; lb6.Content = "Debe ingresar el Precio del Plato"; } if (cbb_catego.Text.Trim() == "") { cat = false; lb7.Content = "Debe ingresar la Categoria del Plato"; } if (txt_desc_mod.Text.Trim() == "") { des = false; lb8.Content = "Debe ingresar la Descripcion del Plato"; } if (idrec && nomb && habili && selec && canti && prec && cat && des) { ub.Id_plato = Int32.Parse(txt_id_rec.Text); ub.Nombre_plato = txt_nom_rec.Text; /*ub.cantidad = Int32.Parse(txt_cant_ing.Text);*/ ub.Precio = Int32.Parse(txt_prec.Text); ub.Categoria = cbb_catego.Text; ub.descripcion = txt_desc_mod.Text; ub.Habilitado = cbb_habili.Text; bool existe = ub.Getplatobyid(Int32.Parse(txt_id_rec.Text)); if (existe) { ub.Eliminar_Ing(ub); ub.alter_plato(ub); PopupNotifier popup = new PopupNotifier(); popup.TitleText = "Aviso"; popup.Image = Properties.Resources.delete; popup.ContentText = "Plato modificado correctamente"; popup.AnimationDuration = 500; popup.Delay = 2500; popup.Popup(); Close(); } else { MessageBox.Show("La id del plato ingresado no existe"); } if (rb_elim.IsChecked == true) { foreach (DataRow line in dtl.Rows) { int idplato = Int32.Parse(txt_id_rec.Text); int id = int.Parse(line["id"].ToString()); int cant = int.Parse(line["cantidad"].ToString()); PlatoBLL ptbll = new PlatoBLL(); try { ptbll.Modifica_relacion_ing(idplato, id, cant); } catch (Exception ex) { MessageBox.Show("" + ex); } } } } }
protected void Button1_Click(object sender, EventArgs e) { OrdenBLL ordBLL = new OrdenBLL(); //ordBLL.creaOrden(); if (Session["numero_boleta"] == null) { } else if (Session["numero_boleta"] != null && GridView1.Rows.Count > 0) { string faltaStock = ""; foreach (GridViewRow row in GridView1.Rows) { int id = int.Parse(row.Cells[1].Text); string cat = row.Cells[3].Text; if (cat != "bebible") { PlatoBLL plaBLL = new PlatoBLL(); int stockactual = plaBLL.verificaStock(id); int stockSolicitado = int.Parse(((TextBox)row.Cells[5].FindControl("TextBox1")).Text); if (stockactual < stockSolicitado) { faltaStock = faltaStock + row.Cells[2].Text + " Stock Actual: " + stockactual + "\\n "; } } else if (cat == "bebible") { BebestibleBLL bebesBLL = new BebestibleBLL(); int stockactual = bebesBLL.verificaStock(id); int stockSolicitado = int.Parse(((TextBox)row.Cells[5].FindControl("TextBox1")).Text); if (stockactual < stockSolicitado) { faltaStock = faltaStock + row.Cells[2].Text + " Stock Actual: " + stockactual + "\\n "; } } } if (faltaStock.Length <= 0) { bool check = ordBLL.creaOrden(int.Parse(Session["numero_boleta"].ToString())); if (check) { foreach (GridViewRow row in GridView1.Rows) { int id = int.Parse(row.Cells[1].Text); int cantidad = int.Parse(((TextBox)row.Cells[5].FindControl("TextBox1")).Text); if (row.Cells[3].Text != "bebible") { PlatoBLL plBLL = new PlatoBLL(); plBLL.ingresaRelacion(id, cantidad); plBLL.reduceStock(id, cantidad); } else if (row.Cells[3].Text == "bebible") { BebestibleBLL bebBLL = new BebestibleBLL(); bebBLL.agregarRelacion(id, cantidad); bebBLL.reduceStock(id, cantidad); } } Session["pedido"] = null; Response.Redirect("/CarroCompras.aspx"); } } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('No se pudo Generar la orden: \\n Insuficiente Stock de: \\n" + faltaStock + " ')", true); } } }
private void BtnAgregar_Click(object sender, RoutedEventArgs e) { try { int idplato = Int32.Parse(cbPlatos.SelectedValue.ToString()); DataTable DtIngredientesNecesarios = new DataTable(); DataTable IngredientesTemporal = ingredientesDT; PlatoBLL plBLL = new PlatoBLL(); DtIngredientesNecesarios = plBLL.GetIngredientesPlato(idplato); bool estadoComprovacion = true; if (Int32.Parse(txtCantidad.Text) > 0) { foreach (DataRow ingNec in DtIngredientesNecesarios.Rows) { double cantidadNecesaria = double.Parse(ingNec[2].ToString()) * Int32.Parse(txtCantidad.Text); int id_ingredienteNec = Int32.Parse(ingNec[1].ToString()); foreach (DataRow row in IngredientesTemporal.Rows) { string prueba1 = row[0].ToString(); string prueba2 = row[1].ToString(); string prueba3 = row[2].ToString(); int id_ingrediente = Int32.Parse(row[0].ToString()); if (id_ingrediente == id_ingredienteNec) { double stockActual = double.Parse(row[2].ToString()); if (cantidadNecesaria > stockActual) { MessageBox.Show("Insuficiente Stock de: " + prueba2); estadoComprovacion = false; break; } row[2] = stockActual - cantidadNecesaria; } } if (estadoComprovacion == false) { break; } } if (estadoComprovacion) { MessageBox.Show("Se ha agregado el plato"); ingredientesDT = IngredientesTemporal; dtgIngredientesDisp.ItemsSource = IngredientesTemporal.DefaultView; actualizadtgIngredientes(idplato); actualizardtgplatos(idplato, int.Parse(txtCantidad.Text)); } else { dtgIngredientesDisp.ItemsSource = ingredientesDT.DefaultView; } } else { lb1.Content = "Ingrese una cantidad mayor a 0"; } } catch { } }