gov.va.medora.mdo.dao.vista.VistaUserDao.hasPermission C# (CSharp) Method

hasPermission() public method

public hasPermission ( string duz, AbstractPermission p ) : bool
duz string
p AbstractPermission
return bool
        public bool hasPermission(string duz, AbstractPermission p)
        {
            if (p.Type == PermissionType.MenuOption)
            {
                return hasMenuOption(duz, p);
            }
            if (p.Type == PermissionType.DelegatedOption)
            {
                return hasDelegatedOption(duz, p);
            }
            if (p.Type == PermissionType.SecurityKey)
            {
                return hasSecurityKey(duz, p);
            }
            throw new ArgumentException("Invalid permission type");
        }

Usage Example

コード例 #1
0
ファイル: VistaPharmacyDao.cs プロジェクト: OSEHRA/mdo
        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;
        }
All Usage Examples Of gov.va.medora.mdo.dao.vista.VistaUserDao::hasPermission
VistaUserDao