Ejemplo n.º 1
0
        private void saveAlertMedicamento(object sender, EventArgs e)
        {
            // Cargamos los datos
            _medicamento.farmaco          = _edtFarmaco.Text;
            _medicamento.viaOral          = _radio1.Checked == true ? true : false;
            _medicamento.viaSubcutanea    = _radio2.Checked == true ? true : false;
            _medicamento.viaIntramuscular = _radio3.Checked == true ? true : false;
            _medicamento.viaIntravenoso   = _radio4.Checked == true ? true : false;
            _medicamento.viaInhalatoria   = _radio5.Checked == true ? true : false;
            _medicamento.confirmar        = false; // Por defecto es false

            // Validacion
            if (Validate())
            {
                DateTime now        = DateTime.Now;                                                     // Fecha y hora actual
                DateTime selectedDT = Convert.ToDateTime(_medicamento.fecha + " " + _medicamento.hora); // Fecha y hora seleccionado

                // No debe aplicarse en la fecha pasada. Debe ser mayor a la fecha y hora seleccionada
                if (selectedDT > now)
                {
                    _medicamentoService = new MedicamentoService();              // Instanciamos
                    _medicamentoService.addMedicamento(_paciente, _medicamento); // Insertar el registro en la base de datos
                    AlarmMedicamento(_medicamento);

                    // Mensaje
                    Toast.MakeText(this, "Se agregó: " + _medicamento.farmaco, ToastLength.Short).Show();

                    // Acción redireccionar a otra activity
                    Intent myIntent = new Intent(this, typeof(MedicamentoList));
                    myIntent.PutExtra("KEY_ID", _paciente.Id); // Pasamos el Id Paciente
                    StartActivity(myIntent);
                }
                else
                {
                    Toast.MakeText(this, "Esta es una selección no válida de fecha y hora", ToastLength.Short).Show();
                }
            }
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.PacienteBorrar);

            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            // Una marca atrás en el icono en ActionBar
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            _txtNroHistoria   = FindViewById <TextView>(Resource.Id.txtNroHistoria);
            _txtNombre        = FindViewById <TextView>(Resource.Id.txtNombre);
            _txtApellido      = FindViewById <TextView>(Resource.Id.txtApellido);
            _txtEdad          = FindViewById <TextView>(Resource.Id.txtEdad);
            _txtGenero        = FindViewById <TextView>(Resource.Id.txtGenero);
            _txtNroHabitacion = FindViewById <TextView>(Resource.Id.txtNroHabit);
            _txtNroCama       = FindViewById <TextView>(Resource.Id.txtNroCama);
            _btnRemove        = FindViewById <Button>(Resource.Id.btnRemove);

            // Recibimos el Id Paciente
            var id = Intent.Extras.GetInt(KEY_ID);

            ViewPacienteDetail(id);

            // Instanciamos
            _listaMedicamentos  = new List <Medicamento>();
            _medicamentoService = new MedicamentoService();

            // Click Eliminar
            _btnRemove.Click += delegate
            {
                RemovePaciente(id);
            };
        }
Ejemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.MedicamentoEdit);

            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            // Una marca atrás en el icono en ActionBar
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            _edtFarmaco = FindViewById <EditText>(Resource.Id.edtFarmaco); // Farmaco
            _edtDosis   = FindViewById <EditText>(Resource.Id.edtDosis);   // Dosis
            _radio1     = FindViewById <RadioButton>(Resource.Id.radio1);  // Oral
            _radio2     = FindViewById <RadioButton>(Resource.Id.radio2);  // Subcutanea
            _radio3     = FindViewById <RadioButton>(Resource.Id.radio3);  // Intramuscular
            _radio4     = FindViewById <RadioButton>(Resource.Id.radio4);  // Intravenoso
            _radio5     = FindViewById <RadioButton>(Resource.Id.radio5);  // Inhalatoria
            _edtFecha   = FindViewById <EditText>(Resource.Id.edtFecha);   // Fecha
            _edtHora    = FindViewById <EditText>(Resource.Id.edtHora);    // Hora
            _btnEdit    = FindViewById <Button>(Resource.Id.btnEdit);      // Botón

            // Click Fecha
            _edtFecha.Click += delegate
            {
                DatePickerFragment frag = DatePickerFragment.NewInstance(delegate(DateTime time)
                {
                    _edtFecha.Text     = time.ToShortDateString(); // Mostrar la fecha seleccionada en el edittext
                    _medicamento.fecha = _edtFecha.Text;           // Cargamos la fecha
                });
                frag.Show(FragmentManager, DatePickerFragment.TAG);
            };

            // Click Hora
            _edtHora.Click += delegate
            {
                TimePickerFragment frag = TimePickerFragment.NewInstance(delegate(DateTime time)
                {
                    _edtHora.Text     = time.ToShortTimeString(); // Mostrar la hora seleccionada en el edittext
                    _medicamento.hora = _edtHora.Text;            // Cargamos la hora
                });

                frag.Show(FragmentManager, TimePickerFragment.TAG);
            };


            // Recibimos el Id Medicamento
            var id = Intent.Extras.GetInt(KEY_ID);

            // Instanciamos
            _medicamento        = new Medicamento();
            _medicamentoService = new MedicamentoService();

            // Consultamos la lista medicamentos de un paciente por Id
            _medicamento = _medicamentoService.getMedicamentoPacienteById(id);

            // Mostramos los datos
            _edtFarmaco.Text = _medicamento.farmaco;
            _edtDosis.Text   = _medicamento.dosis.ToString(); //ToString: convierte de entero a string
            if (_medicamento.viaOral == true)
            {
                _radio1.Checked = true;
            }
            if (_medicamento.viaSubcutanea == true)
            {
                _radio2.Checked = true;
            }
            if (_medicamento.viaIntramuscular == true)
            {
                _radio3.Checked = true;
            }
            if (_medicamento.viaIntravenoso == true)
            {
                _radio4.Checked = true;
            }
            if (_medicamento.viaInhalatoria == true)
            {
                _radio5.Checked = true;
            }
            _edtFecha.Text = _medicamento.fecha;
            _edtHora.Text  = _medicamento.hora;

            // Click Actualizar
            _btnEdit.Click += updateAlertMedicamento;
        }
Ejemplo n.º 4
0
 public MedicamentoFragment()
 {
     // Instanciamos
     _medicamentoList    = new List <Medicamento>();
     _medicamentoService = new MedicamentoService();
 }
Ejemplo n.º 5
0
 public UsuarioController(MedicamentoService @object, IMapper mapper)
 {
     this.@object = @object;
     this.mapper  = mapper;
 }
 public RecordMedicamentoFragment()
 {
     // Instanciamos
     _listMedicamentos   = new List <Medicamento>();
     _medicamentoService = new MedicamentoService();
 }
Ejemplo n.º 7
0
 public MedicamentosController()
 {
     EntityService = new MedicamentoService();
     Title         = "Medicamentos";
 }
 public MedicamentoController(MedicamentoService medicamentoService)
 {
     _medicamentoService = medicamentoService;
 }
Ejemplo n.º 9
0
        public void DeleteMedicamento([FromBody] int id)
        {
            MedicamentoService con = new MedicamentoService();

            con.DeleteMedicamento(id);
        }
Ejemplo n.º 10
0
        public IHttpActionResult GetLastMedicamentoId()
        {
            MedicamentoService con = new MedicamentoService();

            return(Ok(con.GetLastMedicamentoId()));
        }
Ejemplo n.º 11
0
        public IHttpActionResult GetMedicamentoID(string nombre)
        {
            MedicamentoService con = new MedicamentoService();

            return(Ok(con.GetMedicamentoID(nombre)));
        }
Ejemplo n.º 12
0
        public IHttpActionResult GetAllNombresMedicamentosxSucursal(int id)
        {
            MedicamentoService con = new MedicamentoService();

            return(Ok(con.GetAllNombresMedicamentosxSucursal(id)));
        }
Ejemplo n.º 13
0
        public IHttpActionResult GetMedicamentosxRelacion(int idm, int ids, int idc)
        {
            MedicamentoService con = new MedicamentoService();

            return(Ok(con.GetMedicamentosxRelacion(idm, ids, idc)));
        }
Ejemplo n.º 14
0
        public void PostMedicamento([FromBody] Medicamento medicamento)
        {
            MedicamentoService con = new MedicamentoService();

            con.PostMedicamento(medicamento);
        }
Ejemplo n.º 15
0
 public FormRegistroMedicamentos()
 {
     InitializeComponent();
     medicamentoService = new MedicamentoService(ConfigConnection.connectionString);
     MapearConsultar(dtgvMedicamentos);
 }