示例#1
0
        public void TestSalesReceiptTransaction()
        {
            int empId = 5;
            AddCommissionedEmployee t =
                new AddCommissionedEmployee(
                    empId, "Bill", "Home", 2000, 15.25, database);

            t.Execute();
            SalesReceiptTransaction tct =
                new SalesReceiptTransaction(
                    new DateTime(2005, 7, 31), 250.00, empId, database);

            tct.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is CommissionClassification);
            CommissionClassification cc = pc as CommissionClassification;

            SalesReceipt sr = cc.GetSalesReceipt(new DateTime(2005, 7, 31));

            Assert.IsNotNull(sr);
            Assert.AreEqual(250.00, sr.SaleAmount, .001);
        }
示例#2
0
 private void button1_Click(object sender, EventArgs e)
 {
     int id = int.Parse(textid.Text);
     double saleAmount = double.Parse(textsaleAmount.Text);
     DateTime time = Convert.ToDateTime(textdate.Text);
     PayrollDatabase pd = new sytpayrolldatabase();
     SalesReceiptTransaction emp = new SalesReceiptTransaction(time, saleAmount, id, pd);
     emp.Execute();
 }
示例#3
0
        public void PaySingleCommissionedEmployeeOneReceipt()
        {
            int empId = 2;
            AddCommissionedEmployee t = new AddCommissionedEmployee(
                empId, "Bill", "Home", 1500, 10, database);

            t.Execute();
            DateTime payDate = new DateTime(2001, 11, 16);             // Payday

            SalesReceiptTransaction sr =
                new SalesReceiptTransaction(payDate, 5000.00, empId, database);

            sr.Execute();
            PaydayTransaction pt = new PaydayTransaction(payDate, database);

            pt.Execute();
            ValidatePaycheck(pt, empId, payDate, 2000.00);
        }
示例#4
0
        public void PaySingleCommissionedEmployeeOnWrongDate()
        {
            int empId = 2;
            AddCommissionedEmployee t = new AddCommissionedEmployee(
                empId, "Bill", "Home", 1500, 10, database);

            t.Execute();
            DateTime payDate = new DateTime(2001, 11, 9);             // wrong friday

            SalesReceiptTransaction sr =
                new SalesReceiptTransaction(payDate, 5000.00, empId, database);

            sr.Execute();
            PaydayTransaction pt = new PaydayTransaction(payDate, database);

            pt.Execute();

            Paycheck pc = pt.GetPaycheck(empId);

            Assert.IsNull(pc);
        }
示例#5
0
        TestPaySingleCommissionedEmployeeWithReceiptsSpanningTwoPayPeriods()
        {
            int empId = 2;
            AddCommissionedEmployee t = new AddCommissionedEmployee(
                empId, "Bill", "Home", 1500, 10, database);

            t.Execute();
            DateTime payDate = new DateTime(2001, 11, 16);             // Payday

            SalesReceiptTransaction sr =
                new SalesReceiptTransaction(payDate, 5000.00, empId, database);

            sr.Execute();
            SalesReceiptTransaction sr2 = new SalesReceiptTransaction(
                payDate.AddDays(-15), 3500.00, empId, database);

            sr2.Execute();
            PaydayTransaction pt = new PaydayTransaction(payDate, database);

            pt.Execute();
            ValidatePaycheck(pt, empId, payDate, 2000.00);
        }
示例#6
0
        public void PaySingleCommissionedEmployeeTwoReceipts()
        {
            var empId = 2;
            var t     = new AddCommissionedEmployee(
                empId, "Bill", "Home", 1500, 10, database);

            t.Execute();
            var payDate = new DateTime(2001, 11, 16); // Payday

            var sr =
                new SalesReceiptTransaction(payDate, 5000.00, empId, database);

            sr.Execute();
            var sr2 = new SalesReceiptTransaction(
                payDate.AddDays(-1), 3500.00, empId, database);

            sr2.Execute();
            var pt = new PaydayTransaction(payDate, database);

            pt.Execute();
            ValidatePaycheck(pt, empId, payDate, 2350.00);
        }