public void WorkingDays_Test() { double workdays = 20; double expected = 10000; double actual = obj.workingdays(workdays); Assert.AreEqual(expected, actual, "Operation failed to complete!"); }
private void UpdateSalDetailsButton_Click(object sender, EventArgs e) { double store = obj.days(double.Parse(FullDays_txt.Text), double.Parse(HalfDays_txt.Text.Trim())); WorkHours_txt.Text = store.ToString(); double basic = obj.workingdays(double.Parse(WorkHours_txt.Text)); BasicSalary_txt.Text = basic.ToString(); double allowance = obj.allowance(double.Parse(BasicSalary_txt.Text)); allowance_txt.Text = allowance.ToString(); double grosspay = obj.grosspay(double.Parse(allowance_txt.Text), double.Parse(BasicSalary_txt.Text)); GrossPay_txt.Text = grosspay.ToString(); double incometax = obj.Incometax(double.Parse(BasicSalary_txt.Text), double.Parse(GrossPay_txt.Text)); IncomeTax_txt.Text = incometax.ToString(); string performance = obj.performance(double.Parse(WorkHours_txt.Text)); performance_txt.Text = performance; double netpay = obj.netsalary(double.Parse(BasicSalary_txt.Text), double.Parse(IncomeTax_txt.Text)); netpay_txt.Text = netpay.ToString(); try { if (WorkHours_txt.Text == "0") { throw new Exception(); } else { Employee.Updateemployeesalarydetails(EmpIdtxt.Text, Designation_txt.Text, FullDays_txt.Text, HalfDays_txt.Text, LeaveDays_txt.Text, WorkHours_txt.Text, allowance_txt.Text, BasicSalary_txt.Text, GrossPay_txt.Text, IncomeTax_txt.Text, netpay_txt.Text, performance_txt.Text); MessageBox.Show("Record Updated Successfully"); dataGridView1.DataSource = Employee.searchemployeesalarydetails(EmpIdtxt.Text); totalsalary_txt.Text = netpay_txt.Text; } } catch (Exception) { MessageBox.Show("Invalid Days Entered!"); } }
private void AddSalDetailsButton_Click(object sender, EventArgs e) { if (EmpIdtxt.Text != "") { double store = obj.days(double.Parse(FullDays_txt.Text), double.Parse(HalfDays_txt.Text.Trim())); WorkHours_txt.Text = store.ToString(); double basic = obj.workingdays(double.Parse(WorkHours_txt.Text)); BasicSalary_txt.Text = basic.ToString(); double allowance = obj.allowance(double.Parse(BasicSalary_txt.Text)); allowance_txt.Text = allowance.ToString(); double grosspay = obj.grosspay(double.Parse(allowance_txt.Text), double.Parse(BasicSalary_txt.Text)); GrossPay_txt.Text = grosspay.ToString(); double incometax = obj.Incometax(double.Parse(BasicSalary_txt.Text), double.Parse(GrossPay_txt.Text)); IncomeTax_txt.Text = incometax.ToString(); string performance = obj.performance(double.Parse(WorkHours_txt.Text)); performance_txt.Text = performance; double netpay = obj.netsalary(double.Parse(BasicSalary_txt.Text), double.Parse(IncomeTax_txt.Text)); netpay_txt.Text = netpay.ToString(); try { if (WorkHours_txt.Text == "0") { throw new Exception(); } else { SalaryCalculation.InsertSalaryDetails(EmpIdtxt.Text, Designation_txt.Text, FullDays_txt.Text, HalfDays_txt.Text, LeaveDays_txt.Text, WorkHours_txt.Text, allowance_txt.Text, BasicSalary_txt.Text, GrossPay_txt.Text, IncomeTax_txt.Text, netpay_txt.Text, performance_txt.Text); } MessageBox.Show("Record Inserted Successfully"); } catch (Exception) { MessageBox.Show("INvalid Days Entered!"); } } else { MessageBox.Show("Must fill Empty Spaces!"); } }