void FrmCadContatosLoad(object sender, EventArgs e) { if (ReadOnly) { btnConfirma.Visible = false; btnCancela.Visible = false; btnInclui.Visible = false; btnExclui.Visible = false; btnAltera.Visible = false; //btnFecha.Text = "Seleciona"; btnFecha.Top += 30; } contatos = new cContatos(); string where = "where COD_PARCEIRO='" + parceiro + "'"; if (cod_contato != null) { where += " and COD_CONTATO = '" + cod_contato + "'"; } this.Cursor = Cursors.WaitCursor; contatos.Carrega(dgvCadastro, where); this.Cursor = Cursors.Default; SetaEdicaoLocal(false); lblParceiro.Text = "Parceiro: " + parceiro + " - " + des_parceiro; if (juridica) { lblPapel.Text = "Papel"; } else { lblPapel.Text = "Grau Afinidade"; } }
void BtnConfirmaClick(object sender, EventArgs e) { if (btnConfirma.Text.CompareTo("Seleciona") == 0) { result = true; Close(); return; } if (edtCodigo.Text.Trim().Length == 0) { MessageBox.Show("Código", "Campo obrigatório", MessageBoxButtons.OK, MessageBoxIcon.Warning); edtCodigo.Focus(); return; } if (edtRazao.Text.Trim().Length == 0) { MessageBox.Show("Código", "Campo obrigatório", MessageBoxButtons.OK, MessageBoxIcon.Warning); edtCodigo.Focus(); return; } string msg = ""; cParceiros parceiros = new cParceiros(); result = parceiros.IncluiRapido(edtCodigo.Text, edtRazao.Text, FONE.TiraEdicao(edtFone1.Text), FONE.TiraEdicao(edtFone2.Text), FONE.TiraEdicao(edtCelular.Text), FONE.TiraEdicao(edtFAX.Text), edtEmail.Text, ref msg); if (!result) { MessageBox.Show(edtCodigo.Text + "\n" + msg, "Erro na inclusão do cliente", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (edtContato.Text.Trim().Length == 0) { cContatos contatos = new cContatos(); result = contatos.Inclui(edtCodigo.Text, edtContato.Text, edtNome.Text, FONE.TiraEdicao(edtFoneContato1.Text), FONE.TiraEdicao(edtFoneContato2.Text), FONE.TiraEdicao(edtCelularContato.Text), FONE.TiraEdicao(edtEmailContato.Text), edtPapel.Text, false, DateTime.Now, "S", ref msg); if (!result) { MessageBox.Show(edtContato.Text + "\n" + msg, "Erro na inclusão do contato", MessageBoxButtons.OK, MessageBoxIcon.Error); } } result = true; Close(); }
void BtnEmailClick(object sender, EventArgs e) { if (dgvCadastro.Rows.Count == 0) { return; } cContatos contatos = new cContatos(); string email = contatos.Email(edtParceiro.Text, edtContato.Text); //System.Diagnostics.Process.Start("explorer", "\"mailto:" + email + "?body=" + edtPendencia.Text + "\""); if (edtPendencia.Text.Trim().CompareTo("") == 0) { System.Diagnostics.Process.Start("\"mailto:" + email.Trim()); } else { System.Diagnostics.Process.Start("\"mailto:" + email.Trim() + "?body=" + edtPendencia.Text + "\""); } }