예제 #1
0
 public MainWindow()
 {
     InitializeComponent();
     _authService    = new AuthServiceClient();
     _doctorService  = new DoctorServiceClient(new InstanceContext(new DoctorHandler(null)));
     _patientService = new PatientServiceClient(new InstanceContext(new PatientHandler()));
 }
예제 #2
0
        private void BtnRegister_Click(object sender, EventArgs e)
        {
            var proxy   = new PatientServiceClient();
            var patient = new Patient
            {
                BillAmount  = double.Parse(cmbAmount.Text),
                PatientName = textBox1.Text,
                ContactNo   = long.Parse(textBox2.Text),
                DateOfVisit = DateTime.Now
            };

            try
            {
                proxy.AddNewPatient(patient);
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                if (ex.InnerException != null)
                {
                    error += $"\n{ex.InnerException.Message}";
                }
                MessageBox.Show(error);
            }
        }
예제 #3
0
        public PatientWindow(PatientDto patient)
        {
            InitializeComponent();

            _patient        = patient;
            _patientService = new PatientServiceClient(new InstanceContext(new PatientHandler()));
        }
예제 #4
0
        private void WCFClient_Load(object sender, EventArgs e)
        {
            var proxy = new PatientServiceClient();
            var data  = proxy.GetAllPatients().ToList();

            lstNames.DataSource    = data;
            lstNames.DisplayMember = "PatientName";
            lstNames.ValueMember   = "PatientID";
        }
예제 #5
0
        public string IsDodExis(string billingNumber)
        {
            DateTime?dod = new PatientServiceClient().GetPatientDodByOrder(billingNumber);

            if (!dod.HasValue)
            {
                return(string.Empty);
            }
            else
            {
                return("Editing exeption: Patient is dead!");
            }
        }
예제 #6
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     string message = null;
     int id = 0;
     Int32.TryParse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(), out id);
     PatientService.Patient patient = new PatientServiceClient().GetAppointmentsHistoryPatient(id, ref message);
     if (patient != null)
     {
         new Thread(() => new PatientHistory(patient).ShowDialog()).Start();
     }
     else
         new Thread(() => new ErrorWindow(message).ShowDialog()).Start();
 }
예제 #7
0
        private void btnStartSearch_Click(object sender, EventArgs e)
        {
            var idOrName = txtNameOrID.Text.Trim();

            if (!string.IsNullOrEmpty(idOrName) && !string.IsNullOrWhiteSpace(idOrName))
            {
                List <PatientDataModel> patientList = new List <PatientDataModel>();

                PatientServiceClient client = new PatientServiceClient();

                var result = client.GetPatientsAsync(idOrName).Result;

                client.Close();

                patientList.AddRange(result);

                dgvPatientList.AutoGenerateColumns = false;
                dgvPatientList.DataSource          = patientList;
            }
        }
예제 #8
0
 protected void LogIn(object sender, EventArgs e)
 {
     Labell.Visible = false;
     string message = null;
     var passwordClient = new PasswordServiceClient();
     string[] idAndType = passwordClient.authenticatePerson(Loginn.Text, Password.Text, ref message);
     if (idAndType != null && idAndType[1].Equals("2"))
     {
         int id = 0;
         Int32.TryParse(idAndType[0], out id);
         Patient patientClient = new PatientServiceClient().GetPatient(id);
         patientClient.sessionID = idAndType[2];
         Session["patientObj"] = patientClient;
         Response.Redirect("~/Default.aspx");
     }
     else
     {
         Labell.Visible = true;
         Labell.Text = "Try once again";
     }
 }
예제 #9
0
 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());
         }
     }
 }
예제 #10
0
 public PatientServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(PatientServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
예제 #11
0
 public PatientServiceClient(EndpointConfiguration endpointConfiguration) :
     base(PatientServiceClient.GetBindingForEndpoint(endpointConfiguration), PatientServiceClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
예제 #12
0
 public PatientServiceClient() :
     base(PatientServiceClient.GetDefaultBinding(), PatientServiceClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IPatientService.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
예제 #13
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(PatientServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_IPatientService));
 }
예제 #14
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(PatientServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_IPatientService));
 }
예제 #15
0
 public string IsDodExis(string billingNumber)
 {
     DateTime? dod = new PatientServiceClient().GetPatientDodByOrder(billingNumber);
     if (!dod.HasValue)
     {
         return string.Empty;
     }
     else
     {
         return "Editing exeption: Patient is dead!";
     }
 }