Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. private void FrmCliente_Load(object sender, EventArgs e)
  2.  
  3. {
  4. if (mskCPF.Text != "")
  5. {
  6. btnvalidacliente.Enabled = false;
  7. btnvalidacliente.Enabled = true;
  8.  
  9. }
  10. }
  11. private void nome_Click(object sender, EventArgs e)
  12. {
  13. // nao consegui alguem pode me ajudar
  14. }
  15.  
  16.  
  17.  
  18. public static bool cpf_Click(string cpf, EventArgs e)
  19.  
  20. {
  21. int[] multiplicador1 = new int[9] { 10, 9, 8, 7, 6, 5, 4, 3, 2 };
  22. int[] multiplicador2 = new int[10] { 11, 10, 9, 8, 7, 6, 5, 4, 3, 2 };
  23. string tempCpf;
  24. string digito;
  25. int soma;
  26. int resto;
  27. cpf = cpf.Trim();
  28. cpf = cpf.Replace(".", "").Replace("-", "");
  29. if (cpf.Length != 11)
  30. return false;
  31. tempCpf = cpf.Substring(0, 9);
  32. soma = 0;
  33. for (int i = 0; i < 9; i++)
  34. soma += int.Parse(tempCpf[i].ToString()) * multiplicador1[i];
  35. resto = soma % 11;
  36. if (resto < 2)
  37. resto = 0;
  38. else
  39. resto = 11 - resto;
  40. digito = resto.ToString();
  41. tempCpf = tempCpf + digito;
  42. soma = 0;
  43. for (int i = 0; i < 10; i++)
  44. soma += int.Parse(tempCpf[i].ToString()) * multiplicador2[i];
  45. resto = soma % 11;
  46. if (resto < 2)
  47. resto = 0;
  48. else
  49. resto = 11 - resto;
  50. digito = digito + resto.ToString();
  51. return cpf.EndsWith(digito);
  52. }
  53.  
  54. private void email_Click(object sender, EventArgs e)
  55. {
  56. // nao consegui alguem pode me ajudar
  57. }
  58.  
  59. private void datadeentrada_Click(object sender, EventArgs e)
  60. {
  61. // nao consegui alguem pode me ajudar
  62. }
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement