Esempio n. 1
0
            public static void insertSwitchDetails(List <clsSwitchSchemeDetails> listSwitchDetails, string strUserID, int intSwitchID, Boolean isContribution)
            {
                SqlConnection con = new clsSwitchScheme().con;

                con.Open();

                foreach (clsSwitchSchemeDetails SwitchDetail in listSwitchDetails)
                {
                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection = con;

                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "[SWITCHScheme_DetailsInsert]";

                    cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value             = intSwitchID;
                    cmd.Parameters.Add("@param_intFundID", System.Data.SqlDbType.Int).Value               = SwitchDetail.propFund.propFundID;
                    cmd.Parameters.Add("@param_fAllocation", System.Data.SqlDbType.Float).Value           = SwitchDetail.propAllocation;
                    cmd.Parameters.Add("@param_strCreated_By", System.Data.SqlDbType.NVarChar).Value      = strUserID;
                    cmd.Parameters.Add("@param_strUpdated_By", System.Data.SqlDbType.NVarChar).Value      = strUserID;
                    cmd.Parameters.Add("@param_intSwitchDetailsID", System.Data.SqlDbType.Int).Value      = SwitchDetail.intSwitchDetailsID;
                    cmd.Parameters.Add("@param_sintIsDeletable", System.Data.SqlDbType.SmallInt).Value    = SwitchDetail.propIsDeletable == true ? 1 : 0;
                    cmd.Parameters.Add("@param_sintIsContribution", System.Data.SqlDbType.SmallInt).Value = isContribution == true ? 1 : 0;

                    cmd.ExecuteNonQuery();
                }
            }
Esempio n. 2
0
            public static void transferClientSwitchToIFA(List <clsSwitchScheme_Client.clsSwitchSchemeDetails_Client> listClientSwitchDetails, string strUserID, Boolean isContribution, Boolean isDeletePreviousDetails)
            {
                clsSwitchScheme SwitchIFA = new clsSwitchScheme(listClientSwitchDetails[0].propSwitchScheme.propSwitchID);

                string strClientID = SwitchIFA.propClient.propClientID;
                string strSchemeID = SwitchIFA.propScheme.propSchemeID;

                List <clsSwitchScheme.clsSwitchSchemeDetails> listSwitchDetailsIFA = new clsSwitchScheme(new clsScheme(strClientID, strSchemeID)).propSwitchDetails;
                List <clsSwitchScheme.clsSwitchSchemeDetails> newListSwitchDetails = new List <clsSwitchScheme.clsSwitchSchemeDetails>();

                if (isDeletePreviousDetails)
                {
                    deleteAllDetails(SwitchIFA.propSwitchID);
                }

                foreach (clsSwitchScheme_Client.clsSwitchSchemeDetails_Client SwitchDetails_Client in listClientSwitchDetails)
                {
                    clsSwitchScheme.clsSwitchSchemeDetails newSwitchDetails = new clsSwitchScheme.clsSwitchSchemeDetails();
                    newSwitchDetails.propSwitchScheme   = new clsSwitchScheme(SwitchIFA.propSwitchID);
                    newSwitchDetails.propFund           = new clsFund(SwitchDetails_Client.propFund.propFundID);
                    newSwitchDetails.propAllocation     = SwitchDetails_Client.propAllocation;
                    newSwitchDetails.propIsDeletable    = SwitchDetails_Client.propIsDeletable;
                    newSwitchDetails.propIsContribution = isContribution;

                    newListSwitchDetails.Add(newSwitchDetails);
                }

                clsSwitchScheme.clsSwitchSchemeDetails.insertSwitchDetails(newListSwitchDetails, strUserID, SwitchIFA.propSwitchID, isContribution);
            }
Esempio n. 3
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);
        }
Esempio n. 4
0
        public static void deleteSwitch(int intSwitchID)
        {
            SqlConnection con = new clsSwitchScheme().con;
            SqlCommand    cmd = new SqlCommand();

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

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

            cmd.ExecuteNonQuery();
        }
Esempio n. 5
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()));
        }
