Ejemplo n.º 1
0
        public string discontinueMed(string orderIen, string duz, string reasonIen)
        {
            if (String.IsNullOrEmpty(orderIen))
            {
                return "No order ID";
            }
            if (String.IsNullOrEmpty(duz))
            {
                return "No user ID";
            }
            if (String.IsNullOrEmpty(reasonIen))
            {
                return "No reason ID";
            }

            VistaUserDao userDao = new VistaUserDao(cxn);
            if (!userDao.hasPermission(duz, new SecurityKey("", "PROVIDER")))
            {
                return "User does not have PROVIDER key";
            }

            VistaOrdersDao orderDao = new VistaOrdersDao(cxn);
            Order order = orderDao.getOrder(orderIen);
            if (order == null)
            {
                return "No such order";
            }

            string msg = orderDao.validateOrderActionNature(orderIen, "DC", duz, "");
            if (msg != "OK")
            {
                return msg;
            }
            msg = orderDao.getComplexOrderMsg(orderIen);
            if (msg != "")
            {
                return msg;
            }

            if (!orderDao.lockOrdersForPatient(cxn.Pid))
            {
                return "Unable to lock orders for patient";
            }
            msg = orderDao.lockOrder(orderIen);
            if (msg != "OK")
            {
                orderDao.unlockOrdersForPatient();
                return msg;
            }

            // discontinue the order

            // unlock ?

            return null;
        }
Ejemplo n.º 2
0
 internal void releaseOrders(String duz, String locIen, String esig, Order[] orders)
 {
     IUserDao userDao = new VistaUserDao(cxn);
     if (!userDao.hasPermission(duz, new SecurityKey("","PERMISSION")))
     {
         throw new Exception("Order is not being made for a provider");
     }
     if (!lockOrdersForPatient())
     {
         throw new Exception("Unable to lock patient's orders");
     }
     for (int i = 0; i < orders.Length; i++)
     {
         string ien = orders[i].Id;
         string rtn = getComplexOrderMsg(ien);
         orders[i].ErrMsg = "";
         if (rtn != "")
         {
             orders[i].ErrMsg = "Complex order message: " + rtn;
             continue;
         }
         rtn = lockOrder(ien);
         if (rtn != "OK")
         {
             orders[i].ErrMsg = "Unable to lock order: " + rtn;
             continue;
         }
         rtn = checkReleaseOrder(orders[i]);
         if (rtn != "")
         {
             orders[i].ErrMsg = "Release order error: " + rtn;
             continue;
         }
         //			rtn = validateOrderActionNature(ien);
         //			if (!rtn.equals("OK"))
         //			{
         //				orders[i].setErrMsg("Unable to validate order: " + rtn);
         //				continue;
         //			}
     }
     sendOrders(duz, locIen, esig, orders);
     for (int i = 0; i < orders.Length; i++)
     {
         if (!unlockOrder(orders[i].Id))
         {
             orders[i].ErrMsg = "Unable to unlock order";
             continue;
         }
     }
     unlockOrdersForPatient();
 }
Ejemplo n.º 3
0
        public override bool success(string[] flds)
        {
            AbstractPermission ddrContext = new MenuOption(VistaConstants.DDR_CONTEXT);
            acct.setContext(ddrContext);

            VistaUserDao dao = new VistaUserDao(cxn);
            cxn.Uid = dao.getUserIdBySsn(creds.FederatedUid);

            return true;
        }
Ejemplo n.º 4
0
 internal void doTheAuthorize(AbstractCredentials credentials, AbstractPermission permission)
 {
     //// if we are requesting CPRS context with a visit and user does not have it - add it to their account
     if (permission.Name == VistaConstants.CPRS_CONTEXT &&
         !Cxn.Account.Permissions.ContainsKey(VistaConstants.CPRS_CONTEXT) &&
         !Cxn.Account.AuthenticationMethod.Equals(VistaConstants.LOGIN_CREDENTIALS))
     {
         addContextInVista(Cxn.Uid, permission);
     }
     else
     {
         setContext(permission);
     }
     if (String.IsNullOrEmpty(Cxn.Uid))
     {
         if (String.IsNullOrEmpty(credentials.FederatedUid))
         {
             throw new MdoException("Missing federated UID, cannot get local UID");
         }
         VistaUserDao dao = new VistaUserDao(Cxn);
         Cxn.Uid = dao.getUserIdBySsn(credentials.FederatedUid);
         if (String.IsNullOrEmpty(Cxn.Uid))
         {
             throw new MdoException("Unable to get local UID for federated ID " + credentials.FederatedUid);
         }
     }
     if (!credentials.Complete)
     {
         VistaUserDao dao = new VistaUserDao(Cxn);
         dao.addVisitorInfo(credentials);
     }
 }
