Пример #1
0
        public static string generateApprovedSwitchScheme(clsScheme Scheme)
        {
            string          HoldingsRows = string.Empty;
            clsSwitchScheme switchScheme = new clsSwitchScheme(Scheme);

            foreach (clsSwitchScheme.clsSwitchSchemeDetails details in switchScheme.propSwitchDetails)
            {
                string myRow = clsOutput.ROWDETAILS.Replace("{^row$}", clsOutput.CELLDETAILS);
                myRow         = myRow.Replace("{^FundCompany$}", details.propFund.propCompanyID.ToString() /* (new clsFund(details.propFund.propFundID)).propCompanyID.ToString()*/);
                myRow         = myRow.Replace("{^FundName$}", details.propFund.propFundName);
                myRow         = myRow.Replace("{^InsurComp$}", "None");
                myRow         = myRow.Replace("{^SEDOL$}", details.propFund.propSEDOL);
                myRow         = myRow.Replace("{^%Portfolio$}", details.propAllocation.ToString("N2") + "%");
                HoldingsRows += myRow;
            }
            string Contribution = string.Empty;

            foreach (clsSwitchScheme.clsSwitchSchemeDetails details in switchScheme.propSwitchDetailsContribution)
            {
                string myRow = clsOutput.ROWDETAILS.Replace("{^row$}", clsOutput.CELLDETAILS);
                myRow         = myRow.Replace("{^FundCompany$}", details.propFund.propCompanyID.ToString() /* (new clsFund(details.propFund.propFundID)).propCompanyID.ToString()*/);
                myRow         = myRow.Replace("{^FundName$}", details.propFund.propFundName);
                myRow         = myRow.Replace("{^InsurComp$}", "None");
                myRow         = myRow.Replace("{^SEDOL$}", details.propFund.propSEDOL);
                myRow         = myRow.Replace("{^%Portfolio$}", details.propAllocation.ToString("N2") + "%");
                Contribution += myRow;
            }
            string html = SchemeOutput_GetHTML();

            html = html.Replace("{^PortfolioHoldings$}", HoldingsRows);
            html = html.Replace("{^Contribution$}", Contribution);

            clsClient client = new clsClient(Scheme.propClient.propClientID);
            clsIFA    IFA    = new clsIFA(int.Parse(HttpContext.Current.Session["ifaid"].ToString()));

            html = html.Replace("{^IFAName$}", IFA.propIFA_Name);
            html = html.Replace("{^ClientName$}", client.propForename + " " + client.propSurname);
            html = html.Replace("{^Company$}", Scheme.propCompany.propCompany);
            html = html.Replace("{^PType$}", Scheme.propPortfolioType);
            html = html.Replace("{^DateTransmit$}", "?"); //-->Temporary
            html = html.Replace("{^Curr$}", Scheme.propSchemeCurrency);
            html = html.Replace("{^AccNum$}", Scheme.propAccountNumber);
            html = html.Replace("{^DateApprv$}", DateTime.Now.ToString("MM-dd-yyyy") ?? String.Empty);
            if (Scheme.propConfirmationRequired)
            {
                html = html.Replace("{^Sign$}", clsOutput.SIGNATURE);
                html = html.Replace("{^SignatureClientName$}", client.propForename + " " + client.propSurname);
            }
            else
            {
                html = html.Replace("{^Sign$}", string.Empty);
            }
            return(html);
        }
Пример #2
0
            public static List <clsSwitchSchemeDetails> getOriginalDetails(clsScheme Scheme, clsSwitchScheme SwitchScheme, Boolean isForContribution)
            {
                if (Scheme == null)
                {
                    return(null);
                }
                string strClientID = Scheme.propClient.propClientID;

                List <clsSwitchSchemeDetails> listSwitchDetails = new List <clsSwitchSchemeDetails>();
                float  fTotalAllocation = 0;
                double dPrice           = 0;

                foreach (clsScheme.clsDetails SchemeDetails in Scheme.propDetails)
                {
                    clsSwitchSchemeDetails SwitchDetails = new clsSwitchSchemeDetails();
                    SwitchDetails.propFund       = new clsFund(SchemeDetails.propFund.propFundID);
                    SwitchDetails.propAllocation = float.Parse(Math.Round(double.Parse(SchemeDetails.propAllocation.ToString()), 2).ToString());

                    if (Scheme.propClient.propCurrency != SwitchDetails.propFund.propCurrency)
                    {
                        double dConvertedValue = clsCurrency.convertToClientCurrency(strClientID, SchemeDetails.propFund.propPrice, SchemeDetails.propFund.propCurrency);
                        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(SchemeDetails.propFund.propPrice, 4);
                    }

                    SwitchDetails.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(strClientID, SchemeDetails.propFund.propCurrency);
                    SwitchDetails.propTotalValue         = float.Parse(Math.Round(double.Parse(Scheme.propCC_TotalValue.ToString()), 0).ToString());

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

                    SwitchDetails.propValue = float.Parse(((Math.Round(SwitchDetails.propAllocation, 2) / 100) * Math.Round(Scheme.propCC_TotalValue, 0)).ToString());
                    SwitchDetails.propUnits = Convert.ToDecimal((((Math.Round(SwitchDetails.propAllocation, 2) / 100) * Math.Round(Scheme.propCC_TotalValue, 0)) / dPrice).ToString());

                    SwitchDetails.propSwitchScheme   = SwitchScheme;
                    SwitchDetails.propIsContribution = isForContribution;

                    listSwitchDetails.Add(SwitchDetails);
                }

                return(listSwitchDetails);
            }