Esempio n. 6
0
        public static List <clsSwitchScheme> getSwitchList(int intIFA_ID, string strClientName, string strCompany, int intStatus, string strStartDate, string strEndDate)
        {
            List <clsSwitchScheme> SwitchList = new List <clsSwitchScheme>();

            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 = "[SWITCHScheme_HeaderGetAllByIFA]";

            cmd.Parameters.Add("@param_IFA_ID", System.Data.SqlDbType.Int).Value          = intIFA_ID;
            cmd.Parameters.Add("@param_ClientName", System.Data.SqlDbType.NVarChar).Value = strClientName;
            cmd.Parameters.Add("@param_Company", System.Data.SqlDbType.NVarChar).Value    = strCompany;
            cmd.Parameters.Add("@param_Status", System.Data.SqlDbType.Int).Value          = intStatus;
            cmd.Parameters.Add("@param_StartDate", System.Data.SqlDbType.NVarChar).Value  = strStartDate;
            cmd.Parameters.Add("@param_EndDate", System.Data.SqlDbType.NVarChar).Value    = strEndDate;
            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                clsSwitchScheme Switch = new clsSwitchScheme();
                Switch.propSwitchID     = int.Parse(dr["SwitchID"].ToString());
                Switch.propClient       = new clsClient(dr["ClientID"].ToString());
                Switch.propScheme       = new clsScheme(Switch.propClient.propClientID, dr["SchemeID"].ToString());
                Switch.propStatus       = short.Parse(dr["Status"].ToString());
                Switch.propStatusString = clsSwitch.getSwitchStringStatus(Switch.propStatus);
                Switch.propDate_Created = dr["Date_Created"] != System.DBNull.Value ? DateTime.Parse(dr["Date_Created"].ToString()) : DateTime.ParseExact("01/01/1800", "dd/MM/yyyy", null);
                Switch.propCreated_By   = dr["Created_By"].ToString();
                Switch.propDescription  = dr["Description"].ToString();

                SwitchList.Add(Switch);
            }

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

            return(SwitchList);
        }
Esempio n. 7
0
            public static void deleteAllDetails(Nullable <int> intSwitchID)
            {
                if (intSwitchID == null)
                {
                    return;
                }

                SqlConnection con = new clsSwitchScheme().con;

                con.Open();

                SqlCommand cmd = new SqlCommand();

                cmd.Connection = con;

                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.CommandText = "[SWITCHScheme_DetailsDeleteAll]";

                cmd.Parameters.Add("@param_SwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;
                cmd.ExecuteNonQuery();
            }
            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;
            }
            public static void insertSwitchDetails(List<clsSwitchSchemeDetails> listSwitchDetails, string strUserID, int intSwitchID, Boolean isContribution)
            {
                SqlConnection con = new clsSwitchScheme().con;
                con.Open();

                foreach (clsSwitchSchemeDetails SwitchDetail in listSwitchDetails)
                {
                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection = con;

                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "[SWITCHScheme_DetailsInsert]";

                    cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;
                    cmd.Parameters.Add("@param_intFundID", System.Data.SqlDbType.Int).Value = SwitchDetail.propFund.propFundID;
                    cmd.Parameters.Add("@param_fAllocation", System.Data.SqlDbType.Float).Value = SwitchDetail.propAllocation;
                    cmd.Parameters.Add("@param_strCreated_By", System.Data.SqlDbType.NVarChar).Value = strUserID;
                    cmd.Parameters.Add("@param_strUpdated_By", System.Data.SqlDbType.NVarChar).Value = strUserID;
                    cmd.Parameters.Add("@param_intSwitchDetailsID", System.Data.SqlDbType.Int).Value = SwitchDetail.intSwitchDetailsID;
                    cmd.Parameters.Add("@param_sintIsDeletable", System.Data.SqlDbType.SmallInt).Value = SwitchDetail.propIsDeletable == true ? 1 : 0;
                    cmd.Parameters.Add("@param_sintIsContribution", System.Data.SqlDbType.SmallInt).Value = isContribution == true ? 1 : 0;

                    cmd.ExecuteNonQuery();
                }
            }
Esempio n. 10
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;
            }
Esempio n. 11
0
        public static void deleteSwitch(int intSwitchID)
        {

            SqlConnection con = new clsSwitchScheme().con;
            SqlCommand cmd = new SqlCommand();

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

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

            cmd.ExecuteNonQuery();

        }
Esempio n. 12
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());

        }
Esempio n. 13
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;
        }
Esempio n. 14
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);
            }
Esempio n. 15
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);
            }
