protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ((NAV)this.Page.Master).FindControl("btnBack_Classic").Visible=false;
                strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString();
                ViewState["SwitchID"] = int.Parse(Request.QueryString["SwitchID"].ToString());
                ViewState["ClientID"] = Request.QueryString["ClientID"].ToString();
                ViewState["PortfolioID"] = Request.QueryString["PortfolioID"].ToString();

                strClientID = ViewState["ClientID"].ToString();
                strPortfolioID = ViewState["PortfolioID"].ToString();
                intSwitchID = (int)ViewState["SwitchID"];

                string strPortfolioForename = Request.QueryString["PortfolioForename"].ToString();
                string strPortfolioSurname = Request.QueryString["PortfolioSurname"].ToString();

                string strPortfolioName = string.Format("{0} {1}",strPortfolioForename, strPortfolioSurname);

                clsPortfolio oPortfolio = new clsPortfolio(strClientID, strPortfolioID, strUserID);

                ViewState["Company"] = oPortfolio.propCompany;
                
                populateHeader(oPortfolio, strPortfolioName);
                populateSwitchDetails(oPortfolio.propSwitch);
            }
        }
Пример #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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        protected void getModelGroupInfo(clsPortfolio Portfolio, string strModelGroupID, string strModelPortfolioID, int intIFA_ID)
        {
            
            SqlCommand cmd = new SqlCommand();
            SqlDataReader dr;

            con.Open();
            cmd.Connection = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "SWITCH_ModelGroupGet";

            cmd.Parameters.Add("@param_ModelGroupID", System.Data.SqlDbType.NVarChar).Value = strModelGroupID;
            cmd.Parameters.Add("@param_IFA_ID", System.Data.SqlDbType.Int).Value = intIFA_ID;

            dr = cmd.ExecuteReader();

            while(dr.Read())
            {
                this.strModelGroupID = dr["ClientID"].ToString();
                this.strModelGroupName = dr["Forenames"].ToString();
                this.intIFA_ID = int.Parse(dr["ClientNumber"].ToString());
                this.intModelGroupCode = int.Parse(dr["IFA_ID"].ToString());
                this._clsModelPortfolio = new clsModelPortfolio(Portfolio, strModelGroupID, strModelPortfolioID);
            }
            dr.Dispose();
            cmd.Connection.Close();
            cmd.Dispose();
            con.Close();
            //con.Dispose();
        }
Пример #5
0
        protected void getModelGroupInfo(clsPortfolio Portfolio, string strModelGroupID, string strModelPortfolioID, int intIFA_ID)
        {
            SqlCommand    cmd = new SqlCommand();
            SqlDataReader dr;

            con.Open();
            cmd.Connection  = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "SWITCH_ModelGroupGet";

            cmd.Parameters.Add("@param_ModelGroupID", System.Data.SqlDbType.NVarChar).Value = strModelGroupID;
            cmd.Parameters.Add("@param_IFA_ID", System.Data.SqlDbType.Int).Value            = intIFA_ID;

            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                this.strModelGroupID    = dr["ClientID"].ToString();
                this.strModelGroupName  = dr["Forenames"].ToString();
                this.intIFA_ID          = int.Parse(dr["ClientNumber"].ToString());
                this.intModelGroupCode  = int.Parse(dr["IFA_ID"].ToString());
                this._clsModelPortfolio = new clsModelPortfolio(Portfolio, strModelGroupID, strModelPortfolioID);
            }
            dr.Dispose();
            cmd.Connection.Close();
            cmd.Dispose();
            con.Close();
            //con.Dispose();
        }
Пример #6
0
        private void getSwitchInfo(clsPortfolio Portfolio, string strUserID)
        {
            SqlCommand    cmd = new SqlCommand();
            SqlDataReader dr;

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

            cmd.Parameters.Add("@param_strPortfolioID", System.Data.SqlDbType.NVarChar).Value = Portfolio.propPortfolioID;
            cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value    = Portfolio.propClientID;

            dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    this.propClientID      = dr["ClientID"].ToString();
                    this.propDate_Created  = DateTime.Parse(dr["Date_Created"].ToString());
                    this.propPortfolioID   = dr["PortfolioID"].ToString();
                    this.propStatus        = short.Parse(dr["Status"].ToString());
                    this.propStatusString  = getSwitchStringStatus(this.propStatus);
                    this.propSwitchID      = int.Parse(dr["SwitchID"].ToString());
                    this.propSwitchDetails = getSwitchDetails(strUserID, Portfolio, this.propSwitchID);
                    this.propPortfolio     = new clsPortfolio(propClientID, propPortfolioID);
                    if (propStatus == (int)enumSwitchStatus.Declined_Client)
                    {
                        foreach (clsSwitchDetails Details in this.propSwitchDetails)
                        {
                            clsSwitchDetails.removeSwitchDetails(Details.propSwitchDetailsID);
                        }
                        this.propSwitchDetails = clsSwitchDetails.replicatePortfolioDetails(Portfolio.propPortfolioDetails, propSwitchID);
                    }

                    this.propCreated_By  = dr["Created_By"].ToString();
                    this.propDescription = dr["Description"].ToString();
                }
            }
            else
            {
                this.propSwitchID      = 0;
                this.propPortfolioID   = Portfolio.propPortfolioID;
                this.propClientID      = Portfolio.propClientID;
                this.propStatus        = (short)enumSwitchStatus.Saved;
                this.propStatusString  = getSwitchStringStatus(this.propStatus);
                this.propCreated_By    = strUserID;
                this.propSwitchDetails = clsSwitchDetails.replicatePortfolioDetails(Portfolio);
                this.propPortfolio     = new clsPortfolio(propClientID, propPortfolioID);
            }

            dr.Close();
            con.Close();
            cmd.Dispose();
            //con.Dispose();
        }
