Ejemplo n.º 1
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     try
     {
         frmInformation Info   = new frmInformation("Salir");
         DialogResult   Result = new DialogResult();
         Result = Info.ShowDialog();
         if (Result == DialogResult.OK)
         {
             this.Close();
         }
         else
         {
             Info.Close();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtDescription.Text != string.Empty && txtName.Text != string.Empty)
         {
             string         strQuery  = $"Delete from Categorias where Nombre ='{txtName.Text}' and Descripcion = '{txtDescription.Text}'";
             DialogResult   result    = new DialogResult();
             frmInformation frmDelete = new frmInformation("¿Eliminar Categoria?");
             result = frmDelete.ShowDialog();
             if (result == DialogResult.OK)
             {
                 frmDelete.Close();
                 DB.ExecuteQuery(strQuery);
                 frmRealizado frmChecked = new frmRealizado("Categoria Eliminada");
                 result = frmChecked.ShowDialog();
                 if (result == DialogResult.OK)
                 {
                     frmChecked.Close();
                     dgvCategorys.DataSource = getInfoCategory();
                     dgvCategorys.Columns.Remove("id_categoria");
                     txtDescription.Text = "";
                     txtName.Text        = "";
                 }
             }
         }
         else
         {
             MessageBox.Show("Rellene los campos", "Campos Vacios", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }