private bool ValidaCampos() { using (var oDB = new CFornecimentoMaterial.CFornecimentoMaterialClient()) { if (oDB.FornecimentoExiste(Convert.ToInt32(txtFornecimento.Text)) == false) { MessageBox.Show("O Fornecimento não existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return(false); } } if (txtFornecimento.Text == "") { MessageBox.Show("O campo Fornecimento é de preenchimento obrigatório", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return(false); } else if (txtValor.Text == "") { MessageBox.Show("O campo Valor é de preenchimento obrigatório", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return(false); } return(true); }
private bool ValidaCampos() { using (var oDB = new CFornecimentoMaterial.CFornecimentoMaterialClient()) { if (oDB.FornecimentoExiste(Convert.ToInt32(txtFornecimento.Text)) == false) { MessageBox.Show("O Fornecimento não existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return false; } } if (txtFornecimento.Text == "") { MessageBox.Show("O campo Fornecimento é de preenchimento obrigatório", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return false; } else if (txtValor.Text == "") { MessageBox.Show("O campo Valor é de preenchimento obrigatório", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return false; } return true; }
private void fornecimentoMaterialBindingNavigatorSaveItem_Click(object sender, EventArgs e) { using (var oDB = new CFornecimentoMaterial.CFornecimentoMaterialClient()) { if (txtID.Text != "") { if (oDB.FornecimentoExiste(Convert.ToInt32(txtID.Text)) == false) { MessageBox.Show("O Fornecimento não existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } else { var result = MensagemErro.Erro(oDB.CancelarFornecimento(Convert.ToInt32(txtID.Text), chkCancelar.Checked)); if (result) MensagemAviso.MensagemUsuario(1, "Cancelamento"); } } AtualizaDataSource(); } }
private void fornecimentoMaterialBindingNavigatorSaveItem_Click(object sender, EventArgs e) { using (var oDB = new CFornecimentoMaterial.CFornecimentoMaterialClient()) { if (txtID.Text != "") { if (oDB.FornecimentoExiste(Convert.ToInt32(txtID.Text)) == false) { MessageBox.Show("O Fornecimento não existe", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } else { var result = MensagemErro.Erro(oDB.CancelarFornecimento(Convert.ToInt32(txtID.Text), chkCancelar.Checked)); if (result) { MensagemAviso.MensagemUsuario(1, "Cancelamento"); } } } AtualizaDataSource(); } }