Пример #7
0
        //private void getHeaderInfo(int intSwitchID)
        //{
        //    SqlCommand cmd = new SqlCommand();
        //    SqlDataReader dr;
        //    con.Open();
        //    cmd.Connection = con;
        //    cmd.CommandType = System.Data.CommandType.StoredProcedure;
        //    cmd.CommandText = "[SWITCH_Temp_HeaderGet]";

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

        //    dr = cmd.ExecuteReader();

        //    if (dr.HasRows)
        //    {

        //        while (dr.Read())
        //        {

        //            this.propClientID = dr["ClientID"].ToString();
        //            this.propDate_Created = DateTime.Parse(dr["Date_Created"].ToString());
        //            this.propPortfolioID = dr["PortfolioID"].ToString();
        //            this.propStatus = short.Parse(dr["Status"].ToString());
        //            //this.propStatusString = getSwitchStringStatus(this.propStatus);
        //            this.propSwitchID = int.Parse(dr["SwitchID"].ToString());
        //            this.propCreated_By = dr["Created_By"].ToString();
        //            this.propDescription = dr["Description"].ToString();
        //        }
        //    }

        //    dr.Close();
        //    con.Close();
        //    cmd.Dispose();
        //    con.Dispose();
        //}

        private void getSwitchInfo(clsPortfolio Portfolio, string strUserID, int intIFA_ID, int _intModelID, string strModelGroupID, string strModelPortfolioID)
        {
            SqlCommand    cmd = new SqlCommand();
            SqlDataReader dr;

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

            cmd.Parameters.Add("@param_intIFA_ID", System.Data.SqlDbType.Int).Value             = intIFA_ID;
            cmd.Parameters.Add("@param_intModelID", 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;
            cmd.Parameters.Add("@param_strPortfolioID", System.Data.SqlDbType.NVarChar).Value   = Portfolio.propPortfolioID;
            cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value      = Portfolio.propClientID;

            dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    this.intModelID       = int.Parse(dr["ModelID"].ToString());
                    this.propClientID     = dr["ClientID"].ToString();
                    this.propDate_Created = DateTime.Parse(dr["Date_Created"].ToString());
                    this.propPortfolioID  = dr["PortfolioID"].ToString();
                    //this.propStatus = short.Parse(dr["Status"].ToString());
                    //this.propStatusString = clsSwitch.getSwitchStringStatus(this.propStatus);
                    //if (propStatus == (int)enumSwitchStatus.Declined_Client)
                    //{
                    //    this.propSwitchDetails = clsSwitchDetails.replicatePortfolioDetails(Portfolio);
                    //}
                    //else
                    //{
                    this.propSwitchDetails = this.getSwitchDetails(Portfolio, Portfolio.propClientID, Portfolio.propPortfolioID);
                    //}
                    this.propCreated_By  = dr["Created_By"].ToString();
                    this.propDescription = dr["Description"].ToString();
                }
            }
            else
            {
                this.propPortfolioID   = Portfolio.propPortfolioID;
                this.propClientID      = Portfolio.propClientID;
                this.propStatus        = (short)clsSwitch.enumSwitchStatus.Saved;
                this.propStatusString  = clsSwitch.getSwitchStringStatus(this.propStatus);
                this.propCreated_By    = strUserID;
                this.propSwitchDetails = this.combineModelAndPortfolioDetails(Portfolio, _intModelID, Portfolio.propModelGroupID, Portfolio.propModelPortfolioID);
            }

            dr.Close();
            con.Close();
            cmd.Dispose();
            //con.Dispose();
        }
        protected void btnSMSResetSend_Click(object sender, EventArgs e)
        {
            strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString();
            strClientID = ViewState["ClientID"].ToString();
            strPortfolioID = ViewState["PortfolioID"].ToString();
            int intSwitchID = (int)ViewState["SwitchID"];
            string strPortfolioName = ViewState["Company"].ToString();
            string strPopupMessage = "The selected portfolio has been reset.";
            string strSMSMobileNo = this.txtMobileNoResetCode.Text.Trim();
            doSwitch(intSwitchID, strPortfolioName, clsSMS.subclsSMSTemplate.enumSMSTemplateID.Reset, strPopupMessage, strSMSMobileNo);

            clsPortfolio oPortfolio = new clsPortfolio(strClientID, strPortfolioID, strUserID);
            populateSwitchDetails(oPortfolio.propSwitch);
        }
 private void populateHeader(clsPortfolio _clsPortfolio, string strPortfolioName)
 {
     this.lblValue_PortfolioName.Text = strPortfolioName;
     this.lblValue_Company.Text = _clsPortfolio.propCompany;
     this.lblValue_PortfolioType.Text = _clsPortfolio.propPortfolioType;
     this.lblValue_Currency.Text = _clsPortfolio.propPortfolioCurrency;
     this.lblValue_AccountNumber.Text = _clsPortfolio.propAccountNumber;
     this.lblValue_PlanStatus.Text = _clsPortfolio.propPlanStatus;
     this.lblValue_StartDate.Text = _clsPortfolio.propPortfolioStartDate.ToString("dd/MM/yyyy");
     this.lblValue_PolicyCategory.Text = _clsPortfolio.propLiquidity;
     this.lblValue_Profile.Text = _clsPortfolio.propRiskProfile;
     this.lblValue_SpecialistInformation.Text = _clsPortfolio.propRetentionTerm;
     //this.lblValue_Discretionary.Text = _clsPortfolio.propMFPercent == 0 ? "no" : "yes";
     this.lblValue_Discretionary.Text = _clsPortfolio.propPortfolioDetails[0].propMFPercent == 0 ? "no" : "yes";
 }
