Esempio n. 1
0
    /// <summary>
    /// US:1882 Check to see if we have a valid MDWS connection
    /// </summary>
    /// <returns></returns>
    public CStatus CheckMDWSConnection()
    {
        //performing a simple operation in MDWS
        //to make sure we are still connected.

        CStatus status = new CStatus();

        //todo: forcing a disconnect for testing
        //GetMDWSSOAPClient().disconnect();

        CMDWSOps ops    = new CMDWSOps(this);
        long     lCount = 0;

        status = ops.GetMDWSSecurityKeys(UserID, false, out lCount);

        if (!status.Status)
        {
            long             lUserID        = 0;
            EmrSvcSoapClient mdwsSOAPClient = null;
            status = ops.MDWSLogin(MDWSUID.ToString(),
                                   MDWSPWD.ToString(),
                                   SiteID,
                                   out lUserID,
                                   out mdwsSOAPClient);
        }


        return(status);
    }
Esempio n. 2
0
    /// <summary>
    /// does the user have a security keys by key name
    /// </summary>
    /// <param name="ds"></param>
    /// <returns></returns>
    public bool HasSecurityKey(long lUserID,
                               string strKeyName)
    {
        //initialize parameters
        DataSet ds     = null;
        CStatus status = new CStatus();

        //transfer from MDWS if needed
        if (MDWSTransfer)
        {
            long     lCount = 0;
            CMDWSOps ops    = new CMDWSOps(this);
            status = ops.GetMDWSSecurityKeys(lUserID,
                                             true,
                                             out lCount);
            if (!status.Status)
            {
                return(false);
            }
        }

        //load the paramaters list
        CParameterList pList = new CParameterList(base.SessionID,
                                                  base.ClientIP,
                                                  base.UserID);

        pList.AddInputParameter("pi_vSecurityKeyName", strKeyName.Trim().ToUpper());

        //get the dataset
        CDataSet cds = new CDataSet();

        status = cds.GetOracleDataSet(base.DBConn,
                                      "PCK_SECURITY_KEY.GetSecurityKeyByNameRS",
                                      pList,
                                      out ds);

        if (!status.Status)
        {
            return(false);
        }

        string strKey = CDataUtils.GetDSStringValue(ds, "security_key_name");

        if (!String.IsNullOrEmpty(strKey))
        {
            if (strKey.Trim().ToLower() == strKeyName.Trim().ToLower())
            {
                return(true);
            }
        }

        return(false);
    }
Esempio n. 3
0
    /// <summary>
    /// US:866 Load the user data from the database
    /// </summary>
    /// <param name="lUserID"></param>
    /// <returns></returns>
    private CStatus LoadUserData(long lUserID)
    {
        DataSet ds = null;

        CUserData cud    = new CUserData(this);
        CStatus   status = cud.GetUserDS(lUserID, out ds);

        if (status.Status)
        {
            //cach the date the user logged in
            UserLoginDateTime = DateTime.Now;

            //cache the user id, role id, first name and last name
            UserID        = lUserID;
            UserRoleID    = CDataUtils.GetDSLongValue(ds, "user_role_id");
            UserFirstName = CDataUtils.GetDSStringValue(ds, "first_name");
            UserLastName  = CDataUtils.GetDSStringValue(ds, "last_name");
        }
        else
        {
            return(status);
        }

        //transfer user keys to our db
        if (MDWSTransfer)
        {
            CMDWSOps ops    = new CMDWSOps(this);
            long     lCount = 0;
            status = ops.GetMDWSSecurityKeys(lUserID, true, out lCount);
            if (!status.Status)
            {
                return(status);
            }
        }

        //set the admin, doc and nurse privs for this user
        DataSet dsRoles = null;

        status = cud.GetUserRolesDS(lUserID, out dsRoles);
        if (status.Status)
        {
            foreach (DataTable table in dsRoles.Tables)
            {
                foreach (DataRow dr in table.Rows)
                {
                    long lRoleID = CDataUtils.GetDSLongValue(dr, "USER_ROLE_ID");
                    if (lRoleID == (long)k_USER_ROLE_ID.Administrator)
                    {
                        IsAdministrator = true;
                    }
                    else if (lRoleID == (long)k_USER_ROLE_ID.Doctor)
                    {
                        IsDoctor = true;
                    }
                    else if (lRoleID == (long)k_USER_ROLE_ID.Nurse)
                    {
                        IsNurse = true;
                    }
                }
            }
        }

        return(status);
    }