private void addBeneficiary_Click(object sender, EventArgs e)
        {
            bool fieldFilled = true;
            bool noError     = true;

            foreach (TextBox tb in GetControls(this).OfType <TextBox>())
            {
                if (string.IsNullOrEmpty(tb.Text))
                {
                    fieldFilled = false;
                }
            }
            foreach (Control c in this.Controls)
            {
                if (errorProvider1.GetError(c).Length > 0)
                {
                    noError = false;
                }
            }



            if (fieldFilled && noError && !string.IsNullOrEmpty(comboBox1.Text))
            {
                LIC_KIHD_MW.Address      addre  = new LIC_KIHD_MW.Address("", "", "", "");
                LIC_KIHD_MW.PolicyHolder holder = new LIC_KIHD_MW.PolicyHolder("", "", "", addre);
                LIC_KIHD_MW.Beneficiary  BENE   = new LIC_KIHD_MW.Beneficiary("", "");
                LIC_KIHD_MW.Policy       po     = new LIC_KIHD_MW.Policy(holder, "", 1, 1, 1, 1, 1, 1, 1, "", "", "", "", BENE, "");

                state = comboBox1.SelectedItem.ToString();
                DateTime txtMyDate = DateTime.Parse(BirthBox.Text);
                double   premium   = po.CalculatePremium(textBox15.Text, txtMyDate, FatherBox.Text, motherBox.Text, cigBox.Text, smokeBox.Text, bloodBox.Text,
                                                         aveGramsBox.Text, HeartDisease, cancer, hospital, textBox14.Text);


                QuoteForm quote = new QuoteForm(FirstNameBox.Text, LastNameBox.Text, BirthBox.Text, AddressBox.Text, CityBox.Text, state, ZipBox.Text, FatherBox.Text, motherBox.Text,
                                                cigBox.Text, smokeBox.Text, bloodBox.Text, aveGramsBox.Text, HDPassToQuote, cancerToQ, hospitalToQ, textBox14.Text, textBox15.Text, premium.ToString(), agent,
                                                HeartDisease, cancer, hospital
                                                );
                quote.Closed += (s, arges) => this.Close();
                quote.ShowDialog();
            }
            else if (!fieldFilled)
            {
                MessageBox.Show("You need to fill all the boxes!");
            }
            else if (!noError)
            {
                MessageBox.Show("You need to enter valid information!");
            }
            else
            {
                MessageBox.Show("You need to enter valid information!");
            }
        }
Esempio n. 2
0
        private void add_Click(object sender, EventArgs e)
        {
            LIC_KIHD_MW.Address      addre  = new LIC_KIHD_MW.Address("", "", "", "");
            LIC_KIHD_MW.PolicyHolder holder = new LIC_KIHD_MW.PolicyHolder("", "", "", addre);
            LIC_KIHD_MW.Beneficiary  BENE   = new LIC_KIHD_MW.Beneficiary("", "");
            LIC_KIHD_MW.Policy       po     = new LIC_KIHD_MW.Policy(holder, "", 1, 1, 1, 1, 1, 1, 1, "", "", "", "", BENE, "");

            po.addBeneficiary(policyN, firstName.Text, lastName.Text);
            addBeneficiary addMore = new addBeneficiary(policyN);

            Hide();
            addMore.Closed += (s, arges) => this.Close();
            addMore.ShowDialog();
        }
Esempio n. 3
0
        private void buttonClaim_Click(object sender, EventArgs e)
        {
            LIC_KIHD_MW.Address      addre  = new LIC_KIHD_MW.Address("", "", "", "");
            LIC_KIHD_MW.PolicyHolder holder = new LIC_KIHD_MW.PolicyHolder("", "", "", addre);
            LIC_KIHD_MW.Beneficiary  BENE   = new LIC_KIHD_MW.Beneficiary("", "");
            LIC_KIHD_MW.Policy       po     = new LIC_KIHD_MW.Policy(holder, "", 1, 1, 1, 1, 1, 1, 1, "", "", "", "", BENE, "");

            bool highNetLoss = po.MakeClaim(labelForPolicyNumber.Text);

            if (highNetLoss)
            {
                MessageBox.Show("A loss off 5.4% has been detected. Please notify the Obfuscation Department!”");
            }
            else
            {
                MessageBox.Show("This policy has been claimed successfully");
            }
        }
        private void CancelPolicyButton_Click(object sender, EventArgs e)
        {
            LIC_KIHD_MW.Address      addre  = new LIC_KIHD_MW.Address("", "", "", "");
            LIC_KIHD_MW.PolicyHolder holder = new LIC_KIHD_MW.PolicyHolder("", "", "", addre);
            LIC_KIHD_MW.Beneficiary  BENE   = new LIC_KIHD_MW.Beneficiary("", "");
            LIC_KIHD_MW.Policy       po     = new LIC_KIHD_MW.Policy(holder, "", 1, 1, 1, 1, 1, 1, 1, "", "", "", "", BENE, "");
            var confirmResult = MessageBox.Show("Are you sure to cancel this policy ??",
                                                "Confirm Delete!!",
                                                MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                po.Cancel(policynumber);
                MessageBox.Show("Policy has been cancelled successfully");// If 'Yes', do something here.
                labelForStatus.Text = "I";
            }
            else
            {
            }
        }
Esempio n. 5
0
        private void comfirm_Click(object sender, EventArgs e)
        {
            LIC_KIHD_MW.Address      addre  = new LIC_KIHD_MW.Address("", "", "", "");
            LIC_KIHD_MW.PolicyHolder holder = new LIC_KIHD_MW.PolicyHolder("", "", "", addre);
            LIC_KIHD_MW.Beneficiary  BENE   = new LIC_KIHD_MW.Beneficiary("", "");
            LIC_KIHD_MW.Policy       po     = new LIC_KIHD_MW.Policy(holder, "", 1, 1, 1, 1, 1, 1, 1, "", "", "", "", BENE, "");

            // List<LIC_KIHD_MW.Beneficiary> beneficiary = new List<LIC_KIHD_MW.Beneficiary>();

            DateTime dod          = DateTime.Parse(dateOfBirth.Text);
            string   policynumber = po.PolicyNumReg(firstName.Text, LastName.Text, dod, StreetAdress.Text, CityLabel.Text, StateLabel.Text, zipCode.Text, FatherAgeAtDeath.Text
                                                    , MotherAgeAtDeath.Text, CigarettesPerDay.Text, SmokingHistory.Text, BloodPressure.Text, AverageGrams.Text, hd, ca, ho
                                                    , DangerousActivities.Text, payoffA, monthPremium, agentID);
            addBeneficiary addB = new addBeneficiary(policynumber);

            addB.Closed += (s, arges) => this.Close();
            // complete register and return back
            MessageBox.Show("The policy had been created successfully, and your policy number is " + policynumber);

            addB.ShowDialog();
        }