Пример #1
0
 /// <summary>
 /// Método para agregar un insumo
 /// </summary>
 private void AgregarInsumos()
 {
     try
     {
         if ((string.IsNullOrEmpty(this.textBox_nombre.Text)) || (string.IsNullOrEmpty(this.comboBox_categoria.Text)) || (string.IsNullOrEmpty(this.textBox_cantidad.Text)) || (string.IsNullOrEmpty(this.textBox_stock.Text)))
         {
             MessageBox.Show("Falta ingresar algunos datos");
         }
         else
         {
             DialogResult result = MessageBox.Show("¿Seguro que deseas Agregar este Insumo?", "Confirmación", MessageBoxButtons.YesNo);
             if (result == DialogResult.Yes)
             {
                 int agregado = ControladorFachada.AgregarInsumo(this.textBox_nombre.Text, this.richTextBox_descripcion.Text, this.textBox_cantidad.Text, this.textBox_stock.Text, this.comboBox_categoria.Text);
                 if (agregado != -1)
                 {
                     MessageBox.Show("Nombre de Insumo ya existente");
                 }
                 else
                 {
                     this.textBox_nombre.Clear();
                     this.comboBox_categoria.Text = string.Empty;
                     this.richTextBox_descripcion.Clear();
                     this.textBox_cantidad.Clear();
                     this.textBox_stock.Clear();
                     RefrescarDataGrid();
                 }
             }
         }
     }
     catch (LogicaException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }