예제 #1
0
 private void cargarEstudiosPaciente(int v)
 {
     try
     {
         EstudioRequest request = new EstudioRequest();
         request.mdlUser       = Usuario;
         request.intPacienteID = v;
         List <clsEstudioCita> response = new List <clsEstudioCita>();
         response = RisService.getEstudiosPaciente(request);
         grvEstudios.DataSource = null;
         if (response != null)
         {
             if (response.Count > 0)
             {
                 lblNombrePaciente.Text = response.First().vchNombrePaciente;
                 grvEstudios.DataSource = response;
             }
         }
         grvEstudios.DataBind();
     }
     catch (Exception ecE)
     {
         Log.EscribeLog("Existe un error en cargarEstudiosPaciente: " + ecE.Message, 3, Usuario.vchUsuario);
     }
 }
        private void autoguardar()
        {
            try
            {
                if (_lstPrioridades != null)
                {
                    if (_lstPrioridades.Count > 0)
                    {
                        EstudioRequest request = new EstudioRequest();
                        String         _error  = "";
                        foreach (tbl_MST_PrioridadEstudio _ope in _lstPrioridades)
                        {
                            request._mdlPrioridad = _ope;
                            request.Token         = Session["Token"].ToString();
                            request.intUsuarioID  = Session["intUsuarioID"].ToString();
                            request.vchUsuario    = Session["UserID"].ToString();
                            request.vchPassword   = Session["Password"].ToString();
                            EstudioResponse response = new EstudioResponse();
                            response = NapoleonDA.setPrioridadEstudio(request);
                            if (response._mensaje != null)
                            {
                                if (response._mensaje.vchError != "")
                                {
                                    _error += "- Existe un error al actualizar los datos del Estudio con ID: " + _ope.intEstudioID + ". Error : " + response._mensaje.vchError + ". ";
                                }
                            }
                            else
                            {
                                _error += "- Existe un error al actualizar los datos del Estudio con ID: " + _ope.intEstudioID + ". Error : " + response._mensaje.vchError + ". ";
                            }
                        }

                        if (_error == "")
                        {
                            //Todo Correcto
                            cargaGridAdministracion();
                            ShowMessage("Cambios guardados correctamente.", MessageType.Correcto, "alert_container");
                        }
                        else
                        {
                            ShowMessage("Existen los siguientes errores: " + _error + ".", MessageType.Correcto, "alert_container");
                        }
                        _lstPrioridades.Clear();
                    }
                }
            }
            catch (Exception eAuto)
            {
                Log.EscribeLog("Existe un error en autoguardar: " + eAuto.Message);
                throw eAuto;
            }
        }
