Exemple #1
0
        public async Task TestAddUpdatDelete()
        {
            PayRollEarningsModule PayRollEarningsMod = new PayRollEarningsModule();

            PayRollEarningsView view = new PayRollEarningsView()
            {
                EarningCode = 1,
                Description = "Earnings",
                EarningType = "E"
            };
            NextNumber nnNextNumber = await PayRollEarningsMod.PayRollEarnings.Query().GetNextNumber();

            view.PayRollEarningsNumber = nnNextNumber.NextNumberValue;

            PayRollEarnings payRollEarnings = await PayRollEarningsMod.PayRollEarnings.Query().MapToEntity(view);

            PayRollEarningsMod.PayRollEarnings.AddPayRollEarnings(payRollEarnings).Apply();

            PayRollEarnings newPayRollEarnings = await PayRollEarningsMod.PayRollEarnings.Query().GetEntityByNumber(view.PayRollEarningsNumber);

            Assert.NotNull(newPayRollEarnings);

            newPayRollEarnings.Description = "Earnings Update";

            PayRollEarningsMod.PayRollEarnings.UpdatePayRollEarnings(newPayRollEarnings).Apply();

            PayRollEarningsView updateView = await PayRollEarningsMod.PayRollEarnings.Query().GetViewById(newPayRollEarnings.PayRollEarningsId);

            Assert.Same(updateView.Description, "Earnings Update");
            PayRollEarningsMod.PayRollEarnings.DeletePayRollEarnings(newPayRollEarnings).Apply();
            PayRollEarnings lookupPayRollEarnings = await PayRollEarningsMod.PayRollEarnings.Query().GetEntityById(view.PayRollEarningsId);

            Assert.Null(lookupPayRollEarnings);
        }
        public async Task <PayRollEarningsView> MapToView(PayRollEarnings inputObject)
        {
            Mapper mapper = new Mapper();
            PayRollEarningsView outObject = mapper.Map <PayRollEarningsView>(inputObject);
            await Task.Yield();

            return(outObject);
        }
Exemple #3
0
        public async Task TestGetByEarningCode()
        {
            PayRollEarningsModule PayRollEarningsMod = new PayRollEarningsModule();

            int    earningCode       = 1;
            string earningType       = "E";
            PayRollEarningsView view = await PayRollEarningsMod.PayRollEarnings.Query().GetViewByEarningCode(earningCode, earningType);

            Assert.NotNull(view);
        }
        public async Task TestAddUpdatDelete()
        {
            long employee = 1;
            PayRollTransactionsByEmployeeModule PayRollTransactionsByEmployeeMod = new PayRollTransactionsByEmployeeModule();
            int    earningCode = 4;
            string earningType = "E";
            PayRollEarningsView viewEarnings = await PayRollTransactionsByEmployeeMod.PayRollEarnings.Query().GetViewByEarningCode(earningCode, earningType);


            PayRollTransactionsByEmployeeView view = new PayRollTransactionsByEmployeeView()
            {
                Employee = employee,
                PayRollTransactionCode = viewEarnings.EarningCode,
                Amount            = 3026M,
                TaxPercentOfGross = 0,
                AdditionalAmount  = 0,
                PayRollGroupCode  = 1,
                BenefitOption     = 1,
                PayRollType       = "Earnings",
                TransactionType   = viewEarnings.EarningType
            };

            NextNumber nnNextNumber = await PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.Query().GetNextNumber();

            view.PayRollTransactionsByEmployeeNumber = nnNextNumber.NextNumberValue;

            PayRollTransactionsByEmployee payRollTransactionsByEmployee = await PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.Query().MapToEntity(view);

            PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.AddPayRollTransactionsByEmployee(payRollTransactionsByEmployee).Apply();

            PayRollTransactionsByEmployee newPayRollTransactionsByEmployee = await PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.Query().GetEntityByNumber(view.PayRollTransactionsByEmployeeNumber);

            Assert.NotNull(newPayRollTransactionsByEmployee);

            newPayRollTransactionsByEmployee.Amount = 3026.23M;

            PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.UpdatePayRollTransactionsByEmployee(newPayRollTransactionsByEmployee).Apply();

            PayRollTransactionsByEmployeeView updateView = await PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.Query().GetViewById(newPayRollTransactionsByEmployee.PayRollTransactionsByEmployeeId);

            if (updateView.Amount != 3026.23M)
            {
                Assert.True(false);
            }


            PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.DeletePayRollTransactionsByEmployee(newPayRollTransactionsByEmployee).Apply();
            PayRollTransactionsByEmployee lookupPayRollTransactionsByEmployee = await PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.Query().GetEntityById(view.PayRollTransactionsByEmployeeId);

            Assert.Null(lookupPayRollTransactionsByEmployee);


            //Add liability

            int    deductionLiabilities     = 1;
            string deductionLiabilitiesType = "L";
            PayRollDeductionLiabilitiesView viewLiabilities = await PayRollTransactionsByEmployeeMod.PayRollDeductionLiabilities.Query().GetViewByDeductionLiabilitiesCode(deductionLiabilities, deductionLiabilitiesType);

            Assert.NotNull(viewLiabilities);

            EmployeeView viewEmployee = await PayRollTransactionsByEmployeeMod.Employee.Query().GetViewById(employee);

            PayRollTransactionsByEmployeeView view2 = new PayRollTransactionsByEmployeeView()
            {
                Employee = employee,
                PayRollTransactionCode = viewLiabilities.DeductionLiabilitiesCode,
                Amount            = viewLiabilities.Percentage ?? 0 * viewEmployee.SalaryPerPayPeriod,
                TaxPercentOfGross = 0,
                AdditionalAmount  = 0,
                PayRollGroupCode  = 1,
                BenefitOption     = 1,
                PayRollType       = "LIABILITIES",
                TransactionType   = viewLiabilities.DeductionLiabilitiesType
            };
            NextNumber nnNextNumber2 = await PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.Query().GetNextNumber();

            view2.PayRollTransactionsByEmployeeNumber = nnNextNumber2.NextNumberValue;

            PayRollTransactionsByEmployee payRollTransactionsByEmployee2 = await PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.Query().MapToEntity(view2);

            PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.AddPayRollTransactionsByEmployee(payRollTransactionsByEmployee2).Apply();

            PayRollTransactionsByEmployee newPayRollTransactionsByEmployee2 = await PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.Query().GetEntityByNumber(view2.PayRollTransactionsByEmployeeNumber);

            PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.DeletePayRollTransactionsByEmployee(newPayRollTransactionsByEmployee2).Apply();
            PayRollTransactionsByEmployee lookupPayRollTransactionsByEmployee2 = await PayRollTransactionsByEmployeeMod.PayRollTransactionsByEmployee.Query().GetEntityById(view2.PayRollTransactionsByEmployeeId);

            Assert.Null(lookupPayRollTransactionsByEmployee);
        }