コード例 #1
0
        static void Main(string[] args)
        {
            List <TimeSheetEntryModels> timeSheetEntries = GetTimeSheetEntries();

            List <CustomerModel> customers = CustomerLibrary.GetCustomers();

            foreach (var customer in customers)
            {
                var customerTime = TimeSheetProcessor.CalculateTimeForCustomer(timeSheetEntries, customer.Name);
                SimulateSendingMail(customer, customerTime);
            }

            List <PaymentModel> payments = PaymentLibrary.GetPayments();



            var timeWorked = TimeSheetProcessor.CalculateTimeWorked(timeSheetEntries);

            foreach (var paymentModel in payments)
            {
                if (timeWorked > paymentModel.HourLimit)
                {
                    SimulatePayment(paymentModel, timeWorked);
                    break;
                }
            }

            Console.WriteLine();
            Console.Write("Press any key to exit application...");
            Console.ReadKey();
        }
コード例 #2
0
        private static void PayEmployee(List <TimeSheetEntryModel> timeSheets, EmployeeModel employee)
        {
            decimal totalPay = TimeSheetProcessor.CalculateEmployeePay(timeSheets, employee);

            Console.WriteLine($"You will get paid ${ totalPay } for your time.");
            Console.WriteLine();
        }
コード例 #3
0
        private static void BillCustomer(List <TimeSheetEntryModel> timeSheets, CustomerModel customer)
        {
            double totalHours = TimeSheetProcessor.CalcuateHoursWorked(timeSheets, customer.CompanyName);

            Console.WriteLine($"Simulating Sending email to {customer.CompanyName}");
            Console.WriteLine("Your bill is $" + (decimal)totalHours * customer.HourlyRate + " for the hours worked.");
            Console.WriteLine();
        }
コード例 #4
0
ファイル: After.cs プロジェクト: tatarakesh/PRT453-Gourp-H
        /// <summary>
        /// This method calculating the customer's bill
        /// </summary>
        /// <param name="timeSheets"></param>
        /// <param name="customer"></param>
        private static void BillCustomers(List <TimeSheetEntryAModel> timeSheets, CustomerModel customer)
        {
            double totalHours = TimeSheetProcessor.GetHoursWorkForComapany(timeSheets, customer.CustomerName);

            Console.WriteLine($"Simulating sending mail to :{customer.CustomerName}");
            Console.WriteLine("Your bill is &" + (decimal)totalHours * customer.hourlyRateToBill + "for the hours worked.");
            Console.WriteLine();
        }
コード例 #5
0
        //private static void DisplayEmployeePay(List<TimeSheetEntryModel> timeSheets, EmployeeModel employee)
        //{
        //    decimal totalAmountToPay = TimeSheetProcessor.CalculateEmployeePay(timeSheets, employee);
        //    Console.WriteLine($"You will get paid $ {totalAmountToPay} for your time.");
        //}

        private static void DisplayEmployeePay(List <TimeSheetEntryModel> timeSheets, List <EmployeeModel> employees)
        {
            decimal totalAmountToPay = TimeSheetProcessor.CalculateTotalEmployeePay(timeSheets, employees);

            //List<decimal> salaries = TimeSheetProcessor.CalculateEachEmployeePay(timeSheets, employees);

            Console.WriteLine($"In total you will get paid $ {totalAmountToPay} for your time.");
            Console.WriteLine();

            foreach (EmployeeModel person in employees)
            {
                Console.WriteLine($"{person.FirstName} {person.LastName} will get paid $ {person.Salary} for their work.");

                //foreach (var eachEmployeePay in salaries)
                //{
                //    Console.WriteLine($"{person.FirstName} {person.LastName} will get paid $ {eachEmployeePay} for their work.");
                //}
            }
        }
コード例 #6
0
        static void Main(string[] args)
        {
            string workDone;
            int    hourDone;
            int    timeTotal;

            List <TimeSheetEntryModel> timeSheetEntries = new List <TimeSheetEntryModel>();
            List <CustomerModel>       customer         = new List <CustomerModel>
            {
                new CustomerModel {
                    Name = "Acme", HourlyRate = 150
                },
                new CustomerModel {
                    Name = "ABC", HourlyRate = 125
                }
            };


            bool continueEntering;

            do
            {
                Console.Write("Enter what you did: ");
                workDone = Console.ReadLine();

                Console.Write("How long did you do it for(in hours): ");
                hourDone = int.Parse(Console.ReadLine());

                TimeSheetEntryModel entry = new TimeSheetEntryModel
                {
                    HoursWorked = hourDone,
                    WorkDone    = workDone
                };
                timeSheetEntries.Add(entry);

                Console.Write("Do you want to enter more time:");
                continueEntering = Console.ReadLine().ToLower() == "yes";
                //continueEntering = Console.ReadLine().Equals("yes", StringComparison.OrdinalIgnoreCase);
            }while (continueEntering == true);



            timeTotal = TimeSheetProcessor.CalculateTimeForCustomer(timeSheetEntries, "Acme");
            Console.WriteLine("Simulating Sending email to Acme");
            Console.WriteLine("Your bill is $" + timeTotal * 150 + " for the hours worked.");

            timeTotal = TimeSheetProcessor.CalculateTimeForCustomer(timeSheetEntries, "ABC");
            Console.WriteLine("Simulating Sending email to ABC");
            Console.WriteLine("Your bill is $" + timeTotal * 125 + " for the hours worked.");
            for (int i = 0; i < timeSheetEntries.Count; i++)
            {
                timeTotal += timeSheetEntries[i].HoursWorked;
            }
            if (timeTotal > 40)
            {
                Console.WriteLine("You will get paid $" + timeTotal * 15 + " for your work.");
            }
            else
            {
                Console.WriteLine("You will get paid $" + timeTotal * 10 + " for your time.");
            }
            Console.WriteLine();
            Console.Write("Press any key to exit application...");
            Console.ReadKey();
        }