Пример #3
0
            public static List <clsDetails> getListOriginalDetails(clsScheme Scheme)
            {
                string strClientID = Scheme.propClient.propClientID;
                string strSchemeID = Scheme.propSchemeID;

                SqlConnection con = new clsScheme().con;
                SqlCommand    cmd = new SqlCommand();
                SqlDataReader dr;

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

                cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value = strClientID;
                cmd.Parameters.Add("@param_strSchemeID", System.Data.SqlDbType.NVarChar).Value = strSchemeID;

                dr = cmd.ExecuteReader();

                List <clsDetails> newListDetails = new List <clsDetails>();

                while (dr.Read())
                {
                    clsDetails newDetails = new clsDetails();


                    newDetails.propClient             = dr["ClientID"] != System.DBNull.Value ? new clsClient(dr["ClientID"].ToString()) : null;
                    newDetails.propClientCurrency     = newDetails.propClient.propCurrency;
                    newDetails.propCurrentValueClient = dr["CurrentValueClient"] != System.DBNull.Value ? float.Parse(dr["CurrentValueClient"].ToString()) : 0;
                    newDetails.propCurrentValueScheme = dr["CurrentValueScheme"] != System.DBNull.Value ? float.Parse(dr["CurrentValueScheme"].ToString()) : 0;
                    newDetails.propExchangeRate       = dr["ExchangeRate"] != System.DBNull.Value ? float.Parse(dr["ExchangeRate"].ToString()) : 0;
                    newDetails.propFund             = dr["FundNameID"] != System.DBNull.Value ? new clsFund(int.Parse(dr["FundNameID"].ToString())) : null;
                    newDetails.propFundExchangeRate = dr["FundExchangeRate"] != System.DBNull.Value ? float.Parse(dr["FundExchangeRate"].ToString()) : 0;
                    newDetails.propIsOLDeleted      = dr["OLDeleted"] != System.DBNull.Value ? Boolean.Parse(dr["OLDeleted"].ToString()) : false;
                    newDetails.propScheme           = Scheme;
                    newDetails.propSEDOL            = dr["SEDOL"] != System.DBNull.Value ? dr["SEDOL"].ToString() : "";
                    newDetails.propUnits            = dr["NumberOfUnits"] != System.DBNull.Value ? float.Parse(dr["NumberOfUnits"].ToString()) : 0;
                    newDetails.propValue            = dr["Value"] != System.DBNull.Value ? float.Parse(dr["Value"].ToString()) : 0;
                    newDetails.propAllocation       = (newDetails.propCurrentValueScheme / Scheme.propSC_TotalValue) * 100;

                    newListDetails.Add(newDetails);
                }

                con.Close();
                cmd.Dispose();

                return(newListDetails);
            }
Пример #4
0
        public static int insertSwitchHeader(clsScheme Scheme, string strUserID, clsSwitch.enumSwitchStatus SwitchStatus, Nullable <int> intSwitchID, string strDescription)
        {
            SqlConnection con = new clsSwitchScheme().con;
            SqlCommand    cmd = new SqlCommand();

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

            cmd.Parameters.Add("@param_strSchemeID", System.Data.SqlDbType.NVarChar).Value    = Scheme.propSchemeID;
            cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value    = Scheme.propClient.propClientID;
            cmd.Parameters.Add("@param_intStatus", System.Data.SqlDbType.SmallInt).Value      = SwitchStatus;
            cmd.Parameters.Add("@param_strCreated_By", System.Data.SqlDbType.NVarChar).Value  = strUserID;
            cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value         = intSwitchID;
            cmd.Parameters.Add("@param_strDescription", System.Data.SqlDbType.NVarChar).Value = strDescription;

            return(int.Parse(cmd.ExecuteScalar().ToString()));
        }
