private void Calculate(string option) { double NetSalary, Salary, Allowances = 0; Salary = Convert.ToDouble(TextBox1.Text); switch (option) { case "HRA": Allowances = Salary * 10 / 100; break; case "MA": Allowances = Salary * 20 / 100; break; case "IA": Allowances = Salary * 30 / 100; break; case "TA": Allowances = Salary * 40 / 100; break; } NetSalary = Allowances; TextBox2.Text = NetSalary.ToString(); }
protected void Button1_Click(object sender, EventArgs e) { double NetSalary, Salary, HRA, TA, MA; Salary = Convert.ToDouble(TextBox2.Text); HRA = Convert.ToDouble(TextBox3.Text); TA = Convert.ToDouble(TextBox4.Text); MA = Convert.ToDouble(TextBox5.Text); NetSalary = Salary + HRA + TA + MA; TextBox8.Text = NetSalary.ToString(); }
public void NetDeduction() { if (daysWorkedTextBox.Text != "") { DaysWorked = double.Parse(daysWorkedTextBox.Text); DaysAbsent = double.Parse(absentDaysTextBox.Text); GrossSalary = double.Parse(grossSalaryTextBox.Text); Paye = double.Parse(payeLabel.Text); TheAbsentDays = GrossSalary / 30 * DaysAbsent; Deduction = Paye + TheAbsentDays; NetSalary = GrossSalary - Deduction; dlabel.Text = Deduction.ToString("#,##0.00"); netSalaryTextBox.Text = NetSalary.ToString("#,##0.00"); } else { netSalaryTextBox.Text = ""; } }
private void Calculate(int option) { double NetSalary, Salary, Allowances = 0; Salary = Convert.ToDouble(TextBox1.Text); switch (option) { case 1: Allowances = Salary * 10 / 100; break; case 2: Allowances = Salary * 20 / 100; break; case 3: Allowances = Salary * 30 / 100; break; } NetSalary = Allowances; TextBox2.Text = NetSalary.ToString(); }
private void Calculate(String v, bool @checked) { double NetSalary, Salary, Allowances = 0; Salary = Convert.ToDouble(TextBox1.Text); NetSalary = Convert.ToDouble(TextBox2.Text); if (NetSalary.Equals(0)) { NetSalary = Salary; } switch (v) { case "HRA": Allowances = Salary * 10 / 100; break; case "MA": Allowances = Salary * 20 / 100; break; case "IA": Allowances = Salary * 30 / 100; break; } if (@checked) { NetSalary += Allowances; } else { NetSalary -= Allowances; } TextBox2.Text = NetSalary.ToString(); }