Advertisement
Guest User

Untitled

a guest
Dec 27th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. private void button1_Click(object sender, EventArgs e)
  2. {
  3. string ime = textBox1.Text;
  4. string prezime = textBox2.Text;
  5. DateTime datumrodjenja = dateTimePicker1.Value;
  6. string maticni = maskedTextBox1.Text;
  7. string username = textBox3.Text;
  8. string pass = textBox4.Text;
  9. int sifra = Convert.ToInt32(textBox5.Text);
  10. bool mjesecna = false, godisnja = false;
  11. if (radioButton3.Checked) { mjesecna = true; godisnja = false; }
  12. else if (radioButton4.Checked) { mjesecna = false; godisnja = true; }
  13. DateTime datumuclanjenja = dateTimePicker2.Value;
  14.  
  15. try
  16. {
  17.  
  18. if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" || textBox5.Text == "" || maskedTextBox1.Text == "")
  19. {
  20. throw new Exception();
  21. }
  22. if (radioButton5.Checked)
  23. {
  24. ObicniClan clan = new ObicniClan(ime, prezime, maticni, datumrodjenja, sifra, mjesecna, godisnja, "", datumuclanjenja, username, pass);
  25. biblioteka.RegistrujClana(clan, datumuclanjenja);
  26.  
  27. toolStripStatusLabel1.Visible = true;
  28. toolStripStatusLabel1.Text = "Uspješno ste registrovali člana!";
  29. }
  30. else if (radioButton8.Checked)
  31. {
  32. groupBox5.Visible = true;
  33. label10.Visible = true;
  34. textBox6.Visible = true;
  35. label10.Text = "Šifra profesora: ";
  36. int sifraprof = Convert.ToInt32(textBox6.Text);
  37. Profesori clan = new Profesori(ime, prezime, maticni, datumrodjenja, sifra, mjesecna, godisnja, "", datumuclanjenja, sifraprof, username, pass);
  38. biblioteka.RegistrujClana(clan, datumuclanjenja);
  39. toolStripStatusLabel1.Visible = true;
  40. toolStripStatusLabel1.Text = "Uspješno ste registrovali člana!";
  41.  
  42. }
  43. else if (radioButton6.Checked)
  44. {
  45. groupBox5.Visible = true;
  46. label10.Visible = true;
  47. textBox6.Visible = true;
  48. label10.Text = "Indeks studenta: ";
  49. int indeks = Convert.ToInt32(textBox6.Text);
  50. BoE clan = new BoE(ime, prezime, maticni, datumrodjenja, sifra, mjesecna, godisnja, "", datumuclanjenja, indeks, username, pass);
  51. biblioteka.RegistrujClana(clan, datumuclanjenja);
  52. toolStripStatusLabel1.Visible = true;
  53. toolStripStatusLabel1.Text = "Uspješno ste registrovali člana!";
  54. }
  55. else if (radioButton7.Checked)
  56. {
  57.  
  58. int indeks = Convert.ToInt32(textBox6.Text);
  59. MoE clan = new MoE(ime, prezime, maticni, datumrodjenja, sifra, mjesecna, godisnja, "", datumuclanjenja, indeks, username, pass);
  60. biblioteka.RegistrujClana(clan, datumuclanjenja);
  61. toolStripStatusLabel1.Visible = true;
  62. toolStripStatusLabel1.Text = "Uspješno ste registrovali člana!";
  63. }
  64. }
  65. catch
  66. {
  67. toolStripStatusLabel1.Text = "Registracija nije uspjela!";
  68.  
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement