Beispiel #1
0
        //Confirm button confirms the user details that are Entered.
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            //Calls the meathod to validat Email-Id.
            EmailStatus   = IsValidEmail(ClientMailIdTextBox.Text);
            ClientName    = ClientNameTextBox.Text;
            ClientTelNo   = ClientTelNoTextBox.Text;
            ClientMailId  = ClientMailIdTextBox.Text;
            TransactionNo = TransactionNoDisplayLabel.Text;
            //Check if all fields are valid and displays accordingly.
            if (ClientName != "" && ClientTelNo != "" && ClientMailId != "")
            {
                if (EmailStatus == true)
                {
                    ClientDetailGroupBox.Visible   = false;
                    ConfirmButton.Enabled          = false;
                    DetailsDisplayGroupBox.Visible = true;
                    FinalConfirmButton.Visible     = true;
                    FinalConfirmButton.Enabled     = true;
                    switch (TimeFrameListBox.SelectedIndex)
                    {
                    case 0:
                        Term = TIMEFRAME1;
                        break;

                    case 1:
                        Term = TIMEFRAME2;
                        break;

                    case 2:
                        Term = TIMEFRAME3;
                        break;

                    case 3:
                        Term = TIMEFRAME4;
                        break;
                    }
                    //Displays the details in details box.
                    ClientDisplayDetailsLabel.Text        = ClientName;
                    ClientTelNoDisplayDetailsLabel.Text   = ClientTelNo;
                    ClientMailIdDisplayDetailsLabel.Text  = ClientMailId;
                    TransactionNoDisplayDetailsLabel.Text = TransactionNo;
                    decimal TempPrincipalAmount = decimal.Parse(InvestAmountTextBox.Text);
                    PrincipalAmountDisplayDetailsLabel.Text = TempPrincipalAmount.ToString("C4");
                    InterestRateDisplayDetailsLabel.Text    = InterestRate.ToString("0.00");
                    FinalAmountDisplayDetailsLabel.Text     = FinalAmount.ToString("C4");
                    TermDisplayDetailsLabel.Text            = Term.ToString();
                }
                else
                {
                    //If boolean value is false.
                    MessageBox.Show("Please Enter a valid Email ID", "Invalid Field", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    ClientMailIdTextBox.Focus();
                    ClientMailIdTextBox.SelectAll();
                }
            }
            else
            {
                MessageBox.Show("Enter all fields", "Invalid/Blank Fields", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }