public static List<clsSwitchDetails> AllocationChange(int intFundID, float fAllocation, List<clsSwitchDetails> listSwitchDetails, string strClientID, string strClientCurrency )
        {
            List<clsSwitchDetails> newListSwitchDetails = new List<clsSwitchDetails>();
            float fTotalAllocation = 0;
            foreach (clsSwitchDetails SwitchDetail in listSwitchDetails)
            {
                clsFund FundInfo = new clsFund(intFundID);                

                if (SwitchDetail.propFund.propFundID == intFundID) {
                    SwitchDetail.propAllocation = fAllocation;

                    if (strClientCurrency != FundInfo.propCurrency)
                    {                        
                        SwitchDetail.propUnits = computeUnits(fAllocation, SwitchDetail.propTotalValue, clsCurrency.convertToClientCurrency(strClientID, FundInfo.propPrice, FundInfo.propCurrency));
                    }
                    else {
                        SwitchDetail.propUnits = computeUnits(fAllocation, SwitchDetail.propTotalValue, FundInfo.propPrice);
                    }

                    SwitchDetail.propValue = computeValue(fAllocation, SwitchDetail.propTotalValue);                    
                }

                fTotalAllocation = fTotalAllocation + SwitchDetail.propAllocation;

                SwitchDetail.propTotalAllocation = fTotalAllocation;

                SwitchDetail.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(strClientID, FundInfo.propCurrency);

                newListSwitchDetails.Add(SwitchDetail);
            }

            return newListSwitchDetails;
        }
        public static List<clsSwitchDetails> FundChange(int intFundID_old, int intFundID_new, List<clsSwitchDetails> listSwitchDetails, string strClientID, string strClientCurrency)
        {
            List<clsSwitchDetails> newListSwitchDetails = new List<clsSwitchDetails>();
            float fTotalAllocation = 0;
            float fTotalValue = listSwitchDetails[0].propTotalValue;

            foreach (clsSwitchDetails SwitchDetail in listSwitchDetails)
            {
                if (SwitchDetail.propFund.propFundID == intFundID_new) {
                    throw new Exception("Fund already exists.");
                }

                if (SwitchDetail.propFund.propFundID == intFundID_old)
                {

                    clsFund FundInfo = new clsFund(intFundID_new);

                    SwitchDetail.propFund = FundInfo;

                    if (strClientCurrency != FundInfo.propCurrency)
                    {
                        SwitchDetail.propUnits = computeUnits(SwitchDetail.propAllocation, fTotalValue, clsCurrency.convertToClientCurrency(strClientID, FundInfo.propPrice, FundInfo.propCurrency));
                    }
                    else
                    {
                        SwitchDetail.propUnits = computeUnits(SwitchDetail.propAllocation, fTotalValue, FundInfo.propPrice);
                    }

                    SwitchDetail.propValue = computeValue(SwitchDetail.propAllocation, fTotalValue);

                    SwitchDetail.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(strClientID, FundInfo.propCurrency);
                }

                fTotalAllocation = fTotalAllocation + SwitchDetail.propAllocation;
                
                SwitchDetail.propTotalAllocation = fTotalAllocation;

                newListSwitchDetails.Add(SwitchDetail);
            }

            return newListSwitchDetails;
        }
Beispiel #3
0
        public static string generateApprovedSwitch(clsSwitch Switch, int IFAID)
        {
            string resultingRow = string.Empty;
            foreach (clsSwitchDetails SwitchDetails in Switch.propSwitchDetails)
            {
                clsFund Fund = new clsFund(SwitchDetails.propFundID);
                string myRow = ROWDETAILS.Replace("{^row$}", clsOutput.CELLDETAILS);
                myRow = myRow.Replace("{^FundCompany$}", new clsCompany(Fund.propFundManager).propCompany);
                myRow = myRow.Replace("{^FundName$}", Fund.propFundName);
                myRow = myRow.Replace("{^InsurComp$}", Fund.propCompanyID.ToString());
                myRow = myRow.Replace("{^SEDOL$}", Fund.propSEDOL);
                myRow = myRow.Replace("{^%Portfolio$}", SwitchDetails.propAllocation + "%");
                resultingRow += myRow;
            }
            clsClient client = new clsClient(Switch.propClientID);
            string html = clsOutput.PortfolioOutput_GetHTML();
            clsIFA IFA = new clsIFA(IFAID);            

            html = html.Replace("{^IFAName$}", IFA.propIFA_Name ?? string.Empty);
            html = html.Replace("{^ClientName$}",(client.propForename ?? String.Empty) + " " + (client.propSurname ?? string.Empty)  );
            html = html.Replace("{^Company$}", Switch.propPortfolio.propCompany);
            html = html.Replace("{^PType$}", Switch.propPortfolio.propPortfolioType);
            html = html.Replace("{^DateTransmit$}", "???"); // DateTime.Now.ToString("MM-dd-yyyy")); //-->Temporary
            html = html.Replace("{^Curr$}", Switch.propPortfolio.propPortfolioCurrency);
            html = html.Replace("{^AccNum$}", Switch.propPortfolio.propAccountNumber);
            html = html.Replace("{^DateApprv$}", DateTime.Now.ToString("MM-dd-yyyy") ?? String.Empty);// Portfolio.propSwitch.propDate_Created.ToString("MM-dd-yyyy") ?? string.Empty);

            if (Switch.propPortfolio.propConfirmationRequired)
            {
                html = html.Replace("{^Sign$}", clsOutput.SIGNATURE)
                    .Replace("{^SignatureClientName$}", client.propForename + " " + client.propSurname );
            }
            else
            {
                html = html.Replace("{^Sign$}", string.Empty);
            }
            html = html.Replace("{^SwitchDetails$}", resultingRow);
            return html;
        }