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) { AdministrativePersonelForm apf = new AdministrativePersonelForm(); if (MaritalStatus == "Married") { SalaryFactorAd += 1; } if (numOfChildren == 1) { SalaryFactorAd += 1; } else if (numOfChildren > 1) { double a = Convert.ToInt32(numOfChildren); SalaryFactorAd += (a * 0.75); } if (admDuty == true) { SalaryFactorAd += 1.5; } apf.label2.Text = Convert.ToString(BaseSalary * SalaryFactorAd + (step * 5) + (degree * 10)); double result = Convert.ToDouble(apf.label2.Text); return(result); }