public NewPatientPage()
        {
            InitializeComponent();
            BindingContext = new NewPatientViewModel(Navigation);

            NavigationPage.SetHasNavigationBar(this, false);  // Hide nav bar
        }
 public NewPatient()
 {
     newPatientViewModel            = new NewPatientViewModel();
     newPatientViewModel.navigation = Navigation;
     InitializeComponent();
     BindingContext = newPatientViewModel;
 }
Example #3
0
        public IActionResult Update(NewPatientViewModel patient)
        {
            ModelState.Remove("PatientID");
            var newPatient = _mapper.Map <Patient>(patient);

            if (ModelState.IsValid)
            {
                try
                {
                    _dbContext.Patients.Update(newPatient);
                    _dbContext.SaveChanges();
                    return(Ok());
                }
                catch (Exception e)
                {
                    ModelState.AddModelError("PatientID", "Please verify if a patient with this RM2 Number or NHS Number already exists in the database");
                    var errors = ModelStateHelper.Errors(ModelState);
                    return(Json(new { errors = errors }));
                }
            }
            else
            {
                var errors = ModelStateHelper.Errors(ModelState);
                return(Json(new{ errors = errors }));
            }
        }
Example #4
0
        public ActionResult Save(Patient patient)
        {
            if (!ModelState.IsValid)
            {
                var viewModel = new NewPatientViewModel
                {
                    Patient     = patient,
                    Lateralites = _context.Lateralites.ToList()
                };

                return(View("AjoutPatient", viewModel));
            }

            if (patient.Id == 0)
            {
                _context.Patients.Add(patient);
            }
            else
            {
                var patientInDb = _context.Patients.Include(a => a.Adresse).Single(p => p.Id == patient.Id);

                Mapper.Map(patientInDb, patient);
            }
            _context.SaveChanges();
            return(RedirectToAction("Index", "Patients"));
        }
Example #5
0
        public NewPatient()
        {
            InitializeComponent();

            this.NewPatientViewModel = new NewPatientViewModel();
            this.BindingContext      = NewPatientViewModel;

            this.dataNascimentoPicker.Date        = DateTime.Now;
            this.txtNumero.Text                   = string.Empty;
            this.dataNascimentoPicker.MaximumDate = DateTime.Now;

            if (Device.Idiom == TargetIdiom.Phone)
            {
                mainImage.HeightRequest = 40;
                MainLabel.FontSize      = 20;

                txtNome.WidthRequest = 250;
                txtNome.FontSize     = 15;

                lblDataNascimento.FontSize    = 15;
                dataNascimentoPicker.FontSize = 15;

                txtCpf.WidthRequest = 250;
                txtCpf.FontSize     = 15;

                pickerGenero.WidthRequest = 250;
                pickerGenero.FontSize     = 15;

                txtEmail.WidthRequest = 250;
                txtEmail.FontSize     = 15;

                txtPhone.WidthRequest = 250;
                txtPhone.FontSize     = 15;

                enderecoStack.Margin = new Thickness(50, 10, 20, 10);

                TxtCep.WidthRequest = 250;

                lblUf.FontSize     = 13;
                lblUf.Margin       = new Thickness(0, 0, 10, 0);
                txtUf.WidthRequest = 250;

                txtCidade.WidthRequest = 230;
                txtBairro.WidthRequest = 230;
                txtRua.WidthRequest    = 250;
                txtNumero.WidthRequest = 230;

                BtnSalvar.WidthRequest  = 150;
                BtnSalvar.HeightRequest = 30;
                BtnSalvar.FontSize      = 8;
                BtnSalvar.CornerRadius  = 3;

                BtnCancelar.WidthRequest  = 150;
                BtnCancelar.HeightRequest = 30;
                BtnCancelar.FontSize      = 8;
                BtnCancelar.CornerRadius  = 3;
            }
        }
        static ViewModelLocator()
        {
            var dialogService      = new DialogService();
            var patientDataService = new PatientDataService();

            MainWindowViewModel        = new MainWindowViewModel(dialogService, patientDataService);
            PatientDetailViewViewModel = new PatientDetailViewViewModel(patientDataService);
            NewPatientViewModel        = new NewPatientViewModel(dialogService, patientDataService);
        }
Example #7
0
        public ActionResult AjoutPatient()
        {
            var lateralite = _context.Lateralites.ToList();

            var viewModel = new NewPatientViewModel
            {
                Patient     = new Patient(),
                Lateralites = lateralite
            };

            return(View(viewModel));
        }
        public void Save()
        {
            NewPatientViewModel data = View.GetFormData();

            try
            {
                using (var proxy = _patientService.CreateChannel())
                {
                    proxy.AddPatient(data);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #9
0
        public ActionResult EditerPatient(int id)
        {
            var patient = _context.Patients.Include(a => a.Adresse).SingleOrDefault(p => p.Id == id);

            if (patient == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new NewPatientViewModel
            {
                Patient     = patient,
                Lateralites = _context.Lateralites.ToList()
            };

            return(View(viewModel));
        }
Example #10
0
 public void AddPatient(NewPatientViewModel data)
 {
     throw new NotImplementedException();
 }
Example #11
0
        public PacienteDetails(Domain.Entities.Paciente paciente)
        {
            InitializeComponent();

            this.NewPatientViewModel = new NewPatientViewModel();
            this.NewPatientViewModel = Mapper.Map <NewPatientViewModel>(paciente);
            this.BindingContext      = NewPatientViewModel;

            if (Device.Idiom == TargetIdiom.Phone)
            {
                txtNome.WidthRequest = 200;
                txtNome.FontSize     = 15;

                lblDataNascimento.FontSize    = 15;
                dataNascimentoPicker.FontSize = 15;

                txtCpf.WidthRequest = 200;
                txtCpf.FontSize     = 15;

                pickerGenero.WidthRequest = 200;
                pickerGenero.FontSize     = 15;

                txtEmail.WidthRequest = 200;
                txtEmail.FontSize     = 15;

                txtPhone.WidthRequest = 200;
                txtPhone.FontSize     = 15;

                enderecoStack.Margin = new Thickness(50, 10, 20, 10);

                lblCep.FontSize     = 13;
                TxtCep.WidthRequest = 200;
                TxtCep.FontSize     = 13;

                lblUf.FontSize     = 13;
                lblUf.Margin       = new Thickness(0, 0, 10, 0);
                txtUf.WidthRequest = 200;

                lblCidade.FontSize     = 13;
                txtCidade.WidthRequest = 200;
                txtCidade.FontSize     = 13;

                lblBairro.FontSize     = 13;
                txtBairro.WidthRequest = 200;
                txtBairro.FontSize     = 13;

                txtRua.WidthRequest = 200;
                txtRua.FontSize     = 12;
                txtRua.AnchorX      = -3;
                txtRua.AnchorY      = 0;

                lblNumero.FontSize     = 13;
                txtNumero.WidthRequest = 200;
                txtNumero.FontSize     = 13;

                BtnSalvar.WidthRequest  = 150;
                BtnSalvar.HeightRequest = 30;
                BtnSalvar.FontSize      = 8;
                BtnSalvar.CornerRadius  = 3;

                BtnEditar.WidthRequest  = 150;
                BtnEditar.HeightRequest = 30;
                BtnEditar.FontSize      = 8;
                BtnEditar.CornerRadius  = 3;

                BtnCancelar.WidthRequest  = 150;
                BtnCancelar.HeightRequest = 30;
                BtnCancelar.FontSize      = 8;
                BtnCancelar.CornerRadius  = 3;
            }
        }