Exemplo n.º 1
0
        private void btnVer_Click(object sender, EventArgs e)
        {
            if (dgvListaMesas.SelectedRows.Count == 1)
            {
                DataGridViewRow o = dgvListaMesas.SelectedRows[0];

                DataRowView rowView = (DataRowView)o.DataBoundItem;

                RestauranteDataSet.platosRow plato = (RestauranteDataSet.platosRow)rowView.Row;

                FrmPlatoDetalle frmPlatoDetalle = new FrmPlatoDetalle(plato);
                frmPlatoDetalle.ShowDialog();
                // CargarListaMesas();
            }
        }
Exemplo n.º 2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            RestauranteDataSet dataSet = new RestauranteDataSet();

            RestauranteDataSet.platosRow plato = dataSet.platos.NewplatosRow();

            plato.Id     = id;
            plato.Nombre = txtNombre.Text;

            dataSet.platos.AddplatosRow(plato);

            PlatosBLL platosBLL = new PlatosBLL();

            platosBLL.GuardarPlatosDataSet(plato);
            this.Close();
        }
Exemplo n.º 3
0
        private void btnBorrar_Click(object sender, EventArgs e)
        {
            if (dgvListaMesas.SelectedRows.Count == 1)
            {
                DataGridViewRow o = dgvListaMesas.SelectedRows[0];

                DataRowView rowView = (DataRowView)o.DataBoundItem;

                RestauranteDataSet.platosRow plato = (RestauranteDataSet.platosRow)rowView.Row;

                PlatosBLL platosBLL = new PlatosBLL();
                platosBLL.Borrar(plato);

                CargarPlatos();
            }
        }
Exemplo n.º 4
0
        public void BorrarPlatosDataSet(RestauranteDataSet.platosRow platoRow)
        {
            RestauranteDataSet datos = ObtenerPlatosDataSet();

            if (platoRow.Id > 0)
            {
                foreach (var plato in datos.platos)
                {
                    if (plato.Id == platoRow.Id)
                    {
                        plato.Delete();
                    }
                }
            }
            platosTableAdapter adapter = new platosTableAdapter();

            adapter.Update(datos);
        }
Exemplo n.º 5
0
        public void GuardarPlatosDataSet(RestauranteDataSet.platosRow platoRow)
        {
            RestauranteDataSet datos = ObtenerPlatosDataSet();

            if (platoRow.Id > 0)
            {
                foreach (var plato in datos.platos)
                {
                    if (plato.Id == platoRow.Id)
                    {
                        plato.Nombre = platoRow.Nombre;
                    }
                }
            }
            else
            {
                datos.platos.Rows.Add(platoRow.ItemArray);
            }


            platosTableAdapter adapter = new platosTableAdapter();

            adapter.Update(datos);
        }
Exemplo n.º 6
0
        public void Borrar(RestauranteDataSet.platosRow platosRow)
        {
            PlatoDAL platoDAL = new PlatoDAL();

            platoDAL.BorrarPlatosDataSet(platosRow);
        }
Exemplo n.º 7
0
        public void GuardarPlatosDataSet(RestauranteDataSet.platosRow platosRow)
        {
            PlatoDAL platoDAL = new PlatoDAL();

            platoDAL.GuardarPlatosDataSet(platosRow);
        }
Exemplo n.º 8
0
 public FrmPlatoDetalle(RestauranteDataSet.platosRow plato)
 {
     InitializeComponent();
     txtNombre.Text = plato.Nombre;
     id             = plato.Id;
 }