Example #1
0
 public MainWindow()
 {
     InitializeComponent();
     _authService    = new AuthServiceClient();
     _doctorService  = new DoctorServiceClient(new InstanceContext(new DoctorHandler(null)));
     _patientService = new PatientServiceClient(new InstanceContext(new PatientHandler()));
 }
        public void FillTable()
        {
            List<Doctor> docList = new DoctorServiceClient().GetAllDoctors().ToList();

            for (int i = 0; i < docList.Count; i++)
            {
                dataGridView1.Rows.Add(docList[i].id, docList[i].firstName, docList[i].lastName,
                    docList[i].city, docList[i].street + " " + docList[i].streetNr, docList[i].phoneNr,
                    docList[i].zip, docList[i].specialty);
            }
        }
 private void button3_Click(object sender, EventArgs e)
 {
     string message = "";
     var client = new DoctorServiceClient();
     var doctor = client.GetDoctor(docId);
     var ret = client.DeleteDoctor(ref doctor, ref message);
     if(!ret)
     {
         new Thread(() => new ErrorWindow(message).ShowDialog()).Start();
     }
     else
     {
         dataGridView1.Rows.Clear();
         FillTable();
     }
 }
Example #4
0
        public DoctorWindow(DoctorDto doctor)
        {
            InitializeComponent();

            _doctor       = doctor;
            VisitRequests = new ObservableCollection <VisitRequestDto>();

            var context = new InstanceContext(new DoctorHandler(this));

            _server = new DoctorServiceClient(context);

            InitializeRequests();

            VisitRequestsListBox.ItemsSource = VisitRequests;

            _server.LogInDoctor(_doctor);
        }
Example #5
0
 private void signin()
 {
     string message = null;
     if (textBox1.TextLength > 3 || textBox2.TextLength > 3)
     {
         var passwordClient = new PasswordServiceClient();
         string[] idAndType = passwordClient.authenticatePerson(textBox1.Text, textBox2.Text, ref message);
         if (idAndType != null)
         {
             int id = -1;
             Int32.TryParse(idAndType[0], out id);
             if (idAndType[1].Equals("0"))
             {
                 Admin adminClient = new AdminServiceClient().GetAdmin(id);
                 adminClient.sessionID = idAndType[2];
                 new Thread(() => new AdminMenu().ShowDialog()).Start();
                 Dispose();
             }
             else if(idAndType[1].Equals("1"))
             {
                 var doctorClient = new DoctorServiceClient().GetDoctor(id);
                 doctorClient.sessionID = idAndType[2];
                 new Thread(() => new DoctorMenu(doctorClient).ShowDialog()).Start();
                 Dispose();
             }
             else
                 new Thread(() => new ErrorWindow("Wrong username or password").ShowDialog()).Start();
         }
         else
         {
             new Thread(() => new ErrorWindow("Wrong username or password").ShowDialog()).Start();
         }
     }
     else
     {
         new Thread(() => new ErrorWindow("Incorrect length").ShowDialog()).Start();
     }
 }
 private void FillTabe(DoctorServiceRef.Doctor doc, int choose)
 {
     string[] columns = new string[] { "ID", "First name", "Last name", "City", "Street", "Phone", "ZIP", "Date of birth" };
     for (int i = 0; i < columns.Length; i++)
         dataGridView1.Columns.Add(i.ToString(), columns[i]);
     if (choose == 1)
     {
         string message = null;
         DoctorServiceRef.Doctor doctor = new DoctorServiceClient().GetAppointmentsHistoryDoctor(doc.id, ref message);
         if (doctor != null)
         {
             List<DoctorServiceRef.Patient> patientList = new List<DoctorServiceRef.Patient>();
             foreach (var appointment in doctor.appointmentsHistory)
                 patientList.Add(appointment.patient);
             patientList = patientList.GroupBy(p => p.id).Select(g => g.First()).ToList();
             for (int i = 0; i < patientList.Count; i++)
             {
                 dataGridView1.Rows.Add(patientList[i].id, patientList[i].firstName, patientList[i].lastName,
                     patientList[i].city, patientList[i].street + " " + patientList[i].streetNr, patientList[i].phoneNr,
                     patientList[i].zip, patientList[i].dateOfBirth.ToShortDateString());
             }
         }
         else
             new Thread(() => new ErrorWindow(message).ShowDialog()).Start();
     }
     else
     {
         List<PatientService.Patient> patientList = new PatientServiceClient().GetAllpatients().ToList();
         for (int i = 0; i < patientList.Count; i++)
         {
             dataGridView1.Rows.Add(patientList[i].id, patientList[i].firstName, patientList[i].lastName,
                 patientList[i].city, patientList[i].street + " " + patientList[i].streetNr, patientList[i].phoneNr,
                 patientList[i].zip, patientList[i].dateOfBirth.ToShortDateString());
         }
     }
 }