private void btnAgregar_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(txtPlato.Text))
     {
         if (!String.IsNullOrEmpty(txtPrecio.Text))
         {
             try
             {
                 ServicioController sc = new ServicioController();
                 if (sc.AgregarServicio(txtPlato.Text, int.Parse(txtPrecio.Text), comboServicio.Text, (int)App.user.IDADMINISTRADOR))
                 {
                     sc.LlenarGrid(App.fs.dataServicios);
                     this.Dispose();
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Ingrese un numero valido.", "Crear Servicio", MessageBoxButtons.OK);
             }
         }
         else
         {
             MessageBox.Show("Ingrese precio.", "Crear Servicio", MessageBoxButtons.OK);
         }
     }
     else
     {
         MessageBox.Show("Ingrese nombre del plato.", "Crear Servicio", MessageBoxButtons.OK);
     }
 }
        private void AgregarServicio_Load(object sender, EventArgs e)
        {
            ServicioController sc = new ServicioController();

            sc.LlenarComboTipo(comboServicio);
            comboServicio.SelectedIndex = 0;
        }
예제 #3
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         ServicioController sc = new ServicioController();
         int id = int.Parse(dataServicios.CurrentRow.Cells[0].Value.ToString());
         sc.EliminarServicio(id);
         sc.LlenarGrid(App.fs.dataServicios);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Debe seleccionar un servicio.", "Eliminar Servicio", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #4
0
 private void btnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         ServicioController sc = new ServicioController();
         int id = int.Parse(dataServicios.CurrentRow.Cells[0].Value.ToString());
         ModificarServicio ms = new ModificarServicio();
         sc.LlenarComboTipo(ms.comboServicio);
         sc.LlenarCampos(id, ms.txtPlato, ms.txtPrecio, ms.comboServicio, ms.labelId);
         ms.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Debe seleccionar un servicio.", "Modificar Servicio", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #5
0
        private void FormularioServicio_Load(object sender, EventArgs e)
        {
            ServicioController sc = new ServicioController();

            sc.LlenarGrid(dataServicios);
        }