Пример #5
0
            public static List <clsContribution> getContributions(clsScheme Scheme)
            {
                SqlConnection          con1             = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
                List <clsContribution> listContribution = new List <clsContribution>();

                SqlCommand    cmd = new SqlCommand();
                SqlDataReader dr;

                con1.Open();
                cmd.Connection  = con1;
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.CommandText = "[SWITCHScheme_SchemeContributionsGet]";

                cmd.Parameters.Add("@param_SchemeID", System.Data.SqlDbType.NVarChar).Value = Scheme.propSchemeID;

                dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    clsContribution newContribution = new clsContribution();

                    newContribution.propClient                         = new clsClient(dr["ClientID"].ToString());
                    newContribution.propContributionAmount             = float.Parse(dr["ContributionAmount"].ToString());
                    newContribution.propContributionID                 = dr["ContributionID"].ToString();
                    newContribution.propEndDate                        = dr["EndDate"] != System.DBNull.Value ? DateTime.Parse(dr["EndDate"].ToString()) : DateTime.ParseExact("01/01/1800", "dd/MM/yyyy", null);
                    newContribution.propIFAUpdatedBy                   = dr["IFAUpdatedBy"].ToString();
                    newContribution.propIFAUpdatedDate                 = dr["IFAUpdatedDate"] != System.DBNull.Value ? DateTime.Parse(dr["IFAUpdatedDate"].ToString()) : DateTime.ParseExact("01/01/1800", "dd/MM/yyyy", null);
                    newContribution.propScheme                         = Scheme;
                    newContribution.propSchemeContributionsUpdatedBy   = dr["SchemeContributionsUpdatedBy"].ToString();
                    newContribution.propSchemeContributionsUpdatedDate = dr["SchemeContributionsUpdatedDate"] != System.DBNull.Value ? DateTime.Parse(dr["SchemeContributionsUpdatedDate"].ToString()) : DateTime.ParseExact("01/01/1800", "dd/MM/yyyy", null);
                    newContribution.propStartDate                      = dr["StartDate"] != System.DBNull.Value ? DateTime.Parse(dr["StartDate"].ToString()) : DateTime.ParseExact("01/01/1800", "dd/MM/yyyy", null);
                    newContribution.propValuationFrequency             = dr["ValuationFrequency"].ToString();

                    listContribution.Add(newContribution);
                }
                con1.Close();
                cmd.Dispose();
                con1.Dispose();

                return(listContribution);
            }
Пример #6
0
        private void getSwitchScheme(clsScheme Scheme, string strUserID, Nullable<int> intSwitchID)
        {            
            string strClientID = "0";
            string strSchemeID = "0";

            if (Scheme != null) 
            {
                strClientID = Scheme.propClient.propClientID.ToString();
                strSchemeID = Scheme.propSchemeID;
            }


            SqlCommand cmd = new SqlCommand();
            SqlDataReader dr;

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

            cmd.Parameters.Add("@param_strSchemeID", System.Data.SqlDbType.NVarChar).Value = strSchemeID;
            cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value = strClientID;
            cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.NVarChar).Value = intSwitchID;

            dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    this.propSwitchID = int.Parse(dr["SwitchID"].ToString());
                    this.propClient = new clsClient(dr["ClientID"].ToString());
                    this.propCreated_By = dr["Created_By"].ToString();
                    this.propDate_Created = DateTime.Parse(dr["Date_Created"].ToString());
                    this.propDescription = dr["Description"].ToString();
                    this.propScheme = Scheme != null ? Scheme : new clsScheme(this.propClient.propClientID, dr["SchemeID"].ToString());
                    this.propStatus = short.Parse(dr["Status"].ToString());
                    this.propStatusString = clsSwitch.getSwitchStringStatus(this.propStatus);
                    this.propSwitchDetails = clsSwitchSchemeDetails.getSwitchDetails(this.propScheme, this, false);                    

                    if (propStatus == (int) clsSwitch.enumSwitchStatus.Declined_Client)
                    {
                        foreach (clsSwitchSchemeDetails Details in this.propSwitchDetails)
                        {
                            clsSwitchSchemeDetails.removeSwitchDetails(Details.propSwitchDetailsID);
                        }
                        this.propSwitchDetails = clsSwitchSchemeDetails.getOriginalDetails(Scheme, this, false);
                    }

                    this.propSwitchDetailsContribution = clsSwitchSchemeDetails.getSwitchDetails(this.propScheme, this, true);
                    if (propStatus == (int)clsSwitch.enumSwitchStatus.Declined_Client)
                    {
                        foreach (clsSwitchSchemeDetails Details in this.propSwitchDetailsContribution)
                        {
                            clsSwitchSchemeDetails.removeSwitchDetails(Details.propSwitchDetailsID);                            
                        }
                        this.propSwitchDetailsContribution = clsSwitchSchemeDetails.getOriginalDetails(Scheme, this, true);
                    }
                }
            }
            else
            {
                this.propSwitchID = 0;
                this.propScheme = new clsScheme(strClientID, strSchemeID);
                this.propClient = new clsClient(strClientID);
                this.propStatus = (short)clsSwitch.enumSwitchStatus.Draft;
                this.propStatusString = clsSwitch.getSwitchStringStatus(this.propStatus);
                this.propCreated_By = strUserID;
                this.propSwitchDetails = clsSwitchSchemeDetails.getOriginalDetails(Scheme, this, false);
                this.propSwitchDetailsContribution = clsSwitchSchemeDetails.getOriginalDetails(Scheme, this, true);
            }

            con.Close();
            cmd.Dispose();
            con.Dispose();
        }
