public static List <clsSwitchSchemeDetails_Client> FundChange(int intFundID_old, int intFundID_new, List <clsSwitchSchemeDetails_Client> listSwitchDetails, string strClientID, string strClientCurrency, Boolean isContribution) { List <clsSwitchSchemeDetails_Client> newListSwitchDetails = new List <clsSwitchSchemeDetails_Client>(); float fTotalAllocation = 0; float fTotalValue = listSwitchDetails[0].propTotalValue; foreach (clsSwitchSchemeDetails_Client 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 = clsSwitchDetails.computeUnits(SwitchDetail.propAllocation, fTotalValue, clsCurrency.convertToClientCurrency(strClientID, FundInfo.propPrice, FundInfo.propCurrency)); } else { SwitchDetail.propUnits = clsSwitchDetails.computeUnits(SwitchDetail.propAllocation, fTotalValue, FundInfo.propPrice); } SwitchDetail.propValue = clsSwitchDetails.computeValue(SwitchDetail.propAllocation, fTotalValue); SwitchDetail.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(strClientID, FundInfo.propCurrency); } fTotalAllocation = fTotalAllocation + SwitchDetail.propAllocation; SwitchDetail.propTotalAllocation = fTotalAllocation; SwitchDetail.propIsContribution = isContribution; newListSwitchDetails.Add(SwitchDetail); } return(newListSwitchDetails); }
public static List <clsModelPortfolioDetails> FundChange(int intFundID_old, int intFundID_new, List <clsModelPortfolioDetails> listModelPortfolioDetails, string strClientID, string strClientCurrency) { List <clsModelPortfolioDetails> newListModelPortfolioDetails = new List <clsModelPortfolioDetails>(); float fTotalAllocation = 0; float fTotalValue = listModelPortfolioDetails[0].propTotalValue; foreach (clsModelPortfolioDetails ModelPortfolioDetails in listModelPortfolioDetails) { if (ModelPortfolioDetails.propFund.propFundID == intFundID_new) { throw new Exception("Fund already exists."); } if (ModelPortfolioDetails.propFund.propFundID == intFundID_old) { clsFund FundInfo = new clsFund(intFundID_new); ModelPortfolioDetails.propFund = FundInfo; if (strClientCurrency != FundInfo.propCurrency) { ModelPortfolioDetails.propUnits = computeUnits(ModelPortfolioDetails.propAllocation, fTotalValue, clsCurrency.convertToClientCurrency(strClientID, FundInfo.propPrice, FundInfo.propCurrency)); } else { ModelPortfolioDetails.propUnits = computeUnits(ModelPortfolioDetails.propAllocation, fTotalValue, FundInfo.propPrice); } ModelPortfolioDetails.propValue = computeValue(ModelPortfolioDetails.propAllocation, fTotalValue); ModelPortfolioDetails.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(strClientID, FundInfo.propCurrency); } fTotalAllocation = fTotalAllocation + ModelPortfolioDetails.propAllocation; ModelPortfolioDetails.propTotalAllocation = fTotalAllocation; newListModelPortfolioDetails.Add(ModelPortfolioDetails); } return(newListModelPortfolioDetails); }
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); }
public static List <clsFund> getAllFunds(String strFundName) { SqlConnection con = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection; List <clsFund> listFund = new List <clsFund>(); SqlCommand cmd = new SqlCommand(); SqlDataReader dr; con.Open(); cmd.Connection = con; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "[SWITCH_FundGetAll]"; cmd.Parameters.Add("@param_strFundName", System.Data.SqlDbType.NVarChar).Value = strFundName; dr = cmd.ExecuteReader(); while (dr.Read()) { clsFund newFund = new clsFund(); newFund.propCompanyID = dr["CompanyID"] == null?int.Parse(dr["CompanyID"].ToString()) : 0; newFund.propCurrency = dr["Currency"].ToString(); newFund.propDatePriceUpdated = dr["DatePriceUpdated"] != System.DBNull.Value ? DateTime.Parse(dr["DatePriceUpdated"].ToString()) : DateTime.ParseExact("01/01/1800", "dd/MM/yyyy", null); newFund.propFundID = int.Parse(dr["FundNameID"].ToString()); newFund.propFundManager = int.Parse(dr["FundManager"].ToString()); newFund.propFundName = dr["FundName"].ToString(); newFund.propPrice = dr["Price"] != System.DBNull.Value ? float.Parse(dr["Price"].ToString()) : 0f; listFund.Add(newFund); } dr.Close(); con.Close(); cmd.Dispose(); con.Dispose(); return(listFund); }
public static List <clsModelPortfolioDetails> AllocationChange(int intFundID, float fAllocation, List <clsModelPortfolioDetails> listModelPortfolioDetails, string strClientID, string strClientCurrency) { List <clsModelPortfolioDetails> newListModelPortfolioDetails = new List <clsModelPortfolioDetails>(); float fTotalAllocation = 0; foreach (clsModelPortfolioDetails ModelPortfolioDetails in listModelPortfolioDetails) { clsFund FundInfo = new clsFund(intFundID); if (ModelPortfolioDetails.propFund.propFundID == intFundID) { ModelPortfolioDetails.propAllocation = fAllocation; if (strClientCurrency != FundInfo.propCurrency) { ModelPortfolioDetails.propUnits = computeUnits(fAllocation, ModelPortfolioDetails.propTotalValue, clsCurrency.convertToClientCurrency(strClientID, FundInfo.propPrice, FundInfo.propCurrency)); } else { ModelPortfolioDetails.propUnits = computeUnits(fAllocation, ModelPortfolioDetails.propTotalValue, FundInfo.propPrice); } ModelPortfolioDetails.propValue = computeValue(fAllocation, ModelPortfolioDetails.propTotalValue); } fTotalAllocation = fTotalAllocation + ModelPortfolioDetails.propAllocation; ModelPortfolioDetails.propTotalAllocation = fTotalAllocation; ModelPortfolioDetails.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(strClientID, FundInfo.propCurrency); newListModelPortfolioDetails.Add(ModelPortfolioDetails); } return(newListModelPortfolioDetails); }
public static List <clsSwitchDetails_Client> AllocationChange(int intFundID, float fAllocation, List <clsSwitchDetails_Client> listSwitchDetails, string strClientID, string strClientCurrency) { List <clsSwitchDetails_Client> newListSwitchDetails = new List <clsSwitchDetails_Client>(); float fTotalAllocation = 0; foreach (clsSwitchDetails_Client 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); }