Пример #10
0
 private void populateHeader(clsPortfolio _clsPortfolio)
 {
     this.lblValue_PortfolioName.Text         = _clsPortfolio.propClient.propForename + " " + _clsPortfolio.propClient.propSurname;
     this.lblValue_Company.Text               = _clsPortfolio.propCompany;
     this.lblValue_PortfolioType.Text         = _clsPortfolio.propPortfolioType;
     this.lblValue_Currency.Text              = _clsPortfolio.propPortfolioCurrency;
     this.lblValue_AccountNumber.Text         = _clsPortfolio.propAccountNumber;
     this.lblValue_PlanStatus.Text            = _clsPortfolio.propPlanStatus;
     this.lblValue_StartDate.Text             = _clsPortfolio.propPortfolioStartDate.ToString("dd/MM/yyyy");
     this.lblValue_PolicyCategory.Text        = _clsPortfolio.propLiquidity;
     this.lblValue_Profile.Text               = _clsPortfolio.propRiskProfile;
     this.lblValue_SpecialistInformation.Text = _clsPortfolio.propRetentionTerm;
     //this.lblValue_Discretionary.Text = _clsPortfolio.propMFPercent == 0 ? "no" : "yes";
     this.lblValue_Discretionary.Text = _clsPortfolio.propPortfolioDetails[0].propMFPercent == 0 ? "no" : "yes";
 }
Пример #11
0
        protected void btnSMSResetSend_Click(object sender, EventArgs e)
        {
            strUserID      = Session[clsSystem_Session.strSession.User.ToString()].ToString();
            strClientID    = ViewState["ClientID"].ToString();
            strPortfolioID = ViewState["PortfolioID"].ToString();
            int    intSwitchID      = (int)ViewState["SwitchID"];
            string strPortfolioName = ViewState["Company"].ToString();
            string strPopupMessage  = "The selected portfolio has been reset.";
            string strSMSMobileNo   = this.txtMobileNoResetCode.Text.Trim();

            doSwitch(intSwitchID, strPortfolioName, clsSMS.subclsSMSTemplate.enumSMSTemplateID.Reset, strPopupMessage, strSMSMobileNo);

            clsPortfolio oPortfolio = new clsPortfolio(strClientID, strPortfolioID, strUserID);

            populateSwitchDetails(oPortfolio.propSwitch);
        }
Пример #12
0
        private void getModelPortfolioInfo(clsPortfolio Portfolio, string strModelGroupID, string strModelPortfolioID)
        {
            SqlCommand    cmd = new SqlCommand();
            SqlDataReader dr;

            con.Open();
            cmd.Connection  = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "SWITCH_ModelPortfolioGet";

            cmd.Parameters.Add("@param_ModelGroupID", System.Data.SqlDbType.NVarChar).Value     = strModelGroupID;
            cmd.Parameters.Add("@param_ModelPortfolioID", System.Data.SqlDbType.NVarChar).Value = strModelPortfolioID;

            dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    this.intModelID            = int.Parse(dr["ModelID"].ToString());
                    this.strModelPortfolioID   = dr["ModelPortfolioID"].ToString();
                    this.strModelGroupID       = dr["ModelGroupID"].ToString();
                    this.strModelPortfolioName = dr["ModelPortfolioName"].ToString();
                    this.strModelPortfolioDesc = dr["ModelPortfolioDesc"].ToString();
                    this.isConsumed            = dr["IsConsumed"].ToString().Equals("1") ? true : false;
                    this.ModelPortfolioDetails = clsModelPortfolioDetails.getModelPortfolioDetails(Portfolio, this.intModelID, this.strModelGroupID, this.strModelPortfolioID);
                }
            }
            else
            {
                this.intModelID            = 0;
                this.strModelGroupID       = Portfolio.propClientID;
                this.strModelPortfolioID   = Portfolio.propPortfolioID;
                this.strModelPortfolioName = Portfolio.propAccountNumber;
                this.isConsumed            = false;
                this.ModelPortfolioDetails = clsModelPortfolioDetails.replicatePortfolioDetails(Portfolio.propPortfolioDetails);
            }
            dr.Dispose();
            cmd.Connection.Close();
            cmd.Dispose();
            con.Close();
            //con.Dispose();
        }