Пример #7
0
 public clsSwitchScheme(clsScheme Scheme)
 {
     getSwitchScheme(Scheme, null, null);
 }        
Пример #8
0
 public clsSwitchScheme(clsScheme Scheme, string strUserID) {            
     getSwitchScheme(Scheme, strUserID, null);
 }
Пример #9
0
            public static List<clsSwitchSchemeDetails> getSwitchDetails(clsScheme Scheme, clsSwitchScheme SwitchScheme, Boolean isContribution)
            {
                SqlConnection con1 = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
                List<clsSwitchSchemeDetails> listSwitchDetails = new List<clsSwitchSchemeDetails>();

                SqlCommand cmd = new SqlCommand();
                SqlDataReader dr1;

                con1.Open();
                cmd.Connection = con1;
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.CommandText = "[SWITCHScheme_DetailsGet]";

                cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value = SwitchScheme.propSwitchID;
                cmd.Parameters.Add("@param_isContribution", System.Data.SqlDbType.Int).Value = isContribution;

                dr1 = cmd.ExecuteReader();

                double dPrice;
                float fTotalAllocation = 0;

                while (dr1.Read())
                {
                    dPrice = 0;

                    clsSwitchSchemeDetails newClsSwitchDetails = new clsSwitchSchemeDetails();

                    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.propIsDeletable = dr1["isDeletable"].ToString().Equals("1") ? true : false;
                    newClsSwitchDetails.propSwitchDetailsID = int.Parse(dr1["SwitchDetailsID"].ToString());
                    newClsSwitchDetails.propSwitchScheme = SwitchScheme;
                    newClsSwitchDetails.propUpdated_By = dr1["Updated_By"].ToString();

                    newClsSwitchDetails.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(Scheme.propClient.propClientID, newClsSwitchDetails.propFund.propCurrency);                    

                    if (Scheme.propClient.propCurrency != newClsSwitchDetails.propFund.propCurrency)
                    {
                        double dConvertedValue = clsCurrency.convertToClientCurrency(Scheme.propClient.propClientID, newClsSwitchDetails.propFund.propPrice, newClsSwitchDetails.propFund.propCurrency);
                        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(newClsSwitchDetails.propFund.propPrice, 4);
                    }

                    newClsSwitchDetails.propTotalValue = float.Parse(Math.Round(double.Parse(Scheme.propCC_TotalValue.ToString()), 0).ToString());

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

                    newClsSwitchDetails.propValue = float.Parse(((Math.Round(newClsSwitchDetails.propAllocation, 2) / 100) * Math.Round(Scheme.propCC_TotalValue, 0)).ToString());
                    newClsSwitchDetails.propUnits = Convert.ToDecimal((((Math.Round(newClsSwitchDetails.propAllocation, 2) / 100) * Math.Round(Scheme.propCC_TotalValue, 0)) / dPrice).ToString());

                    listSwitchDetails.Add(newClsSwitchDetails);

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

                return listSwitchDetails;
            }
Пример #10
0
            public static List<clsDetails> getListOriginalDetails(clsScheme Scheme)
            {

                string strClientID = Scheme.propClient.propClientID;
                string strSchemeID = Scheme.propSchemeID;

                SqlConnection con = new clsScheme().con;
                SqlCommand cmd = new SqlCommand();
                SqlDataReader dr;

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

                cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value = strClientID;
                cmd.Parameters.Add("@param_strSchemeID", System.Data.SqlDbType.NVarChar).Value = strSchemeID;

                dr = cmd.ExecuteReader();

                List<clsDetails> newListDetails = new List<clsDetails>();

                while (dr.Read())
                {
                    clsDetails newDetails = new clsDetails();

                                                           
                    newDetails.propClient = dr["ClientID"] != System.DBNull.Value ? new clsClient(dr["ClientID"].ToString()) : null;
                    newDetails.propClientCurrency = newDetails.propClient.propCurrency;
                    newDetails.propCurrentValueClient = dr["CurrentValueClient"] != System.DBNull.Value ? float.Parse(dr["CurrentValueClient"].ToString()) : 0;
                    newDetails.propCurrentValueScheme = dr["CurrentValueScheme"] != System.DBNull.Value ? float.Parse(dr["CurrentValueScheme"].ToString()) : 0;
                    newDetails.propExchangeRate = dr["ExchangeRate"] != System.DBNull.Value ? float.Parse(dr["ExchangeRate"].ToString()) : 0;
                    newDetails.propFund = dr["FundNameID"] != System.DBNull.Value ? new clsFund(int.Parse(dr["FundNameID"].ToString())) : null;
                    newDetails.propFundExchangeRate = dr["FundExchangeRate"] != System.DBNull.Value ? float.Parse(dr["FundExchangeRate"].ToString()) : 0;
                    newDetails.propIsOLDeleted = dr["OLDeleted"] != System.DBNull.Value ? Boolean.Parse(dr["OLDeleted"].ToString()) : false;
                    newDetails.propScheme = Scheme;
                    newDetails.propSEDOL = dr["SEDOL"] != System.DBNull.Value ? dr["SEDOL"].ToString() : "";
                    newDetails.propUnits = dr["NumberOfUnits"] != System.DBNull.Value ? float.Parse(dr["NumberOfUnits"].ToString()) : 0;
                    newDetails.propValue = dr["Value"] != System.DBNull.Value ? float.Parse(dr["Value"].ToString()) : 0;
                    newDetails.propAllocation = (newDetails.propCurrentValueScheme / Scheme.propSC_TotalValue) * 100;                    
                    
                    newListDetails.Add(newDetails);
                }

                con.Close();
                cmd.Dispose();

                return newListDetails;
            }
Пример #11
0
            public static List <clsSwitchSchemeDetails_Client> getSwitchDetails(int intSwitchID, Boolean isContribution)
            {
                SqlConnection con1 = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
                List <clsSwitchSchemeDetails_Client> listSwitchDetails = new List <clsSwitchSchemeDetails_Client>();

                clsSwitchScheme SwitchScheme = new clsSwitchScheme(intSwitchID);
                clsScheme       Scheme       = new clsScheme(SwitchScheme.propClient.propClientID, SwitchScheme.propScheme.propSchemeID);

                SqlCommand    cmd = new SqlCommand();
                SqlDataReader dr1;

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

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

                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 = "[SWITCHScheme_DetailsGet]";
                    cmd2.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value    = intSwitchID;
                    cmd2.Parameters.Add("@param_isContribution", System.Data.SqlDbType.Int).Value = isContribution;
                    con2.Open();
                    dr1 = cmd2.ExecuteReader();
                }

                double dPrice;
                float  fTotalAllocation = 0;

                while (dr1.Read())
                {
                    dPrice = 0;

                    clsSwitchSchemeDetails_Client newClsSwitchDetails = new clsSwitchSchemeDetails_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.propIsDeletable     = dr1["isDeletable"].ToString().Equals("1") ? true : false;
                    newClsSwitchDetails.propSwitchDetailsID = int.Parse(dr1["SwitchDetailsID"].ToString());
                    newClsSwitchDetails.propSwitchScheme    = SwitchScheme;
                    newClsSwitchDetails.propUpdated_By      = dr1["Updated_By"].ToString();

                    newClsSwitchDetails.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(Scheme.propClient.propClientID, newClsSwitchDetails.propFund.propCurrency);

                    if (Scheme.propClient.propCurrency != newClsSwitchDetails.propFund.propCurrency)
                    {
                        double dConvertedValue = clsCurrency.convertToClientCurrency(Scheme.propClient.propClientID, newClsSwitchDetails.propFund.propPrice, newClsSwitchDetails.propFund.propCurrency);
                        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(newClsSwitchDetails.propFund.propPrice, 4);
                    }

                    newClsSwitchDetails.propTotalValue = float.Parse(Math.Round(double.Parse(Scheme.propCC_TotalValue.ToString()), 0).ToString());

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

                    newClsSwitchDetails.propValue = float.Parse(((Math.Round(newClsSwitchDetails.propAllocation, 2) / 100) * Math.Round(Scheme.propCC_TotalValue, 0)).ToString());
                    newClsSwitchDetails.propUnits = Convert.ToDecimal((((Math.Round(newClsSwitchDetails.propAllocation, 2) / 100) * Math.Round(Scheme.propCC_TotalValue, 0)) / dPrice).ToString());

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

                return(listSwitchDetails);
            }
Пример #12
0
        private void getSwitchScheme(clsScheme Scheme, string strUserID, Nullable <int> intSwitchID)
        {
            string strClientID = "0";
            string strSchemeID = "0";

            if (Scheme != null)
            {
                strClientID = Scheme.propClient.propClientID.ToString();
                strSchemeID = Scheme.propSchemeID;
            }


            SqlCommand    cmd = new SqlCommand();
            SqlDataReader dr;

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

            cmd.Parameters.Add("@param_strSchemeID", System.Data.SqlDbType.NVarChar).Value = strSchemeID;
            cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value = strClientID;
            cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.NVarChar).Value = intSwitchID;

            dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    this.propSwitchID      = int.Parse(dr["SwitchID"].ToString());
                    this.propClient        = new clsClient(dr["ClientID"].ToString());
                    this.propCreated_By    = dr["Created_By"].ToString();
                    this.propDate_Created  = DateTime.Parse(dr["Date_Created"].ToString());
                    this.propDescription   = dr["Description"].ToString();
                    this.propScheme        = Scheme != null ? Scheme : new clsScheme(this.propClient.propClientID, dr["SchemeID"].ToString());
                    this.propStatus        = short.Parse(dr["Status"].ToString());
                    this.propStatusString  = clsSwitch.getSwitchStringStatus(this.propStatus);
                    this.propSwitchDetails = clsSwitchSchemeDetails.getSwitchDetails(this.propScheme, this, false);

                    if (propStatus == (int)clsSwitch.enumSwitchStatus.Declined_Client)
                    {
                        foreach (clsSwitchSchemeDetails Details in this.propSwitchDetails)
                        {
                            clsSwitchSchemeDetails.removeSwitchDetails(Details.propSwitchDetailsID);
                        }
                        this.propSwitchDetails = clsSwitchSchemeDetails.getOriginalDetails(Scheme, this, false);
                    }

                    this.propSwitchDetailsContribution = clsSwitchSchemeDetails.getSwitchDetails(this.propScheme, this, true);
                    if (propStatus == (int)clsSwitch.enumSwitchStatus.Declined_Client)
                    {
                        foreach (clsSwitchSchemeDetails Details in this.propSwitchDetailsContribution)
                        {
                            clsSwitchSchemeDetails.removeSwitchDetails(Details.propSwitchDetailsID);
                        }
                        this.propSwitchDetailsContribution = clsSwitchSchemeDetails.getOriginalDetails(Scheme, this, true);
                    }
                }
            }
            else
            {
                this.propSwitchID                  = 0;
                this.propScheme                    = new clsScheme(strClientID, strSchemeID);
                this.propClient                    = new clsClient(strClientID);
                this.propStatus                    = (short)clsSwitch.enumSwitchStatus.Draft;
                this.propStatusString              = clsSwitch.getSwitchStringStatus(this.propStatus);
                this.propCreated_By                = strUserID;
                this.propSwitchDetails             = clsSwitchSchemeDetails.getOriginalDetails(Scheme, this, false);
                this.propSwitchDetailsContribution = clsSwitchSchemeDetails.getOriginalDetails(Scheme, this, true);
            }

            con.Close();
            cmd.Dispose();
            con.Dispose();
        }
