NewPatientForm.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace FietsClient.Forms
  11. {
  12. public partial class NewPatientForm : Form
  13. {
  14. private TcpConnection connection;
  15. public NewPatientForm(TcpConnection tcpConnections)
  16. {
  17. InitializeComponent();
  18. connection = tcpConnections;
  19. }
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. int age;
  23. int weight;
  24. if (!int.TryParse(textBox2.Text, out age) || !int.TryParse(textBox4.Text, out weight))
  25. {
  26. MessageBox.Show("Leeftijd en Gewicht moeten numeriek zijn.");
  27. }
  28. else
  29. {
  30. bool gender;
  31. if (comboBox1.SelectedText == "Man")
  32. {
  33. gender = true;
  34. }
  35. else
  36. {
  37. gender = false;
  38. }
  39. User user = new User(textBox1.Text, passBox.Text, age, gender,
  40. weight, false);
  41. connection.SendNewPatient(user);
  42. }
  43. }
  44. }
  45. }