Пример #13
0
        private void getModelPortfolioInfo(clsPortfolio Portfolio, string strModelGroupID, string strModelPortfolioID)
        {
            SqlCommand cmd = new SqlCommand();
            SqlDataReader dr;

            con.Open();
            cmd.Connection = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "SWITCH_ModelPortfolioGet";

            cmd.Parameters.Add("@param_ModelGroupID", System.Data.SqlDbType.NVarChar).Value = strModelGroupID;
            cmd.Parameters.Add("@param_ModelPortfolioID", System.Data.SqlDbType.NVarChar).Value = strModelPortfolioID;

            dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    this.intModelID = int.Parse(dr["ModelID"].ToString());
                    this.strModelPortfolioID = dr["ModelPortfolioID"].ToString();
                    this.strModelGroupID = dr["ModelGroupID"].ToString();
                    this.strModelPortfolioName = dr["ModelPortfolioName"].ToString();
                    this.strModelPortfolioDesc = dr["ModelPortfolioDesc"].ToString();
                    this.isConsumed = dr["IsConsumed"].ToString().Equals("1") ? true : false;
                    this.ModelPortfolioDetails = clsModelPortfolioDetails.getModelPortfolioDetails(Portfolio, this.intModelID, this.strModelGroupID, this.strModelPortfolioID);
                }
            }
            else
            {
                this.intModelID = 0;
                this.strModelGroupID = Portfolio.propClientID;
                this.strModelPortfolioID = Portfolio.propPortfolioID;
                this.strModelPortfolioName = Portfolio.propAccountNumber;
                this.isConsumed = false;
                this.ModelPortfolioDetails = clsModelPortfolioDetails.replicatePortfolioDetails(Portfolio.propPortfolioDetails);
            }
            dr.Dispose();
            cmd.Connection.Close();
            cmd.Dispose();
            con.Close();
            //con.Dispose();
        }
Пример #14
0
        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);
        }
Пример #15
0
        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;
          }
Пример #16
0
        public static List <clsPortfolio> getClientListWithModel(int intIFA_ID, int intModelID, string strModelGroupID, string strModelPortfolioID, string strSortBy)
        {
            List <clsPortfolio> clsPortfolioList = new List <clsPortfolio>();
            SqlConnection       con = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
            SqlCommand          cmd = new SqlCommand();
            SqlDataReader       dr;

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

            cmd.Parameters.Add("@param_IFA_ID", System.Data.SqlDbType.Int).Value                = intIFA_ID;
            cmd.Parameters.Add("@param_ModelID", System.Data.SqlDbType.NVarChar).Value          = intModelID;
            cmd.Parameters.Add("@param_ModelGroupID", System.Data.SqlDbType.NVarChar).Value     = strModelGroupID;
            cmd.Parameters.Add("@param_ModelPortfolioID", System.Data.SqlDbType.NVarChar).Value = strModelPortfolioID;
            cmd.Parameters.Add("@param_SortBy", System.Data.SqlDbType.NVarChar).Value           = strSortBy;

            dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                clsPortfolio _clsPortfolio = new clsPortfolio();
                _clsPortfolio.propModelID                = intModelID;
                _clsPortfolio.propModelGroupID           = dr["ModelGroupID"].ToString();
                _clsPortfolio.propModelPortfolioID       = dr["ModelPortfolioID"].ToString();
                _clsPortfolio.propClientID               = dr["ClientID"].ToString();
                _clsPortfolio.propClient                 = new clsClient(_clsPortfolio.propClientID);
                _clsPortfolio.propPortfolioID            = dr["ClientPortfolioID"].ToString();
                _clsPortfolio.propCompany                = dr["ClientPortfolioCompany"].ToString();
                _clsPortfolio.propAccountNumber          = dr["ClientPortfolioAccountNumber"].ToString();
                _clsPortfolio.propMFPercent              = int.Parse(dr["Discretionary"].ToString());
                _clsPortfolio.propSwitch                 = new clsSwitch();
                _clsPortfolio.propSwitch.propSwitchID    = int.Parse(dr["SwitchID"].ToString());
                _clsPortfolio.propSwitchTemp             = new clsSwitchTemp();
                _clsPortfolio.propSwitchTemp.propModelID = int.Parse(dr["SwitchTemp"].ToString());
                clsPortfolioList.Add(_clsPortfolio);
            }
            return(clsPortfolioList);
        }
