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

getUserService() public method

public getUserService ( string ien ) : Service
ien string
return gov.va.medora.mdo.Service
        public Service getUserService(string ien)
        {
            if (StringUtils.isEmpty(ien))
            {
                throw new ArgumentException("Invalid IEN");
            }
            string arg = "$G(^DIC(49," + ien + ",0))";
            string response = VistaUtils.getVariableValue(cxn, arg);
            if (response == "")
            {
                return null;
            }
            string[] flds = StringUtils.split(response, StringUtils.CARET);
            Service result = new Service();
            result.Id = ien;
            if (flds.Length > 0)
            {
                result.Name = flds[0];
            }
            if (flds.Length > 1)
            {
                result.Abbreviation = flds[1];
            }

            if (flds.Length > 2)
            {
                if (flds[2] != "")
                {
                    result.Chief = new User();
                    result.Chief.Uid = flds[2];
                }
            }

            if (flds.Length > 3)
            {
                if (flds[3] != "" && flds[3] != ien)
                {
                    result.ParentService = new Service();
                    result.ParentService.Id = flds[3];
                }
            }

            // Don't care about flds 4 and 5

            if (flds.Length > 6)
            {
                result.Location = flds[6];
            }

            if (flds.Length > 7)
            {
                result.MailSymbol = flds[7];
            }

            if (flds.Length > 8)
            {
                if (flds[8] == "C")
                {
                    result.Type = "PATIENT CARE";
                }
                else if (flds[8] == "A")
                {
                    result.Type = "ADMINISTRATIVE";
                }
                else
                {
                    result.Type = "";
                }
            }
            return result;
        }
VistaUserDao