Пример #1
0
        private void ClearButton1_Click(object sender, EventArgs e)
        {
            //
            // Disabling the Investment Plan group box, Confirm group box, User input text boxes are cleared
            ConfirmButton1.Font = new Font(ConfirmButton1.Font.Name, ConfirmButton1.Font.Size, FontStyle.Regular);
            ProceedButton1.Font = new Font(ProceedButton1.Font.Name, ProceedButton1.Font.Size, FontStyle.Regular);
            TransactionNumberAnswerClientDetailsLabel1.Text = "";
            ClientNameAnsTextBox1.Text          = "";
            EmailIDAnsTextBox1.Text             = "";
            TelephoneAnsTextBox1.Text           = "";
            EnterClientDetailsGroupBox1.Enabled = false;
            PlanGroupBox1.Enabled = false;
            //
            // Enabling the User input investment amount text box and group box
            InvestmentAmountGroupBox1.Enabled = true;
            DisplayButton1.Font           = new Font(DisplayButton1.Font.Name, DisplayButton1.Font.Size, FontStyle.Bold);
            InvestmentAmountTextBox1.Text = "";
            //
            // Clearing the summary and search group box
            SummaryTransactionNumberListBox1.Items.Clear();
            SearchTransactionsListBox1.Items.Clear();
            TotalAmountInvestedAnsLabel1.Text           = "";
            TotalInterestAnsLabel1.Text                 = "";
            AverageDurationAnsLabel1.Text               = "";
            SearchResultEmailIdAnsLabel1.Text           = "";
            SearchResultInvestedAmountAnswerLabel1.Text = "";
            SearchResultClientNameAnswerLabel1.Text     = "";
            SearchResultBalanceAmountAnswerLabel1.Text  = "";
            SearchResultTelephoneAnswerLabel1.Text      = "";
            SearchResultTermPlanAnswerLabel1.Text       = "";
            //
            // Changing the text of radio button to default
            OneYearPlanRadioButton1.Text    = "1 Year Plan";
            ThreeYearsPlanRadioButton1.Text = "3 Years Plan";
            FiveYearsPlanRadioButton1.Text  = "5 Years Plan";
            TenYearsPlanRadioButton1.Text   = "10 Years Plan";
            SummaryButton1.Enabled          = true;
            SummaryButton1.Font             = new Font(SummaryButton1.Font.Name, SummaryButton1.Font.Size, FontStyle.Bold);
            //
            // Code for unchecking all the radio buttons selected in the plan group box
            var Cntl = GetAllRadButton(this, typeof(RadioButton));

            foreach (Control cntrl in Cntl)
            {
                RadioButton _RadButton = (RadioButton)cntrl;
                if (_RadButton.Checked)
                {
                    _RadButton.Checked = false;
                }
            }
            SearchTextBox1.Text = "";
            //
            // Setting the focus back to investment amount text box
            InvestmentAmountTextBox1.Focus();
        }
Пример #2
0
 //
 // Event and Action defined for the load of Invest Me Application Page
 private void InvestMeForm1_Load(object sender, EventArgs e)
 {
     //
     // Code to let enter Investment amount, Get the summary or search for any transaction
     PlanGroupBox1.Enabled = false;
     // Client details need to be entered only after Investment amount and selecting the plan
     EnterClientDetailsGroupBox1.Enabled = false;
     //
     // Setting the focus on Invest amount text box
     InvestmentAmountTextBox1.Focus();
 }