Пример #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ((NAV)this.Page.Master).FindControl("btnBack_Classic").Visible = false;
                strUserID                = Session[clsSystem_Session.strSession.User.ToString()].ToString();
                ViewState["SwitchID"]    = int.Parse(Request.QueryString["SwitchID"].ToString());
                ViewState["ClientID"]    = Request.QueryString["ClientID"].ToString();
                ViewState["PortfolioID"] = Request.QueryString["PortfolioID"].ToString();

                strClientID    = ViewState["ClientID"].ToString();
                strPortfolioID = ViewState["PortfolioID"].ToString();
                intSwitchID    = (int)ViewState["SwitchID"];

                clsPortfolio oPortfolio = new clsPortfolio(strClientID, strPortfolioID, strUserID);

                ViewState["Company"] = oPortfolio.propCompany;

                populateHeader(oPortfolio);
                populateSwitchDetails(oPortfolio.propSwitch);
            }
        }
Пример #18
0
        public static clsModelGroup getModelPortfolioClientList(string strIFACode, string strModelGroup, string strModelName)
        {
            clsModelGroup       _clsModelGroup = new clsModelGroup();
            List <clsPortfolio> listPortfolio  = new List <clsPortfolio>();
            SqlConnection       con            = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
            SqlCommand          cmd            = new SqlCommand();
            SqlDataReader       dr;
            string strClientID    = string.Empty;
            string strPortfolioID = string.Empty;

            con.Open();
            cmd.Connection  = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "SWITCH_ModelPortfolioClientGet";

            cmd.Parameters.Add("", System.Data.SqlDbType.NVarChar).Value = strIFACode;
            cmd.Parameters.Add("", System.Data.SqlDbType.NVarChar).Value = strModelGroup;
            cmd.Parameters.Add("", System.Data.SqlDbType.NVarChar).Value = strModelName;

            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                _clsModelGroup.propModelID    = dr["ModelID"].ToString();
                _clsModelGroup.propModelIFA   = dr["ModelIFA"].ToString();
                _clsModelGroup.propModelGroup = dr["ModelGroup"].ToString();
                _clsModelGroup.propModelName  = dr["ModelName"].ToString();

                strClientID    = dr["ClientID"].ToString();
                strPortfolioID = dr["ClientPortfolioID"].ToString();

                clsPortfolio _clsPortfolio = new clsPortfolio();
                //_clsPortfolio.(strClientID, strPortfolioID);
                _clsPortfolio.propClient = new clsClient(strClientID);
                listPortfolio.Add(_clsPortfolio);
            }
            return(_clsModelGroup);
        }
Пример #19
0
 public static string generateApprovedSwitch(clsPortfolio Portfolio, int IFAID)
 {
     string resultingRow = string.Empty;
     foreach (clsPortfolioDetails SwitchDetails in Portfolio.propPortfolioDetails)
     {
         string myRow = ROWDETAILS.Replace("{^row$}", clsOutput.CELLDETAILS);
         myRow = myRow.Replace("{^FundCompany$}", (new clsFund(SwitchDetails.propFundNameID)).propCompanyID.ToString());
         myRow = myRow.Replace("{^FundName$}", SwitchDetails.propNameOfFund);
         myRow = myRow.Replace("{^InsurComp$}", "None"); 
         myRow = myRow.Replace("{^SEDOL$}", (new clsFund(SwitchDetails.propFundNameID)).propSEDOL);
         myRow = myRow.Replace("{^%Portfolio$}", SwitchDetails.propAllocationPercent.ToString("N2") + "%");
         resultingRow += myRow;
     }
     clsClient client = new clsClient(Portfolio.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$}", Portfolio.propCompany);
     html = html.Replace("{^PType$}", Portfolio.propPortfolioType);
     html = html.Replace("{^DateTransmit$}", "?"); // DateTime.Now.ToString("MM-dd-yyyy")); //-->Temporary
     html = html.Replace("{^Curr$}", Portfolio.propPortfolioCurrency);
     html = html.Replace("{^AccNum$}", Portfolio.propAccountNumber);
     html = html.Replace("{^DateApprv$}", DateTime.Now.ToString("MM-dd-yyyy") ?? String.Empty);// Portfolio.propSwitch.propDate_Created.ToString("MM-dd-yyyy") ?? string.Empty);
     clsCompany company = new clsCompany(Portfolio.propCompanyID);
     //throw new Exception(company.propSignedConfirmation.ToString());
     if (company.propSignedConfirmation)
     {
         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;
 }
Пример #20
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);
        }
Пример #21
0
 public clsOutput(clsPortfolio Portfolio)
     : this()
 {
     this._Portfolio = Portfolio;
 }
Пример #22
0
        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;
        }
Пример #23
0
 public clsSwitch(clsPortfolio Portfolio, string strUserID)
 {
     getSwitchInfo(Portfolio, strUserID);
 }
