NewPatientForm.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. using FietsLibrary;
  11. using FietsLibrary.JSONObjecten;
  12. namespace FietsClient.Forms
  13. {
  14. public partial class NewPatientForm : Form
  15. {
  16. private TcpConnection connection;
  17. public NewPatientForm(TcpConnection tcpConnections)
  18. {
  19. InitializeComponent();
  20. connection = tcpConnections;
  21. }
  22. private void button1_Click(object sender, EventArgs e)
  23. {
  24. int age;
  25. int weight;
  26. if (!int.TryParse(textBox2.Text, out age) || !int.TryParse(textBox4.Text, out weight))
  27. {
  28. MessageBox.Show("Leeftijd en Gewicht moeten numeriek zijn.");
  29. }
  30. else
  31. {
  32. bool gender;
  33. if (comboBox1.SelectedText == "Man")
  34. {
  35. gender = true;
  36. }
  37. else
  38. {
  39. gender = false;
  40. }
  41. User user = new User(textBox1.Text, passBox.Text, age, gender,
  42. weight, false);
  43. connection.SendNewPatient(user);
  44. }
  45. }
  46. }
  47. }