public static void transferClientSwitchToIFA(List <clsSwitchDetails_Client> listClientSwitchDetails, string strUserID)
        {
            clsSwitch SwitchIFA = new clsSwitch(listClientSwitchDetails[0].propSwitchID);

            string strClientID    = SwitchIFA.propClientID;
            string strPortfolioID = SwitchIFA.propPortfolioID;

            List <clsSwitchDetails> listSwitchDetailsIFA = new clsPortfolio(strClientID, strPortfolioID, strUserID).propSwitch.propSwitchDetails;

            foreach (clsSwitchDetails SwitchDetailsIFA in listSwitchDetailsIFA)
            {
                clsSwitchDetails.removeSwitchDetails(SwitchDetailsIFA.propSwitchDetailsID);
            }

            List <clsSwitchDetails> newListSwitchDetails = new List <clsSwitchDetails>();

            foreach (clsSwitchDetails_Client SwitchDetails_Client in listClientSwitchDetails)
            {
                clsSwitchDetails newSwitchDetails = new clsSwitchDetails();
                newSwitchDetails.propSwitchID    = SwitchIFA.propSwitchID;
                newSwitchDetails.propFund        = new clsFund(SwitchDetails_Client.propFund.propFundID);
                newSwitchDetails.propAllocation  = SwitchDetails_Client.propAllocation;
                newSwitchDetails.propIsDeletable = SwitchDetails_Client.propIsDeletable;

                newListSwitchDetails.Add(newSwitchDetails);
            }

            clsSwitchDetails.insertSwitchDetails(newListSwitchDetails, strUserID, SwitchIFA.propSwitchID);
        }
