private void Consultar(object txt) { TextBox box = (TextBox)txt; FormPessoaConsultar formPessoaConsultar = new FormPessoaConsultar(true); if (formPessoaConsultar.ShowDialog(this) == DialogResult.Yes) { infoPessoa = formPessoaConsultar.SelecionadoCliente; if (infoPessoa.pssemail == "*****@*****.**") { FormMessage.ShowMessegeWarning("A pessoa selecionada não possui e-mail cadastrado!"); return; } string novoEmail = FormTextoFormat.PrimeiroNome(infoPessoa.pssnome) + " - " + infoPessoa.pssemail; if (string.IsNullOrEmpty(box.Text)) { box.Text = novoEmail; } else { box.Text += ";" + novoEmail; } box.Select(); box.SelectionStart = box.Text.Length; } }
private static void FormatTextBox_AoAlterar(object sender, EventArgs e) { TextBox box = sender as TextBox; if (!string.IsNullOrEmpty(box.Text)) { FormTextoFormat.NovoTextoUpper(box); } }
private static void FormatTextBox_AoPerderFoco(object sender, EventArgs e) { TextBox box = sender as TextBox; if (!FormTextoFormat.ValidaEmail(box.Text)) { FormMessage.ShowMessegeWarning("E-mail inválido, campo será definico como \" [email protected]\""); box.Text = "*****@*****.**"; } }
private void TextBoxVenda_TextChanged(object sender, EventArgs e) { FormTextoFormat.MoedaFormat(textBoxVenda); decimal comp = Convert.ToDecimal(textBoxCompra.Text); decimal vend = Convert.ToDecimal(textBoxVenda.Text); decimal liq = vend - comp; if (liq > 0) { textBoxMargem.Text = ((liq / comp) * 100).ToString("F1"); textBoxLiquido.Text = liq.ToString("F2"); } }
private static void FormatTextBox_AoPerderFoco(object sender, EventArgs e) { TextBox box = sender as TextBox; if (box.Name == "textBoxEmail") { //int ponto = box.Text.IndexOf('.'); //int arroba = box.Text.IndexOf('@'); if (FormTextoFormat.ValidaEmail(box.Text)) { FormMessage.ShowMessegeWarning("E-mail inválido, campo será definico como \" [email protected]\""); box.Text = "*****@*****.**"; } } }
private bool PreencherEmail() { infoEmail = new EmailInfo { emailTo = string.IsNullOrEmpty(textBoxPara.Text) ? new string[0] : textBoxPara.Text.Split(';'), emailAssunto = textBoxAssunto.Text, emailCC = string.IsNullOrEmpty(textBoxCC.Text) ? new string[0] : textBoxCC.Text.Split(';'), emailCCo = string.IsNullOrEmpty(textBoxCCo.Text) ? new string[0] : textBoxCCo.Text.Split(';'), emailMessage = textBoxMessage.Text }; List <string> ValidarEmail = new List <string>(); ValidarEmail.AddRange(infoEmail.emailTo.ToArray()); ValidarEmail.AddRange(infoEmail.emailCC.ToArray()); ValidarEmail.AddRange(infoEmail.emailCCo.ToArray()); foreach (string item in ValidarEmail) { if (!FormTextoFormat.ValidaEmail(item)) { return(false); } } if (listBoxAnexo.Items.Count > 0) { foreach (string item in listBoxAnexo.Items) { listAnexo.Add(item); } infoEmail.emailAnexo = listAnexo.ToArray(); } else { infoEmail.emailAnexo = new string[0]; } return(true); }
private void textBoxValor_TextChanged(object sender, EventArgs e) { FormTextoFormat.MoedaFormat((TextBox)sender); }
private void textBoxQuant_TextChanged(object sender, EventArgs e) { FormTextoFormat.Format3casasdecimais((TextBox)sender); }
private void textBoxPorcento_TextChanged(object sender, EventArgs e) { labelComissao.Text = ""; FormTextoFormat.MoedaFormat((TextBox)sender); }
private void TextBoxCompra_TextChanged(object sender, EventArgs e) { FormTextoFormat.MoedaFormat(textBoxCompra); }
private void textBoxDesconto_TextChanged(object sender, EventArgs e) { FormTextoFormat.MoedaFormat((TextBox)sender); Calcular(); }