Пример #24
0
        public static clsModelGroup getModelPortfolioClientList(string strIFACode, string strModelGroup, string strModelName)
        {
            clsModelGroup _clsModelGroup = new clsModelGroup();
            List<clsPortfolio> listPortfolio = new List<clsPortfolio>();
            SqlConnection con = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
            SqlCommand cmd = new SqlCommand();
            SqlDataReader dr;
            string strClientID = string.Empty;
            string strPortfolioID = string.Empty;
            con.Open();
            cmd.Connection = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "SWITCH_ModelPortfolioClientGet";

            cmd.Parameters.Add("", System.Data.SqlDbType.NVarChar).Value = strIFACode;
            cmd.Parameters.Add("", System.Data.SqlDbType.NVarChar).Value = strModelGroup;
            cmd.Parameters.Add("", System.Data.SqlDbType.NVarChar).Value = strModelName;

            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                _clsModelGroup.propModelID = dr["ModelID"].ToString();
                _clsModelGroup.propModelIFA = dr["ModelIFA"].ToString();
                _clsModelGroup.propModelGroup = dr["ModelGroup"].ToString();
                _clsModelGroup.propModelName = dr["ModelName"].ToString();

                strClientID = dr["ClientID"].ToString();
                strPortfolioID = dr["ClientPortfolioID"].ToString();

                clsPortfolio _clsPortfolio = new clsPortfolio();
                //_clsPortfolio.(strClientID, strPortfolioID);
                _clsPortfolio.propClient = new clsClient(strClientID);
                listPortfolio.Add(_clsPortfolio);
            }
            return _clsModelGroup;
        }
Пример #25
0
 public clsOutput(clsPortfolio Portfolio)
     : this()
 {
     this._Portfolio = Portfolio;
 }
Пример #26
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;
        }
Пример #27
0
 public clsSwitchTemp(clsPortfolio Portfolio, string strUserID, int intIFA_ID, int intModelID, string strModelGroupID, string strModelPortfolioID)
 {
     getSwitchInfo(Portfolio, strUserID, intIFA_ID, intModelID, strModelGroupID, strModelPortfolioID);
 }
Пример #28
0
        private void getSwitchInfo(clsPortfolio Portfolio, string strUserID)
        { 
            SqlCommand cmd = new SqlCommand();
            SqlDataReader dr;
            con.Open();
            cmd.Connection = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "[SWITCH_HeaderGet]";

            cmd.Parameters.Add("@param_strPortfolioID", System.Data.SqlDbType.NVarChar).Value = Portfolio.propPortfolioID;
            cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value = Portfolio.propClientID;
                                   
            dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {

                while (dr.Read())
                {

                    this.propClientID = dr["ClientID"].ToString();
                    this.propDate_Created = DateTime.Parse(dr["Date_Created"].ToString());
                    this.propPortfolioID = dr["PortfolioID"].ToString();
                    this.propStatus = short.Parse(dr["Status"].ToString());
                    this.propStatusString = getSwitchStringStatus(this.propStatus);
                    this.propSwitchID = int.Parse(dr["SwitchID"].ToString());
                    this.propSwitchDetails = getSwitchDetails(strUserID, Portfolio, this.propSwitchID);

                    if (propStatus == (int)enumSwitchStatus.Declined_Client)
                    {
                        foreach (clsSwitchDetails Details in this.propSwitchDetails)
                        {
                            clsSwitchDetails.removeSwitchDetails(Details.propSwitchDetailsID);
                        }
                        this.propSwitchDetails = clsSwitchDetails.replicatePortfolioDetails(Portfolio.propPortfolioDetails, propSwitchID);
                    }
                  
                    this.propCreated_By = dr["Created_By"].ToString();
                    this.propDescription = dr["Description"].ToString();
                }
            }
            else {
                this.propSwitchID = 0;
                this.propPortfolioID = Portfolio.propPortfolioID;
                this.propClientID = Portfolio.propClientID;
                this.propStatus = (short)enumSwitchStatus.Saved;
                this.propStatusString = getSwitchStringStatus(this.propStatus);
                this.propCreated_By = strUserID;
                this.propSwitchDetails = clsSwitchDetails.replicatePortfolioDetails(Portfolio.propPortfolioDetails);                    
            }

            dr.Close();
            con.Close();
            cmd.Dispose();
            //con.Dispose();
        }