Exemple #2
0
        public List <clsSwitchDetails> combineModelAndPortfolioDetails(clsPortfolio _clsPortfolio, int intModelID, string _strModelGroupID, string _strModelPortfolioID)
        {
            List <clsSwitchDetails> listSwitchDetails         = new List <clsSwitchDetails>();
            List <clsSwitchDetails> listPortfolioDetails      = clsSwitchDetails.replicatePortfolioDetails(_clsPortfolio);
            List <clsSwitchDetails> listModelPortfolioDetails = replicateModelPortfolio(_clsPortfolio, intModelID, _strModelGroupID, _strModelPortfolioID);

            foreach (clsSwitchDetails origSwitchDetails in listPortfolioDetails)
            {
                foreach (clsSwitchDetails modelSwitchDetails in listModelPortfolioDetails)
                {
                    if (origSwitchDetails.propFundID != modelSwitchDetails.propFundID)
                    {
                        origSwitchDetails.propAllocation = 0;
                        origSwitchDetails.propValue      = 0;
                        origSwitchDetails.propUnits      = 0;
                    }
                }
                listSwitchDetails.Add(origSwitchDetails);
            }
            foreach (clsSwitchDetails modelSwitchDetails in listModelPortfolioDetails)
            {
                clsSwitchDetails item = new clsSwitchDetails();
                foreach (clsSwitchDetails origSwitchDetails in listPortfolioDetails)
                {
                    if (modelSwitchDetails.propFundID != origSwitchDetails.propFundID)
                    {
                        item = modelSwitchDetails;
                    }
                }
                listSwitchDetails.Add(item);
            }

            return(listSwitchDetails);
        }
        public static List <clsSwitchDetails> replicatePortfolioDetails(List <clsPortfolioDetails> _clsPortfolioDetails, int intSwitchID)
        {
            List <clsSwitchDetails> listSwitchDetails = new List <clsSwitchDetails>();
            float  fTotalAllocation = 0;
            double dPrice           = 0;

            foreach (clsPortfolioDetails PortfolioDetails in _clsPortfolioDetails)
            {
                clsSwitchDetails _clsSwitchDetails = new clsSwitchDetails();
                _clsSwitchDetails.propSwitchID   = intSwitchID;
                _clsSwitchDetails.propFund       = new clsFund(PortfolioDetails.propFundNameID);
                _clsSwitchDetails.propAllocation = float.Parse(Math.Round(double.Parse(PortfolioDetails.propAllocationPercent.ToString()), 2).ToString());

                if (PortfolioDetails.propClientCurrency != PortfolioDetails.propFundCurrency)
                {
                    //_clsSwitchDetails.propUnits = computeUnits(PortfolioDetails.propAllocationPercent,
                    //                                            PortfolioDetails.propTotalCurrentValueClient,//float.Parse(PortfolioDetails.propTotalCurrentValueClient.ToString()), //float.Parse(Math.Round(double.Parse(PortfolioDetails.propTotalCurrentValueClient.ToString()), 0).ToString()),
                    //                                           clsCurrency.convertToClientCurrency(_clsPortfolioDetails[0].propClientID, PortfolioDetails.propPrice, PortfolioDetails.propFundCurrency));
                    double dConvertedValue = clsCurrency.convertToClientCurrency(_clsPortfolioDetails[0].propClientID, PortfolioDetails.propPrice, PortfolioDetails.propFundCurrency);
                    int    intMarker       = dConvertedValue.ToString().IndexOf('.');
                    string strIntegerPart  = dConvertedValue.ToString().Substring(0, intMarker);
                    string strDecimalPart  = dConvertedValue.ToString().Substring(intMarker, 4);
                    dPrice = Convert.ToDouble(strIntegerPart + strDecimalPart);
                }
                else
                {
                    //_clsSwitchDetails.propUnits = computeUnits(PortfolioDetails.propAllocationPercent,
                    //                                           PortfolioDetails.propTotalCurrentValueClient, //float.Parse(PortfolioDetails.propTotalCurrentValueClient.ToString()),//float.Parse(Math.Round(double.Parse(PortfolioDetails.propTotalCurrentValueClient.ToString()), 0).ToString()),
                    //                                           PortfolioDetails.propPrice);
                    dPrice = Math.Round(PortfolioDetails.propPrice, 4);
                }

                _clsSwitchDetails.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(_clsPortfolioDetails[0].propClientID, PortfolioDetails.propFundCurrency);
                //_clsSwitchDetails.propValue = computeValue(PortfolioDetails.propAllocationPercent, PortfolioDetails.propTotalCurrentValueClient);
                _clsSwitchDetails.propTotalValue = float.Parse(Math.Round(double.Parse(PortfolioDetails.propTotalCurrentValueClient.ToString()), 0).ToString());
                //_clsSwitchDetails.propValue = computeValue(PortfolioDetails.propAllocationPercent, _clsSwitchDetails.propTotalValue);

                fTotalAllocation = fTotalAllocation + _clsSwitchDetails.propAllocation;
                _clsSwitchDetails.propTotalAllocation = fTotalAllocation;
                _clsSwitchDetails.propIsDeletable     = false;

                _clsSwitchDetails.propValue = float.Parse(((Math.Round(_clsSwitchDetails.propAllocation, 2) / 100) * int.Parse(PortfolioDetails.propTotalCurrentValueClient.ToString())).ToString());
                _clsSwitchDetails.propUnits = Convert.ToDecimal((((Math.Round(_clsSwitchDetails.propAllocation, 2) / 100) * int.Parse(PortfolioDetails.propTotalCurrentValueClient.ToString())) / dPrice));

                listSwitchDetails.Add(_clsSwitchDetails);
            }

            return(listSwitchDetails);
        }
        public static List<clsSwitchDetails> replicatePortfolioDetails(clsPortfolio _clsPortfolio)
        {
            List<clsSwitchDetails> listSwitchDetails = new List<clsSwitchDetails>();
            float fTotalAllocation = 0;
            double dPrice = 0;

            foreach (clsPortfolioDetails PortfolioDetails in _clsPortfolio.propPortfolioDetails)
            {
                clsSwitchDetails _clsSwitchDetails = new clsSwitchDetails();
                _clsSwitchDetails.propFund = new clsFund(PortfolioDetails.propFundNameID);
                _clsSwitchDetails.propAllocation = float.Parse(Math.Round(double.Parse(PortfolioDetails.propAllocationPercent.ToString()), 2).ToString());

                if (PortfolioDetails.propClientCurrency != PortfolioDetails.propFundCurrency)
                {
                    double dConvertedValue = clsCurrency.convertToClientCurrency(_clsPortfolio.propClientID, PortfolioDetails.propPrice, PortfolioDetails.propFundCurrency);
                    int intMarker = dConvertedValue.ToString().IndexOf('.');
                    string strIntegerPart = dConvertedValue.ToString().Substring(0, intMarker);
                    string strDecimalPart = dConvertedValue.ToString().Substring(intMarker, 4);
                    dPrice = Convert.ToDouble(strIntegerPart + strDecimalPart);
                }
                else
                {
                    dPrice = Math.Round(PortfolioDetails.propPrice, 4);
                }

                _clsSwitchDetails.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(_clsPortfolio.propClientID, PortfolioDetails.propFundCurrency);
                _clsSwitchDetails.propTotalValue = float.Parse(Math.Round(double.Parse(PortfolioDetails.propTotalCurrentValueClient.ToString()), 0).ToString());

                fTotalAllocation = fTotalAllocation + _clsSwitchDetails.propAllocation;
                _clsSwitchDetails.propTotalAllocation = fTotalAllocation;
                _clsSwitchDetails.propIsDeletable = false;

                _clsSwitchDetails.propValue = float.Parse(((Math.Round(_clsSwitchDetails.propAllocation, 2) / 100) * int.Parse(Math.Round(_clsPortfolio.propTotalValue, 0).ToString())).ToString());
                _clsSwitchDetails.propUnits = Convert.ToDecimal((((Math.Round(_clsSwitchDetails.propAllocation, 2) / 100) * int.Parse(Math.Round(_clsPortfolio.propTotalValue, 0).ToString())) / dPrice));
                //_clsSwitchDetails.propValue = float.Parse(((Math.Round(_clsSwitchDetails.propAllocation, 2) / 100) * int.Parse(_clsPortfolio.propTotalValue.ToString())).ToString());
                //_clsSwitchDetails.propUnits = Convert.ToDecimal((((Math.Round(_clsSwitchDetails.propAllocation, 2) / 100) * int.Parse(_clsPortfolio.propTotalValue.ToString())) / dPrice));

                listSwitchDetails.Add(_clsSwitchDetails);
            }

            return listSwitchDetails;
          }
        public static void transferClientSwitchToIFA(List<clsSwitchDetails_Client> listClientSwitchDetails, string strUserID)
        {

            clsSwitch SwitchIFA = new clsSwitch(listClientSwitchDetails[0].propSwitchID);

            string strClientID = SwitchIFA.propClientID;
            string strPortfolioID = SwitchIFA.propPortfolioID;

            List<clsSwitchDetails> listSwitchDetailsIFA = new clsPortfolio(strClientID, strPortfolioID, strUserID).propSwitch.propSwitchDetails;

            foreach (clsSwitchDetails SwitchDetailsIFA in listSwitchDetailsIFA)
            {
                clsSwitchDetails.removeSwitchDetails(SwitchDetailsIFA.propSwitchDetailsID);
            }

            List<clsSwitchDetails> newListSwitchDetails = new List<clsSwitchDetails>();

            foreach (clsSwitchDetails_Client SwitchDetails_Client in listClientSwitchDetails)
            {
                clsSwitchDetails newSwitchDetails = new clsSwitchDetails();
                newSwitchDetails.propSwitchID = SwitchIFA.propSwitchID;
                newSwitchDetails.propFund = new clsFund(SwitchDetails_Client.propFund.propFundID);
                newSwitchDetails.propAllocation = SwitchDetails_Client.propAllocation;
                newSwitchDetails.propIsDeletable = SwitchDetails_Client.propIsDeletable;

                newListSwitchDetails.Add(newSwitchDetails);

            }

            clsSwitchDetails.insertSwitchDetails(newListSwitchDetails, strUserID, SwitchIFA.propSwitchID);
        }
        private List<clsSwitchDetails> getSwitchDetails(string strUserID, clsPortfolio Portfolio, int intSwitchID)
        {
                        
            SqlConnection con1 = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
            List<clsSwitchDetails> listSwitchDetails = new List<clsSwitchDetails>();

            SqlCommand cmd = new SqlCommand();
            SqlDataReader dr1;

            con1.Open();
            cmd.Connection = con1;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "[SWITCH_DetailsGet]";

            cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;

            dr1 = cmd.ExecuteReader();

            float fTotalAllocation = 0;

            while (dr1.Read())
            {

                clsSwitchDetails newClsSwitchDetails = new clsSwitchDetails();

                newClsSwitchDetails.propAllocation = float.Parse(Math.Round(double.Parse(dr1["Allocation"].ToString()), 2).ToString());
                newClsSwitchDetails.propCreated_By = dr1["Created_By"].ToString();
                newClsSwitchDetails.propDate_Created = DateTime.Parse(dr1["Date_Created"].ToString());
                newClsSwitchDetails.propDate_LastUpdate = DateTime.Parse(dr1["Date_LastUpdate"].ToString());
                newClsSwitchDetails.propFund = new clsFund(int.Parse(dr1["FundID"].ToString()));
                newClsSwitchDetails.propFundID = int.Parse(dr1["FundID"].ToString());
                newClsSwitchDetails.propSwitchDetailsID = int.Parse(dr1["SwitchDetailsID"].ToString());
                newClsSwitchDetails.propSwitchID = int.Parse(dr1["SwitchID"].ToString());
                newClsSwitchDetails.propUpdated_By = dr1["Updated_By"].ToString();
                newClsSwitchDetails.propIsDeletable = dr1["isDeletable"].ToString().Equals("1") ? true : false;

                if (Portfolio.propPortfolioDetails[0].propClientCurrency != newClsSwitchDetails.propFund.propCurrency)
                {
                    newClsSwitchDetails.propUnits = clsSwitchDetails.computeUnits(newClsSwitchDetails.propAllocation,
                                                                                  float.Parse(Math.Round(double.Parse(Portfolio.propPortfolioDetails[0].propTotalCurrentValueClient.ToString()), 0).ToString()),
                                                                                  clsCurrency.convertToClientCurrency(this.propClientID, newClsSwitchDetails.propFund.propPrice, newClsSwitchDetails.propFund.propCurrency));
                }
                else
                {
                    newClsSwitchDetails.propUnits = clsSwitchDetails.computeUnits(newClsSwitchDetails.propAllocation,
                                                                                  float.Parse(Math.Round(double.Parse(Portfolio.propPortfolioDetails[0].propTotalCurrentValueClient.ToString()), 0).ToString()),
                                                                                  newClsSwitchDetails.propFund.propPrice);
                }


                newClsSwitchDetails.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(this.propClientID, newClsSwitchDetails.propFund.propCurrency);
                //newClsSwitchDetails.propValue = clsSwitchDetails.computeValue(newClsSwitchDetails.propAllocation, Portfolio.propPortfolioDetails[0].propTotalCurrentValueClient);
                newClsSwitchDetails.propTotalValue = float.Parse(Math.Round(double.Parse(Portfolio.propPortfolioDetails[0].propTotalCurrentValueClient.ToString()), 0).ToString());
                newClsSwitchDetails.propValue = clsSwitchDetails.computeValue(newClsSwitchDetails.propAllocation, newClsSwitchDetails.propTotalValue);


                fTotalAllocation = fTotalAllocation + newClsSwitchDetails.propAllocation;
                newClsSwitchDetails.propTotalAllocation = fTotalAllocation;

                listSwitchDetails.Add(newClsSwitchDetails);

            }
            con1.Close();
            cmd.Dispose();
            con1.Dispose();

            return listSwitchDetails;
        }
