public static bool AddPatient(Patient patient)
        {
            ServicePatientClient servicePatient = new ServicePatientClient();

            try
            {
                return servicePatient.AddPatient(patient);
            }
            catch (Exception)
            {
                return false;
            }
        }
Exemplo n.º 2
0
        private void addPatient()
        {
            if (!string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
            {
                Patient patient = new Patient();
                patient.Birthday     = _dateInput ?? DateTime.Now;
                patient.Firstname    = _firstnameInput;
                patient.Name         = _nameInput;
                patient.Observations = null;

                ServicePatientClient service = new ServicePatientClient();

                if (service.AddPatient(patient))
                {
                    View.MainWindow mainwindow = (View.MainWindow)Application.Current.MainWindow;

                    View.Patients view             = new colle_tMedecine.View.Patients();
                    ViewModel.PatientsViewModel vm = new colle_tMedecine.ViewModel.PatientsViewModel();
                    view.DataContext = vm;
                    mainwindow.contentcontrol.Content = view;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
                {
                    ErrorMessage = _typeErrorMessage[0];
                }
                else if (!string.IsNullOrEmpty(FirstnameInput) && string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
                {
                    ErrorMessage = _typeErrorMessage[1];
                }
                else if (!string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && string.IsNullOrEmpty(DateInput.ToString()))
                {
                    ErrorMessage = _typeErrorMessage[2];
                }
                else
                {
                    ErrorMessage = _typeErrorMessage[3];
                }
                ShowConnectError = 1;
                ShowConnectError = 0;
            }
        }
Exemplo n.º 3
0
        public static bool CreatePatient(Model.Patient patient)
        {
            ServicePatientClient servicePatient = new ServicePatientClient();
            bool result = false;

            try
            {
                ServicePatient.Patient patientS = new ServicePatient.Patient()
                {
                    Birthday     = patient.birthday,
                    Firstname    = patient.firstname,
                    Name         = patient.name,
                    Observations = null
                };
                result = servicePatient.AddPatient(patientS);
            }
            catch (Exception) { }
            finally { servicePatient.Close(); }
            return(result);
        }
        private void addPatient()
        {
            if (!string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
            {
                Patient patient = new Patient();
                patient.Birthday = _dateInput ?? DateTime.Now;
                patient.Firstname = _firstnameInput;
                patient.Name = _nameInput;
                patient.Observations = null;

                ServicePatientClient service = new ServicePatientClient();

                if (service.AddPatient(patient))
                {
                    View.MainWindow mainwindow = (View.MainWindow)Application.Current.MainWindow;

                    View.Patients view = new colle_tMedecine.View.Patients();
                    ViewModel.PatientsViewModel vm = new colle_tMedecine.ViewModel.PatientsViewModel();
                    view.DataContext = vm;
                    mainwindow.contentcontrol.Content = view;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
                    ErrorMessage = _typeErrorMessage[0];
                else if (!string.IsNullOrEmpty(FirstnameInput) && string.IsNullOrEmpty(NameInput) && !string.IsNullOrEmpty(DateInput.ToString()))
                    ErrorMessage = _typeErrorMessage[1];
                else if (!string.IsNullOrEmpty(FirstnameInput) && !string.IsNullOrEmpty(NameInput) && string.IsNullOrEmpty(DateInput.ToString()))
                    ErrorMessage = _typeErrorMessage[2];
                else
                    ErrorMessage = _typeErrorMessage[3];
                ShowConnectError = 1;
                ShowConnectError = 0;
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Call WCF AddPatient function
 /// </summary>
 /// <param name="patient"></param>
 /// <returns></returns>
 public bool AddPatient(Patient patient)
 {
     return(_service.AddPatient(patient));
 }