Пример #29
0
 public clsModelGroup(clsPortfolio Portfolio, string strModelGroupID, string strModelPortfolioID, int intIFA_ID)
 {
     getModelGroupInfo(Portfolio, strModelGroupID, strModelPortfolioID, intIFA_ID);
 }
        public static List <clsModelPortfolioDetails> getModelPortfolioDetails(clsPortfolio Portfolio, int intModelID, string strModelGroupID, string strModolPortfolioID)
        {
            SqlConnection con = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
            List <clsModelPortfolioDetails> listModelPortfolioDetails = new List <clsModelPortfolioDetails>();

            SqlCommand    cmd = new SqlCommand();
            SqlDataReader dr1;

            //con1.Open();
            con.Open();
            cmd.Connection  = con;//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 = strModolPortfolioID;

            dr1 = cmd.ExecuteReader();

            float fTotalAllocation = 0;

            while (dr1.Read())
            {
                clsModelPortfolioDetails ModelPortfolioDetails = new clsModelPortfolioDetails();

                ModelPortfolioDetails.propModelID     = int.Parse(dr1["ModelID"].ToString());
                ModelPortfolioDetails.propAllocation  = float.Parse(Math.Round(double.Parse(dr1["Allocation"].ToString()), 2).ToString());
                ModelPortfolioDetails.propFund        = new clsFund(int.Parse(dr1["FundID"].ToString()));
                ModelPortfolioDetails.propFundID      = int.Parse(dr1["FundID"].ToString());
                ModelPortfolioDetails.propIsDeletable = dr1["isDeletable"].ToString().Equals("1") ? true : false;

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


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


                fTotalAllocation = fTotalAllocation + ModelPortfolioDetails.propAllocation;
                ModelPortfolioDetails.propTotalAllocation = fTotalAllocation;

                listModelPortfolioDetails.Add(ModelPortfolioDetails);
            }
            //con1.Close();
            con.Close();
            cmd.Dispose();
            //con1.Dispose();
            con.Dispose();

            return(listModelPortfolioDetails);
        }
        public static List<clsModelPortfolioDetails> getModelPortfolioDetails(clsPortfolio Portfolio, int intModelID, string strModelGroupID, string strModolPortfolioID)
        {

            SqlConnection con = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
            List<clsModelPortfolioDetails> listModelPortfolioDetails = new List<clsModelPortfolioDetails>();

            SqlCommand cmd = new SqlCommand();
            SqlDataReader dr1;

            //con1.Open();
            con.Open();
            cmd.Connection = con;//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 = strModolPortfolioID;

            dr1 = cmd.ExecuteReader();

            float fTotalAllocation = 0;

            while (dr1.Read())
            {

                clsModelPortfolioDetails ModelPortfolioDetails = new clsModelPortfolioDetails();

                ModelPortfolioDetails.propModelID = int.Parse(dr1["ModelID"].ToString());
                ModelPortfolioDetails.propAllocation = float.Parse(Math.Round(double.Parse(dr1["Allocation"].ToString()), 2).ToString());
                ModelPortfolioDetails.propFund = new clsFund(int.Parse(dr1["FundID"].ToString()));
                ModelPortfolioDetails.propFundID = int.Parse(dr1["FundID"].ToString());
                ModelPortfolioDetails.propIsDeletable = dr1["isDeletable"].ToString().Equals("1") ? true : false;

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


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


                fTotalAllocation = fTotalAllocation + ModelPortfolioDetails.propAllocation;
                ModelPortfolioDetails.propTotalAllocation = fTotalAllocation;

                listModelPortfolioDetails.Add(ModelPortfolioDetails);

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

            return listModelPortfolioDetails;
        }
Пример #32
0
        public static List <clsSwitchDetails_Client> getSwitchDetails(int intSwitchID)
        {
            SqlConnection con1 = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
            List <clsSwitchDetails_Client> listSwitchDetails = new List <clsSwitchDetails_Client>();

            clsSwitch    IFASwitch = new clsSwitch(intSwitchID);
            clsPortfolio Portfolio = new clsPortfolio(IFASwitch.propClientID.ToString(), IFASwitch.propPortfolioID);

            //throw new Exception(Portfolio.propPortfolioDetails.Count.ToString());
            //throw new Exception(intSwitchID.ToString() + " - " + IFASwitch.propPortfolioID);

            SqlCommand    cmd = new SqlCommand();
            SqlDataReader dr1;

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

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

            dr1 = cmd.ExecuteReader();

            if (!dr1.HasRows)
            {
                SqlConnection con2 = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
                SqlCommand    cmd2 = new SqlCommand();
                cmd2.Connection  = con2;
                cmd2.CommandType = System.Data.CommandType.StoredProcedure;
                cmd2.CommandText = "[SWITCH_DetailsGet]";
                cmd2.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;
                con2.Open();
                dr1 = cmd2.ExecuteReader();
            }

            float fTotalAllocation = 0;

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

                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(IFASwitch.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(IFASwitch.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);
        }
Пример #33
0
 public clsModelGroup(clsPortfolio Portfolio, string strModelGroupID, string strModelPortfolioID, int intIFA_ID) 
 {
     getModelGroupInfo(Portfolio, strModelGroupID, strModelPortfolioID, intIFA_ID);
 }
Пример #34
0
        //private void getHeaderInfo(int intSwitchID)
        //{
        //    SqlCommand cmd = new SqlCommand();
        //    SqlDataReader dr;
        //    con.Open();
        //    cmd.Connection = con;
        //    cmd.CommandType = System.Data.CommandType.StoredProcedure;
        //    cmd.CommandText = "[SWITCH_Temp_HeaderGet]";
           
        //    cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;

        //    dr = cmd.ExecuteReader();

        //    if (dr.HasRows)
        //    {

        //        while (dr.Read())
        //        {

        //            this.propClientID = dr["ClientID"].ToString();
        //            this.propDate_Created = DateTime.Parse(dr["Date_Created"].ToString());
        //            this.propPortfolioID = dr["PortfolioID"].ToString();
        //            this.propStatus = short.Parse(dr["Status"].ToString());
        //            //this.propStatusString = getSwitchStringStatus(this.propStatus);
        //            this.propSwitchID = int.Parse(dr["SwitchID"].ToString());
        //            this.propCreated_By = dr["Created_By"].ToString();
        //            this.propDescription = dr["Description"].ToString();
        //        }
        //    }

        //    dr.Close();
        //    con.Close();
        //    cmd.Dispose();
        //    con.Dispose();
        //}

        private void getSwitchInfo(clsPortfolio Portfolio, string strUserID, int intIFA_ID, int _intModelID, string strModelGroupID, string strModelPortfolioID)
        {
            SqlCommand cmd = new SqlCommand();
            SqlDataReader dr;
            con.Open();
            cmd.Connection = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "[SWITCH_Temp_HeaderGet]";

            cmd.Parameters.Add("@param_intIFA_ID", System.Data.SqlDbType.Int).Value = intIFA_ID;
            cmd.Parameters.Add("@param_intModelID", 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;
            cmd.Parameters.Add("@param_strPortfolioID", System.Data.SqlDbType.NVarChar).Value = Portfolio.propPortfolioID;
            cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value = Portfolio.propClientID;

            dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    this.intModelID = int.Parse(dr["ModelID"].ToString());
                    this.propClientID = dr["ClientID"].ToString();
                    this.propDate_Created = DateTime.Parse(dr["Date_Created"].ToString());
                    this.propPortfolioID = dr["PortfolioID"].ToString();
                    //this.propStatus = short.Parse(dr["Status"].ToString());
                    //this.propStatusString = clsSwitch.getSwitchStringStatus(this.propStatus);
                    //if (propStatus == (int)enumSwitchStatus.Declined_Client)
                    //{
                    //    this.propSwitchDetails = clsSwitchDetails.replicatePortfolioDetails(Portfolio);
                    //}
                    //else
                    //{
                    this.propSwitchDetails = this.getSwitchDetails(Portfolio, Portfolio.propClientID, Portfolio.propPortfolioID);
                    //}
                    this.propCreated_By = dr["Created_By"].ToString();
                    this.propDescription = dr["Description"].ToString();
                }
            }
            else
            {
                this.propPortfolioID = Portfolio.propPortfolioID;
                this.propClientID = Portfolio.propClientID;
                this.propStatus = (short)clsSwitch.enumSwitchStatus.Saved;
                this.propStatusString = clsSwitch.getSwitchStringStatus(this.propStatus);
                this.propCreated_By = strUserID;
                this.propSwitchDetails = this.combineModelAndPortfolioDetails(Portfolio, _intModelID, Portfolio.propModelGroupID, Portfolio.propModelPortfolioID);
            }

            dr.Close();
            con.Close();
            cmd.Dispose();
            //con.Dispose();
        }
Пример #35
0
            public static String convertSMSMessage(string strRawMessage, clsIFA IFA, clsClient Client, clsPortfolio Portfolio, String strSecurityCode, clsScheme Scheme)
            {
                String strConvertedMessage = strRawMessage;

                if (IFA != null)
                {
                    strConvertedMessage = strConvertedMessage.Replace("{%param_IFAName%}", IFA.propIFA_Name);
                }

                if (Client != null)
                {
                    strConvertedMessage = strConvertedMessage.Replace("{%param_ClientName%}", Client.propForename + " " + Client.propSurname);
                }

                if (Portfolio != null)
                {
                    strConvertedMessage = strConvertedMessage.Replace("{%param_PortfolioName%}", Portfolio.propCompany);
                }

                if (strSecurityCode != null)
                {
                    strConvertedMessage = strConvertedMessage.Replace("{%SecurityCode%}", strSecurityCode);
                }

                if (Scheme != null)
                {
                    strConvertedMessage = strConvertedMessage.Replace("{%param_SchemeName%}", Scheme.propCompany.propCompany);
                }

                return(HttpUtility.HtmlDecode(strConvertedMessage));
            }
Пример #36
0
 public clsSwitchTemp(clsPortfolio Portfolio, string strUserID, int intIFA_ID, int intModelID, string strModelGroupID, string strModelPortfolioID)
 {
     getSwitchInfo(Portfolio, strUserID, intIFA_ID, intModelID, strModelGroupID, strModelPortfolioID);
 }
Пример #37
0
 public clsSwitch(clsPortfolio Portfolio, string strUserID)
 {
     getSwitchInfo(Portfolio, strUserID);
 }
Пример #38
0
 public clsModelPortfolio(clsPortfolio Portfolio, string strModelGroupID, string strModelPortfolioID)
 {
     getModelPortfolioInfo(Portfolio, strModelGroupID, strModelPortfolioID);
 }
Пример #39
0
        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);
        }
Пример #40
0
 public clsModelPortfolio(clsPortfolio Portfolio, string strModelGroupID, string strModelPortfolioID)
 {
     getModelPortfolioInfo(Portfolio, strModelGroupID, strModelPortfolioID);
 }