コード例 #1
0
        // Add Row || Create ListView Items || Create Employee Objects

        private void addRowEmpList(string empNum, string fName, string lName, string type)
        {
            if (cb_Type.SelectedItem.ToString() == "Hourly")
            {
                hourly               = new Hourly();
                employee             = new Employee(hourly, empNum, fName, lName, type);
                employee.Hourly.Rate = Convert.ToDecimal(tBox_Rate.Text);
            }
            if (cb_Type.SelectedItem.ToString() == "Salary")
            {
                salary               = new Salary();
                employee             = new Employee(salary, empNum, fName, lName, type);
                employee.Salary.Rate = Convert.ToDecimal(tBox_Rate.Text);
            }
            if (cb_Type.SelectedItem.ToString() == "Commission")
            {
                commission = new Commission();
                employee   = new Employee(commission, empNum, fName, lName, type);
                employee.Commission.Rate = Convert.ToDecimal(tBox_Rate.Text);
            }

            empDict.Add(empNum, employee);

            String[] row = { empNum, fName + " " + lName, type };
            LVitems     = new ListViewItem(row);
            LVitems.Tag = employee;
            listView_Emp.Items.Add(LVitems);

            save(empDict, admin);

            EmpNumber++;
        }
コード例 #2
0
ファイル: Employee.cs プロジェクト: xantar2482/Payroll_Final
        public Employee(Hourly hourly, string empNum, string fName, string lName, string type)
        {
            Hourly  = new Hourly();
            PayList = new List <Array>();

            Hourly    = hourly;
            EmpNum    = empNum;
            FirstName = fName;
            LastName  = lName;
            Type      = type;
        }