示例#1
0
 private void button_Price_Click(object sender, EventArgs e)
 {
     try
     {
         errorMessage(false);
         if (textBox_PolicyholderDOB.Text == "" || textBox_FatherAAD.Text == "" || textBox_MotherAAD.Text == "" || textBox_SmokingHistory.Text == "" ||
             textBox_CigPerDay.Text == "" || textBox_PayOffAmount.Text == "")
         {
             PriceButtonWarning priceFirst = new PriceButtonWarning(false);
             priceFirst.Show();
         }
         else
         {
             string stringDOB = textBox_PolicyholderDOB.Text;
             double value;
             if (Double.TryParse(textBox_FatherAAD.Text, out value))
             {
             }
             DateTime DOB = DateTime.Parse(textBox_PolicyholderDOB.Text);
             pricingPolicy = new Policy(DOB, Convert.ToDouble(textBox_FatherAAD.Text), Convert.ToDouble(textBox_MotherAAD.Text), Convert.ToDouble(textBox_CigPerDay.Text),
                                        Convert.ToDouble(textBox_SmokingHistory.Text), Convert.ToDouble(textBox_SystolicBloodPressure.Text), Convert.ToDouble(textBox_AverageFatPerDay.Text),
                                        radioButton_YesHeartDisease.Checked, radioButton_YesCancer.Checked, radioButton_YesHospitalized.Checked, textBox_DangerousActivity.Text);
             pricingPolicy.PayOffAmount = Convert.ToDouble(textBox_PayOffAmount.Text);
             double premium = pricingPolicy.PricePolicy();
             label_ShowTotalAmountOfPayment.Text    = " " + premium;
             label_ShowTotalAmountOfPayment.Visible = true;
         }
     }
     catch
     {
         errorMessage(true);
     }
 }
示例#2
0
 private void button_Accept_Click(object sender, EventArgs e)
 {
     if (label_ShowTotalAmountOfPayment.Visible)
     {
         pricingPolicy.Premium      = Convert.ToDouble(label_ShowTotalAmountOfPayment.Text);
         pricingPolicy.StartDate    = DateTime.Today;
         pricingPolicy.Holder.ID    = pricingPolicy.Holder.getNextId();
         pricingPolicy.PolicyNumber = pricingPolicy.getNextNumber();
         AddPolicy addPolicy = new AddPolicy(pricingPolicy, usingAgent, this);
         addPolicy.Show();
         this.Hide();
     }
     else
     {
         PriceButtonWarning priceFirst = new PriceButtonWarning(true);
         priceFirst.Show();
     }
 }