Esempio n. 16
0
            public static void transferClientSwitchToIFA(List<clsSwitchScheme_Client.clsSwitchSchemeDetails_Client> listClientSwitchDetails, string strUserID, Boolean isContribution)
            {
                clsSwitchScheme SwitchIFA = new clsSwitchScheme(listClientSwitchDetails[0].propSwitchScheme.propSwitchID);

                string strClientID = SwitchIFA.propClient.propClientID;
                string strSchemeID = SwitchIFA.propScheme.propSchemeID;                
                
                List<clsSwitchScheme.clsSwitchSchemeDetails> listSwitchDetailsIFA = new clsSwitchScheme(new clsScheme(strClientID, strSchemeID)).propSwitchDetails;
                List<clsSwitchScheme.clsSwitchSchemeDetails> newListSwitchDetails = new List<clsSwitchScheme.clsSwitchSchemeDetails>();

                foreach (clsSwitchScheme_Client.clsSwitchSchemeDetails_Client SwitchDetails_Client in listClientSwitchDetails)
                {
                    clsSwitchScheme.clsSwitchSchemeDetails newSwitchDetails = new clsSwitchScheme.clsSwitchSchemeDetails();
                    newSwitchDetails.propSwitchScheme = new clsSwitchScheme(SwitchIFA.propSwitchID);
                    newSwitchDetails.propFund = new clsFund(SwitchDetails_Client.propFund.propFundID);
                    newSwitchDetails.propAllocation = SwitchDetails_Client.propAllocation;
                    newSwitchDetails.propIsDeletable = SwitchDetails_Client.propIsDeletable;
                    newSwitchDetails.propIsContribution = isContribution;

                    newListSwitchDetails.Add(newSwitchDetails);

                }

                clsSwitchScheme.clsSwitchSchemeDetails.insertSwitchDetails(newListSwitchDetails, strUserID, SwitchIFA.propSwitchID, isContribution);
            }
Esempio n. 17
0
            public static void deleteAllDetails(Nullable<int> intSwitchID)
            {
                if (intSwitchID == null) { return; }

                SqlConnection con = new clsSwitchScheme().con;
                con.Open();

                SqlCommand cmd = new SqlCommand();
                cmd.Connection = con;

                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.CommandText = "[SWITCHScheme_DetailsDeleteAll]";

                cmd.Parameters.Add("@param_SwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;
                cmd.ExecuteNonQuery();
                
            }
Esempio n. 18
0
        public static List<clsSwitchScheme> getSwitchList(int intIFA_ID, string strClientName, string strCompany, int intStatus, string strStartDate, string strEndDate)
        {
            List<clsSwitchScheme> SwitchList = new List<clsSwitchScheme>();

            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 = "[SWITCHScheme_HeaderGetAllByIFA]";

            cmd.Parameters.Add("@param_IFA_ID", System.Data.SqlDbType.Int).Value = intIFA_ID;
            cmd.Parameters.Add("@param_ClientName", System.Data.SqlDbType.NVarChar).Value = strClientName;
            cmd.Parameters.Add("@param_Company", System.Data.SqlDbType.NVarChar).Value = strCompany;
            cmd.Parameters.Add("@param_Status", System.Data.SqlDbType.Int).Value = intStatus;
            cmd.Parameters.Add("@param_StartDate", System.Data.SqlDbType.NVarChar).Value = strStartDate;
            cmd.Parameters.Add("@param_EndDate", System.Data.SqlDbType.NVarChar).Value = strEndDate;
            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                clsSwitchScheme Switch = new clsSwitchScheme();
                Switch.propSwitchID = int.Parse(dr["SwitchID"].ToString());
                Switch.propClient = new clsClient(dr["ClientID"].ToString());
                Switch.propScheme = new clsScheme(Switch.propClient.propClientID, dr["SchemeID"].ToString());                
                Switch.propStatus = short.Parse(dr["Status"].ToString());
                Switch.propStatusString = clsSwitch.getSwitchStringStatus(Switch.propStatus);
                Switch.propDate_Created = dr["Date_Created"] != System.DBNull.Value ? DateTime.Parse(dr["Date_Created"].ToString()) : DateTime.ParseExact("01/01/1800", "dd/MM/yyyy", null);
                Switch.propCreated_By = dr["Created_By"].ToString();
                Switch.propDescription = dr["Description"].ToString();                

                SwitchList.Add(Switch);
            }

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

            return SwitchList;
        }