public static ChangeEmployeeToHourlyCommand Parse(string command)
        {
            try
            {
                var arguments = CommandsArgumentsExtractor.ExtractFrom(command);

                if (!AreValid(arguments))
                {
                    throw new ChangeEmployeeToHourlyCommandStructureException();
                }

                return(new ChangeEmployeeToHourlyCommand(GetIdFrom(arguments), GetHourlyRateFrom(arguments)));
            }
            catch (ChangeEmployeeToHourlyCommandStructureException) { throw; }
            catch (Exception ex)
            {
                throw new ChangeEmployeeToHourlyCommandStructureException(ex);
            }
        }
コード例 #2
0
        public static RunPayrollCommand Parse(string command)
        {
            try
            {
                var arguments = CommandsArgumentsExtractor.ExtractFrom(command);

                if (!AreValid(arguments))
                {
                    throw new RunPayrollCommandStructureException();
                }

                return(new RunPayrollCommand(GetDateFrom(arguments)));
            }
            catch (RunPayrollCommandStructureException) { throw; }
            catch (Exception ex)
            {
                throw new RunPayrollCommandStructureException(ex);
            }
        }
コード例 #3
0
        public static DeleteEmployeeCommand Parse(string command)
        {
            try
            {
                var arguments = CommandsArgumentsExtractor.ExtractFrom(command);

                if (!AreValid(arguments))
                {
                    throw new DeleteEmployeeCommandStructureException();
                }

                return(new DeleteEmployeeCommand(GetIdFrom(arguments)));
            }
            catch (DeleteEmployeeCommandStructureException) { throw; }
            catch (Exception ex)
            {
                throw new DeleteEmployeeCommandStructureException(ex);
            }
        }
        public static PostServiceChargeCommand Parse(string command)
        {
            try
            {
                var arguments = CommandsArgumentsExtractor.ExtractFrom(command);

                if (!AreValid(arguments))
                {
                    throw new PostServiceChargeCommandStructureException();
                }

                return(new PostServiceChargeCommand(GetMemberIdFrom(arguments), GetAmountFrom(arguments)));
            }
            catch (PostServiceChargeCommandStructureException) { throw; }
            catch (Exception ex)
            {
                throw new PostServiceChargeCommandStructureException(ex);
            }
        }
コード例 #5
0
        public static AddEmployeeCommand Parse(string command)
        {
            try
            {
                var arguments = CommandsArgumentsExtractor.ExtractFrom(command);

                var employeeType = GetEmployeeTypeFrom(arguments);

                if (!AreValid(arguments, employeeType))
                {
                    throw new AddEmployeeCommandStructureException();
                }

                return(BuildFrom(arguments, employeeType));
            }
            catch (AddEmployeeCommandStructureException) { throw; }
            catch (Exception ex)
            {
                throw new AddEmployeeCommandStructureException(ex);
            }
        }
コード例 #6
0
        public static PostTimeCardCommand Parse(string command)
        {
            try
            {
                var arguments = CommandsArgumentsExtractor.ExtractFrom(command);

                if (!AreValid(arguments))
                {
                    throw new PostTimeCardCommandStructureException();
                }

                return(new PostTimeCardCommand(
                           GetEmployeeIdFrom(arguments),
                           GetDateFrom(arguments),
                           GetHoursFrom(arguments)));
            }
            catch (PostTimeCardCommandStructureException) { throw; }
            catch (Exception ex)
            {
                throw new PostTimeCardCommandStructureException(ex);
            }
        }
        public static ChangeEmployeePaymentTypeToDirectCommand Parse(string command)
        {
            try
            {
                var arguments = CommandsArgumentsExtractor.ExtractFrom(command);

                if (!AreValid(arguments))
                {
                    throw new ChangeEmployeePaymentTypeToDirectCommandStructureException();
                }

                return(new ChangeEmployeePaymentTypeToDirectCommand(
                           GetIdFrom(arguments),
                           GetBankFrom(arguments),
                           GetAccountFrom(arguments)));
            }
            catch (ChangeEmployeePaymentTypeToDirectCommandStructureException) { throw; }
            catch (Exception ex)
            {
                throw new ChangeEmployeePaymentTypeToDirectCommandStructureException(ex);
            }
        }