예제 #3
0
        public EstudioResponse setPrioridadEstudio(EstudioRequest Request)
        {
            EstudioResponse _estudioResponse = new EstudioResponse();

            try
            {
                if (Security.ValidateToken(Request.Token, Request.intUsuarioID, Request.vchUsuario, Request.vchPassword))
                {
                    NapoleonDataAccess controller = new NapoleonDataAccess();
                    _estudioResponse._mensaje = controller.updatePrioridadEstudio(Request._mdlPrioridad);
                }
            }
            catch (Exception egV)
            {
                throw egV;
            }
            return(_estudioResponse);
        }
        protected void ckhPrioridad_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                GridViewRow row   = ((GridViewRow)((CheckBox)sender).NamingContainer);
                int         index = row.RowIndex;
                CheckBox    cb1   = (CheckBox)grvBusqueda.Rows[index].FindControl("ckhPrioridad");

                if (chkAutomatico.Checked)
                {
                    string yourvalue = cb1.Text;
                    //here you can find your control and get value(Id).

                    string                   _id     = grvBusqueda.DataKeys[index]["intEstudioID"].ToString();
                    EstudioRequest           request = new EstudioRequest();
                    tbl_MST_PrioridadEstudio _mdl    = new tbl_MST_PrioridadEstudio();
                    _mdl.intEstudioID  = Convert.ToInt32(_id);
                    _mdl.bitUrgente    = cb1.Checked;
                    _mdl.bitAtendido   = false;
                    _mdl.datAtendido   = null;
                    _mdl.datFecha      = DateTime.Now;
                    _mdl.vchusuarioSol = Session["UserID"].ToString();
                    if (_lstGlo.Exists(x => x.intEstatusID == _mdl.intEstudioID))
                    {
                        _mdl.intSecuencia = _lstGlo.First(x => x.intEstatusID == (int)_mdl.intEstudioID).intSecuencia;
                    }
                    request.Token         = Session["Token"].ToString();
                    request.intUsuarioID  = Session["intUsuarioID"].ToString();
                    request.vchUsuario    = Session["UserID"].ToString();
                    request.vchPassword   = Session["Password"].ToString();
                    request._mdlPrioridad = _mdl;
                    EstudioResponse response = new EstudioResponse();
                    response = NapoleonDA.setPrioridadEstudio(request);
                    if (response._mensaje != null)
                    {
                        if (response._mensaje.vchError == "")
                        {
                            cargaGridAdministracion();
                            ShowMessage("Se agrego correctamente el estudio a la lista de prioridades.", MessageType.Correcto, "alert_container");
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "modalPrioridad", "$('#modalPrioridad').modal('hide');", true);
                        }
                        else
                        {
                            ShowMessage("Existe un error al actualizar los datos del Estudio: " + response._mensaje.vchError, MessageType.Error, "alert_container");
                        }
                    }
                    else
                    {
                        ShowMessage("Existe un error al actualizar los datos del Estudio", MessageType.Error, "alert_container");
                    }
                }
                else
                {
                    string _id     = grvBusqueda.DataKeys[index]["intEstudioID"].ToString();
                    string _numEst = grvBusqueda.DataKeys[index]["vchAccessionNumber"].ToString();
                    //Guardar en un modelo.
                    tbl_MST_PrioridadEstudio _mdlPrio = new tbl_MST_PrioridadEstudio();
                    if (_lstPrioridades.Exists(x => x.intEstudioID == Convert.ToInt32(_id)))
                    {
                        if (_lstGlo.First(x => x.vchAccessionNumber == _numEst).bitUrgente != cb1.Checked)
                        {
                            _lstPrioridades.Single(x => x.intEstudioID == Convert.ToInt32(_id)).bitUrgente = cb1.Checked;
                            _lstPrioridades.Single(x => x.intEstudioID == Convert.ToInt32(_id)).datFecha   = DateTime.Now;
                            if (_lstGlo.Exists(x => x.intEstudioID == Convert.ToInt32(_id)))
                            {
                                _lstPrioridades.Single(x => x.intEstudioID == Convert.ToInt32(_id)).intSecuencia = _lstGlo.First(x => x.intEstudioID == Convert.ToInt32(_id)).intSecuencia;
                            }
                        }
                        else
                        {
                            _lstPrioridades.RemoveAll(z => z.intEstudioID == Convert.ToInt32(_id));
                        }
                    }
                    else
                    {
                        _mdlPrio.intEstudioID = Convert.ToInt32(_id);
                        if (_lstGlo.Exists(x => x.intEstudioID == _mdlPrio.intEstudioID))
                        {
                            _mdlPrio.intSecuencia = _lstGlo.First(x => x.intEstudioID == _mdlPrio.intEstudioID).intSecuencia;
                        }
                        _mdlPrio.bitUrgente    = cb1.Checked;
                        _mdlPrio.bitAtendido   = false;
                        _mdlPrio.datAtendido   = null;
                        _mdlPrio.datFecha      = DateTime.Now;
                        _mdlPrio.vchusuarioSol = Session["UserID"].ToString();
                        if (_lstGlo.First(x => x.vchAccessionNumber == _numEst).bitUrgente != cb1.Checked)
                        {
                            _lstPrioridades.Add(_mdlPrio);
                        }
                    }
                }
            }
            catch (Exception chk)
            {
                Log.EscribeLog("Existe un error en ckhPrioridad_CheckedChanged: " + chk.Message);
                ShowMessage("Existe un error al guardar la prioridad: " + chk.Message, MessageType.Error, "alert_container");
            }
        }