Пример #13
0
 public clsSwitchScheme(clsScheme Scheme)
 {
     getSwitchScheme(Scheme, null, null);
 }
Пример #14
0
 public clsSwitchScheme(clsScheme Scheme, string strUserID)
 {
     getSwitchScheme(Scheme, strUserID, null);
 }
Пример #15
0
 public clsDetails(clsScheme Scheme)
 {
     getListOriginalDetails(Scheme);
 }
Пример #16
0
        public static string generateApprovedSwitchScheme(clsScheme Scheme)
        {
            string HoldingsRows = string.Empty;
            clsSwitchScheme switchScheme = new clsSwitchScheme(Scheme);
            foreach(clsSwitchScheme.clsSwitchSchemeDetails details in switchScheme.propSwitchDetails)
            {
                string myRow = clsOutput.ROWDETAILS.Replace("{^row$}", clsOutput.CELLDETAILS);
                myRow = myRow.Replace("{^FundCompany$}", details.propFund.propCompanyID.ToString() /* (new clsFund(details.propFund.propFundID)).propCompanyID.ToString()*/);
                myRow = myRow.Replace("{^FundName$}", details.propFund.propFundName);
                myRow = myRow.Replace("{^InsurComp$}", "None");
                myRow = myRow.Replace("{^SEDOL$}", details.propFund.propSEDOL);
                myRow = myRow.Replace("{^%Portfolio$}", details.propAllocation.ToString("N2") + "%");
                HoldingsRows += myRow;
            }
            string Contribution = string.Empty;
            foreach(clsSwitchScheme.clsSwitchSchemeDetails details in switchScheme.propSwitchDetailsContribution)
            {
                string myRow = clsOutput.ROWDETAILS.Replace("{^row$}", clsOutput.CELLDETAILS);
                myRow = myRow.Replace("{^FundCompany$}", details.propFund.propCompanyID.ToString() /* (new clsFund(details.propFund.propFundID)).propCompanyID.ToString()*/);
                myRow = myRow.Replace("{^FundName$}", details.propFund.propFundName);
                myRow = myRow.Replace("{^InsurComp$}", "None");
                myRow = myRow.Replace("{^SEDOL$}", details.propFund.propSEDOL);
                myRow = myRow.Replace("{^%Portfolio$}", details.propAllocation.ToString("N2") + "%");
                Contribution += myRow;
            }
            string html = SchemeOutput_GetHTML();
            html = html.Replace("{^PortfolioHoldings$}", HoldingsRows);
            html = html.Replace("{^Contribution$}", Contribution);

            clsClient client = new clsClient(Scheme.propClient.propClientID);
            clsIFA IFA = new clsIFA(int.Parse(HttpContext.Current.Session["ifaid"].ToString()));
            html = html.Replace("{^IFAName$}", IFA.propIFA_Name);
            html = html.Replace("{^ClientName$}", client.propForename + " " + client.propSurname);
            html = html.Replace("{^Company$}", Scheme.propCompany.propCompany);
            html = html.Replace("{^PType$}", Scheme.propPortfolioType);
            html = html.Replace("{^DateTransmit$}", "?"); //-->Temporary
            html = html.Replace("{^Curr$}", Scheme.propSchemeCurrency);
            html = html.Replace("{^AccNum$}", Scheme.propAccountNumber);
            html = html.Replace("{^DateApprv$}", DateTime.Now.ToString("MM-dd-yyyy") ?? String.Empty);
            if (Scheme.propConfirmationRequired)
            {
                html = html.Replace("{^Sign$}", clsOutput.SIGNATURE);
                html = html.Replace("{^SignatureClientName$}", client.propForename + " " + client.propSurname);
            }
            else
            {
                html = html.Replace("{^Sign$}", string.Empty);
            }
            return html;
        }
