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(); } } } } }
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(); } } }