gov.va.medora.mdo.dao.oracle.mhv.sm.UserDao.getUserDetail C# (CSharp) Method

getUserDetail() public method

public getUserDetail ( Int32 userId ) : domain.sm.User
userId System.Int32
return domain.sm.User
        public domain.sm.User getUserDetail(Int32 userId)
        {
            domain.sm.User user = getUserById(userId);
            user.Groups = getValidRecipients(user).ToList<TriageGroup>();
            user.Mailbox = new Mailbox() { UserFolders = new FolderDao(_cxn).getUserFolders(userId).ToList<domain.sm.Folder>() };
            return user;
        }

Usage Example

Ejemplo n.º 1
0
        public SmUserTO getUser(string pwd, string userId, string idType)
        {
            SmUserTO result = new SmUserTO();

            if (String.IsNullOrEmpty(pwd))
            {
                result.fault = new dto.FaultTO("Must supply password");
            }
            else if (String.IsNullOrEmpty(userId))
            {
                result.fault = new dto.FaultTO("Must supply user ID");
            }
            else if (String.IsNullOrEmpty(idType) && !StringUtils.isNumeric(userId))
            {
                result.fault = new FaultTO("Invalid user ID");
            }
            else if (!String.IsNullOrEmpty(idType) && !String.Equals(idType, "SMID", StringComparison.CurrentCultureIgnoreCase) &&
                !String.Equals(idType, "ICN", StringComparison.CurrentCultureIgnoreCase) && !String.Equals(idType, "SSN", StringComparison.CurrentCultureIgnoreCase))
            {
                result.fault = new FaultTO("Invalid id type", "Use one of the following: SMID, ICN, SSN");
            }

            if (result.fault != null)
            {
                return result;
            }

            try
            {
                using (MdoOracleConnection cxn = new MdoOracleConnection(new mdo.DataSource() { ConnectionString = pwd }))
                {
                    UserDao dao = new UserDao(cxn);

                    if (String.IsNullOrEmpty(idType) || String.Equals(idType, "SMID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        result = new SmUserTO(dao.getUserDetail(Convert.ToInt32(userId)));
                    }
                    else if (String.Equals(idType, "ICN", StringComparison.CurrentCultureIgnoreCase))
                    {
                        result = new SmUserTO(dao.getUserDetail(dao.getUserByIcn(userId).Id));
                    }
                    else if (String.Equals(idType, "SSN", StringComparison.CurrentCultureIgnoreCase))
                    {
                        // TODO - write get user by SSN function
                        result.fault = new FaultTO("SSN lookup not currently enabled. Please try again later");
                        //result = new SmUserTO(dao.getUserDetail(dao.getUserBySsn(userId)));
                    }
                    else
                    {
                        throw new Exception("Invalid user type"); // should never get here with fault handling section but... just in case
                    }
                }
            }
            catch (Exception exc)
            {
                result.fault = new dto.FaultTO(exc);
            }

            return result;
        }