Пример #17
0
        public static int insertSwitchHeader(clsScheme Scheme, string strUserID, clsSwitch.enumSwitchStatus SwitchStatus, Nullable<int> intSwitchID, string strDescription)
        {
            SqlConnection con = new clsSwitchScheme().con;
            SqlCommand cmd = new SqlCommand();

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

            cmd.Parameters.Add("@param_strSchemeID", System.Data.SqlDbType.NVarChar).Value = Scheme.propSchemeID;
            cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value = Scheme.propClient.propClientID;
            cmd.Parameters.Add("@param_intStatus", System.Data.SqlDbType.SmallInt).Value = SwitchStatus;
            cmd.Parameters.Add("@param_strCreated_By", System.Data.SqlDbType.NVarChar).Value = strUserID;
            cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;
            cmd.Parameters.Add("@param_strDescription", System.Data.SqlDbType.NVarChar).Value = strDescription;

            return int.Parse(cmd.ExecuteScalar().ToString());

        }
Пример #18
0
 public clsDetails(clsScheme Scheme)
 {
     getListOriginalDetails(Scheme);
 }
Пример #19
0
            public static List<clsSwitchSchemeDetails> getOriginalDetails(clsScheme Scheme, clsSwitchScheme SwitchScheme , Boolean isForContribution)
            {
                if (Scheme == null) { return null; }
                string strClientID = Scheme.propClient.propClientID;

                List<clsSwitchSchemeDetails> listSwitchDetails = new List<clsSwitchSchemeDetails>();
                float fTotalAllocation = 0;
                double dPrice = 0;

                foreach (clsScheme.clsDetails SchemeDetails in Scheme.propDetails)
                {
                    clsSwitchSchemeDetails SwitchDetails = new clsSwitchSchemeDetails();
                    SwitchDetails.propFund = new clsFund(SchemeDetails.propFund.propFundID);
                    SwitchDetails.propAllocation = float.Parse(Math.Round(double.Parse(SchemeDetails.propAllocation.ToString()), 2).ToString());

                    if (Scheme.propClient.propCurrency != SwitchDetails.propFund.propCurrency)
                    {
                        double dConvertedValue = clsCurrency.convertToClientCurrency(strClientID, SchemeDetails.propFund.propPrice, SchemeDetails.propFund.propCurrency);
                        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(SchemeDetails.propFund.propPrice, 4);
                    }

                    SwitchDetails.propCurrencyMultiplier = clsCurrency.getCurrencyMultiplier(strClientID, SchemeDetails.propFund.propCurrency);
                    SwitchDetails.propTotalValue = float.Parse(Math.Round(double.Parse(Scheme.propCC_TotalValue.ToString()), 0).ToString());

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

                    SwitchDetails.propValue = float.Parse(((Math.Round(SwitchDetails.propAllocation, 2) / 100) * Math.Round(Scheme.propCC_TotalValue, 0)).ToString());
                    SwitchDetails.propUnits = Convert.ToDecimal((((Math.Round(SwitchDetails.propAllocation, 2) / 100) * Math.Round(Scheme.propCC_TotalValue, 0)) / dPrice).ToString());

                    SwitchDetails.propSwitchScheme = SwitchScheme;
                    SwitchDetails.propIsContribution = isForContribution;
                    
                    listSwitchDetails.Add(SwitchDetails);
                }

                return listSwitchDetails;
            }
