コード例 #1
0
        private Transaction AddEmp(string line, WordReader wordReader)
        {
            var empId   = wordReader.NextAsInt();
            var name    = wordReader.NextQuoted();
            var address = wordReader.NextQuoted();

            switch (wordReader.Next())
            {
            case "H":
                return(AddHourlyEmployee(empId, name, address, wordReader));

            case "S":
                return(AddSalariedEmployee(empId, name, address, wordReader));

            case "C":
                return(AddCommissionedEmployee(empId, name, address, wordReader));
            }
            throw new InvalidOperationException(string.Format("Cannot parse {0}", line));
        }
コード例 #2
0
        private Transaction ChangeEmployee(string line, WordReader wordReader)
        {
            var empId = wordReader.NextAsInt();

            switch (wordReader.Next())
            {
            case "Member":
                return(ChangeEmployeeMember(empId, wordReader));

            case "Name":
                return(ChangeEmployeeName(empId, wordReader));

            case "Address":
                return(ChangeEmployeeAddress(empId, wordReader));

            case "Hourly":
                return(ChangeHourly(empId, wordReader));

            case "Salaried":
                return(ChangeSalaried(empId, wordReader));

            case "Commissioned":
                return(ChangeCommissioned(empId, wordReader));

            case "Direct":
                return(ChangeDirect(empId, wordReader));

            case "Hold":
                return(ChangeHold(empId, wordReader));

            case "Mail":
                return(ChangeMail(empId, wordReader));

            case "NoMember":
                return(ChangeNoMember(empId, wordReader));
            }

            throw new InvalidOperationException(string.Format("Couldn't parse {0}", line));
        }
コード例 #3
0
 private Transaction ChangeDirect(int empId, WordReader wordReader)
 {
     return(_transactionFactory.MakeChangeDirectTransaction(empId, wordReader.Next(), wordReader.Next()));
 }