Пример #3
0
 //
 // Event defiened when the user clicks on Display button
 private void DisplayButton1_Click(object sender, EventArgs e)
 {
     //
     // Try to check if the value entered in the Investment Amount Textbox is only numeric
     try
     {
         InvestmentAmount = decimal.Parse(InvestmentAmountTextBox1.Text);
         //
         //  To check if the value entered in the Investment Amount Textbox is non negative
         if (InvestmentAmount <= 0)
         {
             MessageBox.Show("Investment amount should be positive value", "I/P Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
             //
             // Bringing the focus back to discountfare passenger textbox for user edit
             InvestmentAmountTextBox1.Focus();
             InvestmentAmountTextBox1.SelectAll();
         }
         else
         {
             //
             // If condition when the investment amount is less than or equal to 250000 Euros
             if (InvestmentAmount <= 250000)
             {
                 BalanceOneYearPlan              = Math.Round(Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(ONEYEARINTERESTRATELOW)), 12)), 2);
                 BalanceThreeYearsPlan           = Math.Round(Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(THREEYEARSINTERESTRATELOW)), 36)), 2);
                 BalanceFiveYearsPlan            = Math.Round(Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(FIVEYEARSINTERESTRATELOW)), 60)), 2);
                 BalanceTenYearsPlan             = Math.Round(Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(TENYEARSINTERESTRATELOW)), 120)), 2);
                 OneYearPlanRadioButton1.Text    = "One Year Plan | Rate - " + ONEYEARINTERESTRATELOW + " | Balance Total - " + BalanceOneYearPlan + String.Format("\u20AC");
                 ThreeYearsPlanRadioButton1.Text = "Three Years Plan | Rate - " + THREEYEARSINTERESTRATELOW + " | Balance Total - " + BalanceThreeYearsPlan + String.Format("\u20AC");
                 FiveYearsPlanRadioButton1.Text  = "Five Years Plan | Rate - " + FIVEYEARSINTERESTRATELOW + " | Balance Total - " + BalanceFiveYearsPlan + String.Format("\u20AC");
                 TenYearsPlanRadioButton1.Text   = "Ten Years Plan | Rate - " + TENYEARSINTERESTRATELOW + " | Balance Total - " + BalanceTenYearsPlan + String.Format("\u20AC");
             }
             //
             // Else if condition when investment amount is greater than 250000 Euros but less than 1000000
             else if (InvestmentAmount > 250000 && InvestmentAmount <= 1000000)
             {
                 BalanceOneYearPlan              = Math.Round(Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(ONEYEARINTERESTRATEHIGH)), 12)), 2);
                 BalanceThreeYearsPlan           = Math.Round(Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(THREEYEARSINTERESTRATEHIGH)), 36)), 2);
                 BalanceFiveYearsPlan            = Math.Round(Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(FIVEYEARSINTERESTRATEHIGH)), 60)), 2);
                 BalanceTenYearsPlan             = Math.Round(Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(TENYEARSINTERESTRATEHIGH)), 120)), 2);
                 OneYearPlanRadioButton1.Text    = "One Year Plan | Rate - " + ONEYEARINTERESTRATEHIGH + " | Balance Total - " + BalanceOneYearPlan + String.Format("\u20AC");
                 ThreeYearsPlanRadioButton1.Text = "Three Years Plan | Rate - " + THREEYEARSINTERESTRATEHIGH + " | Balance Total - " + BalanceThreeYearsPlan + String.Format("\u20AC");
                 FiveYearsPlanRadioButton1.Text  = "Five Years Plan | Rate - " + FIVEYEARSINTERESTRATEHIGH + " | Balance Total - " + BalanceFiveYearsPlan + String.Format("\u20AC");
                 TenYearsPlanRadioButton1.Text   = "Ten Years Plan | Rate - " + TENYEARSINTERESTRATEHIGH + " | Balance Total - " + BalanceTenYearsPlan + String.Format("\u20AC");
             }
             //
             // Else condition when investment amount is greater than 1000000
             else
             {
                 BalanceOneYearPlan              = Math.Round(Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(ONEYEARINTERESTRATEHIGH)), 12)), 2);
                 BalanceThreeYearsPlan           = Math.Round((Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(THREEYEARSINTERESTRATEHIGH)), 36))) + 25000, 2);
                 BalanceFiveYearsPlan            = Math.Round((Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(FIVEYEARSINTERESTRATEHIGH)), 60))) + 25000, 2);
                 BalanceTenYearsPlan             = Math.Round((Convert.ToDecimal(Convert.ToDouble(InvestmentAmount) * Math.Pow((1 + Convert.ToDouble(TENYEARSINTERESTRATEHIGH)), 120))) + 25000, 2);
                 OneYearPlanRadioButton1.Text    = "One Year Plan | Rate - " + ONEYEARINTERESTRATEHIGH + " | Balance Total - " + BalanceOneYearPlan + String.Format("\u20AC");
                 ThreeYearsPlanRadioButton1.Text = "Three Years Plan | Rate - " + THREEYEARSINTERESTRATEHIGH + " | Balance Total (Incl. Bonus) - " + BalanceThreeYearsPlan + String.Format("\u20AC");
                 FiveYearsPlanRadioButton1.Text  = "Five Years Plan | Rate - " + FIVEYEARSINTERESTRATEHIGH + " | Balance Total (Incl. Bonus) - " + BalanceFiveYearsPlan + String.Format("\u20AC");
                 TenYearsPlanRadioButton1.Text   = "Ten Years Plan | Rate - " + TENYEARSINTERESTRATEHIGH + " | Balance Total (Incl. Bonus) - " + BalanceTenYearsPlan + String.Format("\u20AC");
             }
             //
             // After display button is clicked and amount entered is valid Investment Plan groupbox is enabled to select the investment plan
             PlanGroupBox1.Enabled = true;
             //
             // Once the user has entered the amount we disable the user investment amount text box and Display button
             DisplayButton1.Font = new Font(DisplayButton1.Font.Name, DisplayButton1.Font.Size, FontStyle.Regular);
             InvestmentAmountGroupBox1.Enabled = false;
             ProceedButton1.Font = new Font(ProceedButton1.Font.Name, ProceedButton1.Font.Size, FontStyle.Bold);
         }
     }
     catch
     {
         MessageBox.Show("Investment amount should be non empty positive value", "I/P Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
         //
         // Bringing the focus back to Investment amount textbox for user edit
         InvestmentAmountTextBox1.Focus();
         InvestmentAmountTextBox1.SelectAll();
     }
 }