Пример #20
0
            public static List<clsContribution> getContributions(clsScheme Scheme) {
                

                SqlConnection con1 = new clsSystem_DBConnection(clsSystem_DBConnection.strConnectionString.NavIntegrationDB).propConnection;
                List<clsContribution> listContribution = new List<clsContribution>();

                SqlCommand cmd = new SqlCommand();
                SqlDataReader dr;

                con1.Open();
                cmd.Connection = con1;
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.CommandText = "[SWITCHScheme_SchemeContributionsGet]";

                cmd.Parameters.Add("@param_SchemeID", System.Data.SqlDbType.NVarChar).Value = Scheme.propSchemeID;

                dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    clsContribution newContribution = new clsContribution();

                    newContribution.propClient = new clsClient(dr["ClientID"].ToString());
                    newContribution.propContributionAmount = float.Parse(dr["ContributionAmount"].ToString());
                    newContribution.propContributionID = dr["ContributionID"].ToString();
                    newContribution.propEndDate = dr["EndDate"] != System.DBNull.Value ? DateTime.Parse(dr["EndDate"].ToString()) : DateTime.ParseExact("01/01/1800", "dd/MM/yyyy", null);                    
                    newContribution.propIFAUpdatedBy = dr["IFAUpdatedBy"].ToString();
                    newContribution.propIFAUpdatedDate = dr["IFAUpdatedDate"] != System.DBNull.Value ? DateTime.Parse(dr["IFAUpdatedDate"].ToString()) : DateTime.ParseExact("01/01/1800", "dd/MM/yyyy", null);                    
                    newContribution.propScheme = Scheme;
                    newContribution.propSchemeContributionsUpdatedBy = dr["SchemeContributionsUpdatedBy"].ToString();
                    newContribution.propSchemeContributionsUpdatedDate = dr["SchemeContributionsUpdatedDate"] != System.DBNull.Value ? DateTime.Parse(dr["SchemeContributionsUpdatedDate"].ToString()) : DateTime.ParseExact("01/01/1800", "dd/MM/yyyy", null);
                    newContribution.propStartDate = dr["StartDate"] != System.DBNull.Value ? DateTime.Parse(dr["StartDate"].ToString()) : DateTime.ParseExact("01/01/1800", "dd/MM/yyyy", null);
                    newContribution.propValuationFrequency = dr["ValuationFrequency"].ToString();

                    listContribution.Add(newContribution);
                }
                con1.Close();
                cmd.Dispose();
                con1.Dispose();

                return listContribution;
            }
Пример #21
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));
            }