hi
i am currenlty studying C sharp Visual studio, trying to convert a case study of polymorphism in payroll (which is avaiable in different books as console application) into windows application..
everything is going well, except here where i got switch statement and giving error in case 2- case 4
i have made this in VS 2010, soo convertor is included in attached file...
code is
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace PayrollSystem
{
public partial class payrollCalculaterForm : Form
{
public payrollCalculaterForm()
{
InitializeComponent();
}
private void comboBox1_SelectedValueChanged(object sender, EventArgs e)
{
fixedWeeklySalaryTextBox.Text = "";
hourlyPayTextBox.Text = "";
totalHoursTextBox.Text = "";
overTimePayTextBox.Text = "";
commissionRateTextBox.Text = "";
totalSaleTextBox.Text = "";
switch (employeeComboBox.Text)
{
case "Permanent":
fixedWeeklySalaryTextBox.Enabled = true;
hourlyPayTextBox.Enabled = false;
totalHoursTextBox.Enabled = false;
overTimePayTextBox.Enabled = false;
commissionRateTextBox.Enabled = false;
totalSaleTextBox.Enabled = false;
break;
case "Part time":
fixedWeeklySalaryTextBox.Enabled = false;
hourlyPayTextBox.Enabled = true;
totalHoursTextBox.Enabled = true;
overTimePayTextBox.Enabled = true;
commissionRateTextBox.Enabled = false;
totalSaleTextBox.Enabled = false;
break;
case "Part time Commission based":
fixedWeeklySalaryTextBox.Enabled = false;
hourlyPayTextBox.Enabled = false;
totalHoursTextBox.Enabled = false;
overTimePayTextBox.Enabled = false;
commissionRateTextBox.Enabled = true;
totalSaleTextBox.Enabled = true;
break;
case "Permanent Plus Commission based":
fixedWeeklySalaryTextBox.Enabled = true;
hourlyPayTextBox.Enabled = false;
totalHoursTextBox.Enabled = false;
overTimePayTextBox.Enabled = false;
commissionRateTextBox.Enabled = true;
totalSaleTextBox.Enabled = true;
break;
}
}
private void button1_Click(object sender, EventArgs e)
{
if (employeeComboBox.Text == "" || employeeComboBox.Text == "Choose Employee Type")
{
MessageBox.Show("Please Choose atleast one Employee Category in order to calculate Pay");
}
else
{
switch (employeeComboBox.Text)
{
case "Permanent":
permanentEmployees perEmployee = new permanentEmployees(fnameTextBox.Text,
LnameTextBox.Text, Convert.ToDecimal(fixedWeeklySalaryTextBox.Text));
totalEarningLabel.Text = "" + perEmployee.ToString() + "\r\n\n Weekly Earning : "
+ perEmployee.Earnings().ToString("C") + "";
break;
case "Part time":
/* partTimeEmployees Employee = new partTimeEmployees (fnameTextBox.Text,
LnameTextBox.Text, Convert.ToDecimal(fixedWeeklySalaryTextBox.Text),
Convert.ToDecimal(hourlyPayTextBox.Text), Convert.ToDecimal(totalHoursTextBox.Text),
Convert.ToDecimal(overTimePayTextBox.Text));
totalEarningLabel.Text = "" + Employee.ToString() + "\r\n\n Weekly Earning : "
+ Employee.Earnings().ToString("C") + "";
*/
break;
case "Part time Commission based":
break;
case "Permanent Plus Commission based":
break;
}
}
}
}
}
Problem is i am unable to figure out what excatly to write in case for employees then permanent one
thanks alot for your time