private void button1_Click(object sender, EventArgs e) { AcademicPersonelForm ac = new AcademicPersonelForm(); AdministrativePersonelForm ad = new AdministrativePersonelForm(); string ptype = Convert.ToString(comboBox1.SelectedItem); ac.label1.Text = ptype; ad.label1.Text = ptype; if (ac.label1.Text == "Academic Personel") { Hide(); ac.MaritalStatus = Convert.ToString(comboBox2.Text); ac.numOfChildren = Convert.ToInt32(textBox1.Text); ac.step = Convert.ToInt32(textBox2.Text); ac.degree = Convert.ToInt32(textBox3.Text); ac.ShowDialog(); Close(); } if (ad.label1.Text == "Administrative Personel") { Hide(); ad.numOfChildren = Convert.ToInt32(textBox1.Text); ad.step = Convert.ToInt32(textBox2.Text); ad.degree = Convert.ToInt32(textBox3.Text); ad.ShowDialog(); Close(); } }
public override double CalculateSalary(int numOfChildren, int degree, int step, string MaritalStatus) { AcademicPersonelForm apf = new AcademicPersonelForm(); if (MaritalStatus == "Married") { SalaryFactorAc += +1; } if (numOfChildren == 1) { SalaryFactorAc += 1; } else if (numOfChildren > 1) { double a = Convert.ToInt32(numOfChildren); SalaryFactorAc += (a * 0.75); } if (incentiveCoef > 0) { SalaryFactorAc += (incentiveCoef * 0.65); } apf.label2.Text = Convert.ToString((BaseSalary * SalaryFactorAc) + (step * 10) + (degree * 15)); double result = Convert.ToDouble(apf.label2.Text); return(result); }