Exemple #7
0
        public List<clsSwitchDetails> combineModelAndPortfolioDetails(clsPortfolio _clsPortfolio, int intModelID, string _strModelGroupID, string _strModelPortfolioID)
        {
            List<clsSwitchDetails> listSwitchDetails = new List<clsSwitchDetails>();
            List<clsSwitchDetails> listPortfolioDetails = clsSwitchDetails.replicatePortfolioDetails(_clsPortfolio);
            List<clsSwitchDetails> listModelPortfolioDetails = replicateModelPortfolio(_clsPortfolio, intModelID, _strModelGroupID, _strModelPortfolioID);

            foreach (clsSwitchDetails origSwitchDetails in listPortfolioDetails)
            {
                foreach (clsSwitchDetails modelSwitchDetails in listModelPortfolioDetails)
                {
                    if (origSwitchDetails.propFundID != modelSwitchDetails.propFundID)
                    {
                        origSwitchDetails.propAllocation = 0;
                        origSwitchDetails.propValue = 0;
                        origSwitchDetails.propUnits = 0;
                    }
                }
                listSwitchDetails.Add(origSwitchDetails);
            }
            foreach (clsSwitchDetails modelSwitchDetails in listModelPortfolioDetails)
            {
                clsSwitchDetails item = new clsSwitchDetails();
                foreach (clsSwitchDetails origSwitchDetails in listPortfolioDetails)
                {
                    if (modelSwitchDetails.propFundID != origSwitchDetails.propFundID)
                    {
                        item = modelSwitchDetails;
                    }
                }
                listSwitchDetails.Add(item);
            }

            return listSwitchDetails;
        }
