コード例 #1
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(txtName.Text))
     {
         frmMessageBoxAlert3 frm = new frmMessageBoxAlert3();
         frm.ShowDialog();
     }
     else
     {
         if (flag == true)
         {
             frmMessageBoxSave frm = new frmMessageBoxSave();
             if (frm.ShowDialog() == DialogResult.OK)
             {
                 String name = txtName.Text;
                 //Category cat = new category(name,1);
                 //Se llama al insert
                 reiniciar();
             }
         }
         else
         {
             if (String.IsNullOrEmpty(txtId.Text))
             {
                 frmMessageBoxAlert4 frm2 = new frmMessageBoxAlert4();
                 frm2.ShowDialog();
             }
             else
             {
                 frmMessageBoxSave frm = new frmMessageBoxSave();
                 if (frm.ShowDialog() == DialogResult.OK)
                 {
                     int    id   = Int32.Parse(txtId.Text);
                     String name = txtName.Text;
                     //Category cat = new category(name,0);
                     //Se llama al update
                     reiniciar();
                 }
             }
         }
     }
 }
コード例 #2
0
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtId.Text))
     {
         frmMessageBoxAlert3 frm = new frmMessageBoxAlert3();
         frm.ShowDialog();
     }
     else
     {
         frmMessageBoxDelete frm = new frmMessageBoxDelete();
         if (frm.ShowDialog() == DialogResult.OK)
         {
             int    id   = Int32.Parse(txtId.Text);
             String name = txtName.Text;
             ////Category cat = new category(name,0);
             //Se llama al delete
             reiniciar();
         }
     }
 }