public List <wsPortfoliosItem.psPortfoliosItemInfo> GetPortfolioListByQuery(String commonIdCategory, String portfolioScope, List <psPortfoliosQueryPart> queryPartsList, psPORTFOLIO_TYPE itemTypes)
        {
            psPortfoliosPortfolioIdentifier[] arScope = null;
            var arScopeList = new List <psPortfoliosPortfolioIdentifier> {
                new psPortfoliosPortfolioIdentifier()
            };
            var retPortfolioItemInfoList = new List <wsPortfoliosItem.psPortfoliosItemInfo>();

            try
            {
                if (portfolioScope.IsNotNullOrEmpty())
                {
                    arScopeList[0].Name = portfolioScope;
                    arScope             = arScopeList.ToArray();
                }

                //Get the QBP

                var retVal = PsPortfolio.GetItemListByQuery(commonIdCategory, arScope, queryPartsList.ToArray(), itemTypes);
                retPortfolioItemInfoList.AddRange(retVal.Select(val => PsItem.GetItemInfo("", val.ProSightID.ToString(CultureInfo.InvariantCulture))));
            }
            catch (Exception ex)
            {
                PsLogger.Error(string.Format("Unexcpected GetPortfolioListByQuery Error: \n{0}\n", ex.Message));
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retPortfolioItemInfoList);
        }
        public String GetPortfolioIdByName(String uci, String uciName)
        {
            String retValue;

            try
            {
                retValue = PsPortfolio.GetIDByName(uci, uciName);
            }
            catch (Exception)
            {
                retValue = null;
            }
            return(retValue);
        }
        public psPortfoliosItemInfo GetPortfolioInfo(String uci, String id)
        {
            psPortfoliosItemInfo retVal;

            try
            {
                retVal = PsPortfolio.GetPortfolioInfo(uci, id);
            }
            catch (Exception ex)
            {
                PsLogger.Error(string.Format("Unexcpected GetPortfolioInfo Error: \n{0}\n", ex.Message));
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
        public List <wsPortfoliosItem.psPortfoliosItemInfo> GetPortfolioInfoListByCommonId(String uci, String id)
        {
            var retPortfolioItemInfoList = new List <wsPortfoliosItem.psPortfoliosItemInfo>();

            try
            {
                var retVal = PsPortfolio.GetItemListByCommonID(uci, id);
                retPortfolioItemInfoList.AddRange(retVal.Select(x => PsItem.GetItemInfo(uci, x.UCI)));
            }
            catch (Exception ex)
            {
                PsLogger.Error(String.Format("Unexcpected GetPortfolioListByCommonID Error: \n{0}\n", ex.Message));
            }
            return(retPortfolioItemInfoList);
        }
        public psRETURN_VALUES RefreshDynamicPortfolio(String uci, String id)
        {
            psRETURN_VALUES retVal;

            try
            {
                PsPortfolio.RefreshQBPByCommonID(uci, id);
                retVal = psRETURN_VALUES.ERR_OK;
            }
            catch (Exception ex)
            {
                PsLogger.Error(string.Format("Unexcpected RefreshDynamicPortfolio Error: \n{0}\n", ex.Message));
                retVal = psRETURN_VALUES.ERR_PORTFOLIO_NOT_QBP;
            }
            return(retVal);
        }
        public psRETURN_VALUES SynchronizeQbp(String uci, String id, List <psPortfoliosPortfolioIdentifier> portfolioScope, List <psPortfoliosQueryPart> queryPartsList, bool periodicUpdate, psPortfoliosItemInfo portfolioItemInfo)
        {
            psRETURN_VALUES retVal;

            try
            {
                PsPortfolio.SynchronizeQBP2(uci, id, portfolioScope.ToArray(), queryPartsList.ToArray(), periodicUpdate, portfolioItemInfo);
                retVal = psRETURN_VALUES.ERR_OK;
            }
            catch (Exception ex)
            {
                PsLogger.Error(string.Format("Unexcpected SynchronizeQBP Error: \n{0}\n", ex.Message));
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
        public psRETURN_VALUES SynchronizePortfolio(String uci, String id, psPortfoliosItemInfo portfolioItemInfo)
        {
            psRETURN_VALUES retVal;

            try
            {
                PsPortfolio.SynchronizeEx2(uci, id, portfolioItemInfo);
                retVal = psRETURN_VALUES.ERR_OK;
            }
            catch (Exception ex)
            {
                PsLogger.Error(string.Format("Unexcpected SynchronizePortfolio Error: \n{0}\n", ex.Message));
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }
        public List <String> GetPortfolioListIdsByCommondId(String uci, String id)
        {
            var retPortfolioItemInfoId = new List <String>();

            try
            {
                var retVal = PsPortfolio.GetItemListByCommonID(uci, id);
                retPortfolioItemInfoId.AddRange(retVal.Select(psPortfoliosItemInfo => psPortfoliosItemInfo.UCI));
            }
            catch (Exception ex)
            {
                PsLogger.Error(String.Format("Unexcpected GetPortfolioListByCommonID Error: \n{0}\n", ex.Message));
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retPortfolioItemInfoId);
        }
        public psRETURN_VALUES AddPortfolio(String uci, String id, psPortfoliosItemInfo portfolioItemInfo)
        {
            psRETURN_VALUES retVal;

            try
            {
                //PsPortfolio.AddNewEx(String.Empty, String.Empty, portfolioItemInfo.Name, portfolioItemInfo.LifeCycle,
                //                    portfolioItemInfo.StartDate, portfolioItemInfo.EndDate, portfolioItemInfo.Description,portfolioItemInfo.Status,
                //                    portfolioItemInfo.PortfolioType,portfolioItemInfo.Manager,portfolioItemInfo.ContainerUCI);
                PsPortfolio.AddNewEx2(uci, id, portfolioItemInfo);
                retVal = psRETURN_VALUES.ERR_OK;
            }
            catch (Exception ex)
            {
                PsLogger.Error("Unexcpected AddPortfolio Error: \n{0}\n", ex.Message);
                throw new Exception(ex.Message, ex.InnerException);
            }
            return(retVal);
        }