Exemple #8
0
        public List <clsSwitchDetails> replicateModelPortfolio(clsPortfolio _clsPortfolio, int _intModelID, string _strModelGroupID, string _strModelPortfolioID)
        {
            SqlConnection           con1 = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
            List <clsSwitchDetails> listSwitchDetails = new List <clsSwitchDetails>();

            SqlCommand    cmd = new SqlCommand();
            SqlDataReader dr1;

            con1.Open();
            cmd.Connection  = con1;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "[SWITCH_ModelPortfolioDetailsGet]";

            cmd.Parameters.Add("@param_ModelID", System.Data.SqlDbType.Int).Value               = _intModelID;
            cmd.Parameters.Add("@param_ModelGroupID", System.Data.SqlDbType.NVarChar).Value     = _strModelGroupID;
            cmd.Parameters.Add("@param_ModelPortfolioID", System.Data.SqlDbType.NVarChar).Value = _strModelPortfolioID;

            dr1 = cmd.ExecuteReader();

            float fTotalAllocation = 0;

            while (dr1.Read())
            {
                clsSwitchDetails newClsSwitchDetails = new clsSwitchDetails();

                newClsSwitchDetails.propAllocation = float.Parse(Math.Round(double.Parse(dr1["Allocation"].ToString()), 2).ToString());
                //newClsSwitchDetails.propCreated_By = //dr1["Created_By"].ToString();
                //newClsSwitchDetails.propDate_Created = DateTime.Parse(dr1["Date_Created"].ToString());
                //newClsSwitchDetails.propDate_LastUpdate = DateTime.Parse(dr1["Date_Updated"].ToString());
                newClsSwitchDetails.propFund   = new clsFund(int.Parse(dr1["FundID"].ToString()));
                newClsSwitchDetails.propFundID = int.Parse(dr1["FundID"].ToString());
                //newClsSwitchDetails.propSwitchDetailsID = int.Parse(dr1["SwitchDetailsID"].ToString());
                //newClsSwitchDetails.propSwitchID = int.Parse(dr1["SwitchID"].ToString());
                //newClsSwitchDetails.propUpdated_By = dr1["Updated_By"].ToString();
                newClsSwitchDetails.propIsDeletable = dr1["isDeletable"].ToString().Equals("1") ? true : false;

                //if (Portfolio.propPortfolioDetails[0].propClientCurrency != newClsSwitchDetails.propFund.propCurrency)
                if (_clsPortfolio.propClient.propCurrency != newClsSwitchDetails.propFund.propCurrency)
                {
                    newClsSwitchDetails.propUnits = clsSwitchDetails.computeUnits(newClsSwitchDetails.propAllocation,
                                                                                  float.Parse(Math.Round(double.Parse(_clsPortfolio.propPortfolioDetails[0].propTotalCurrentValueClient.ToString()), 0).ToString()),
                                                                                  clsCurrency.convertToClientCurrency(_clsPortfolio.propClientID, newClsSwitchDetails.propFund.propPrice, newClsSwitchDetails.propFund.propCurrency));
                }
                else
                {
                    newClsSwitchDetails.propUnits = clsSwitchDetails.computeUnits(newClsSwitchDetails.propAllocation,
                                                                                  float.Parse(Math.Round(double.Parse(_clsPortfolio.propPortfolioDetails[0].propTotalCurrentValueClient.ToString()), 0).ToString()),
                                                                                  newClsSwitchDetails.propFund.propPrice);
                }


                newClsSwitchDetails.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(_clsPortfolio.propClientID, newClsSwitchDetails.propFund.propCurrency);
                //newClsSwitchDetails.propValue = clsSwitchDetails.computeValue(newClsSwitchDetails.propAllocation, Portfolio.propPortfolioDetails[0].propTotalCurrentValueClient);
                newClsSwitchDetails.propTotalValue = float.Parse(Math.Round(double.Parse(_clsPortfolio.propPortfolioDetails[0].propTotalCurrentValueClient.ToString()), 0).ToString());
                newClsSwitchDetails.propValue      = clsSwitchDetails.computeValue(newClsSwitchDetails.propAllocation, newClsSwitchDetails.propTotalValue);


                fTotalAllocation = fTotalAllocation + newClsSwitchDetails.propAllocation;
                newClsSwitchDetails.propTotalAllocation = fTotalAllocation;

                listSwitchDetails.Add(newClsSwitchDetails);
            }
            con1.Close();
            cmd.Dispose();
            con1.Dispose();

            return(listSwitchDetails);
        }