Ejemplo n.º 5
0
        //internal void setVisitorContext(AbstractPermission requestedContext, string DUZ)
        //{
        //    try
        //    {
        //        setContext(requestedContext);
        //        return;
        //    }
        //    catch (UnauthorizedAccessException uae)
        //    {
        //        addContextInVista(DUZ, requestedContext);
        //        setContext(requestedContext);
        //    }
        //    catch (Exception e)
        //    {
        //        throw;
        //    }
        //}
        // This is how the visitor gets the requested context - typically
        // OR CPRS GUI CHART. The visitor comes back from VistA with CAPRI
        // context only.
        internal void addContextInVista(string duz, AbstractPermission requestedContext)
        {
            if (Permissions.ContainsKey(requestedContext.Name))
            {
                return;
            }
            VistaUserDao dao = new VistaUserDao(Cxn);

            // try/catch should fix: http://trac.medora.va.gov/web/ticket/2288
            try
            {
                setContext(requestedContext);
            }
            catch (Exception)
            {
                try
                {
                    // will get CONTEXT HAS NOT BEEN CREATED if we don't set this again after failed attempt
                    setContext(new MenuOption(VistaConstants.DDR_CONTEXT));
                    dao.addPermission(duz, requestedContext);
                    setContext(requestedContext);
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
Ejemplo n.º 6
0
        internal static DdrFiler buildAddRecordQuery(AbstractConnection cxn, RemoteApplicationRecord rec, CallBackFileRecord subrec)
        {
            DdrFiler query = new DdrFiler(cxn);
            query.Operation = "ADD";
            ArrayList lst = new ArrayList(7);
            VistaField f = rec.Fields["NAME"];
            lst.Add(FILE_NUMBER + "^" + f.VistaNumber + "^+1,^" + f.VistaValue);
            f = rec.Fields["CONTEXTOPTION"];
            VistaUserDao dao = new VistaUserDao(cxn);
            lst.Add(FILE_NUMBER + "^" + f.VistaNumber + "^+1,^" + dao.getOptionIen(f.VistaValue));
            f = rec.Fields["APPLICATIONCODE"];
            lst.Add(FILE_NUMBER + "^" + f.VistaNumber + "^+1,^" + f.VistaValue);

            f = subrec.Fields["CALLBACKTYPE"];
            lst.Add(CALLBACK_FILE_NUMBER + "^" + f.VistaNumber + "^+2,+1^" + f.VistaValue);
            f = subrec.Fields["CALLBACKPORT"];
            lst.Add(CALLBACK_FILE_NUMBER + "^" + f.VistaNumber + "^+2,+1^" + f.VistaValue);
            f = subrec.Fields["CALLBACKSERVER"];
            lst.Add(CALLBACK_FILE_NUMBER + "^" + f.VistaNumber + "^+2,+1^" + f.VistaValue);
            f = subrec.Fields["URLSTRING"];
            lst.Add(CALLBACK_FILE_NUMBER + "^" + f.VistaNumber + "^+2,+1^" + f.VistaValue);

            query.Args = (string[])lst.ToArray(typeof(string));
            return query;
        }
Ejemplo n.º 7
0
 public string isRpcAvailable(string target, string context, string localRemote, string version)
 {
     if (!isRpcAvailableAtSite(target, localRemote, version))
     {
         return "Not installed at site";
     }
     KeyValuePair<string,string>[] rpcList = getRpcList(target);
     string rpcIEN = rpcList[0].Key;
     VistaUserDao userDao = new VistaUserDao(cxn);
     string optIEN = userDao.getOptionIen(context);
     if (!StringUtils.isNumeric(optIEN))
     {
         return "Error getting context IEN: " + optIEN;
     }
     DdrLister query = buildGetOptionRpcsQuery(optIEN);
     string[] optRpcs = query.execute();
     if (!isRpcIenPresent(optRpcs, rpcIEN))
     {
         return "RPC not in context";
     }
     return "YES";
 }