Example #1
0
        public async Task <PayRollCurrentPaySequenceView> MapToView(PayRollCurrentPaySequence inputObject)
        {
            Mapper mapper = new Mapper();
            PayRollCurrentPaySequenceView outObject = mapper.Map <PayRollCurrentPaySequenceView>(inputObject);
            await Task.Yield();

            return(outObject);
        }
Example #2
0
        public async Task TestTransactionsByEmployee()
        {
            PayRollLedgerModule PayRollLedgerMod = new PayRollLedgerModule();

            int  payRollGroupCode = 1;
            long employee         = 1;

            PayRollCurrentPaySequenceView payCurrentSequenceView = await PayRollLedgerMod.PayRollCurrentPaySequence.Query().GetViewByPayRollCode(payRollGroupCode);

            List <PayRollTransactionsByEmployeeView> listTransactionsViews = await PayRollLedgerMod.PayRollTransactionsByEmployee.Query().GetTransactionsByEmployeeViews(employee);

            List <PayRollLedger> listNewLedgers = new List <PayRollLedger>();

            foreach (var item in listTransactionsViews)
            {
                NextNumber nnNextNumber = await PayRollLedgerMod.PayRollLedger.Query().GetNextNumber();

                listNewLedgers.Add(new PayRollLedger

                {
                    EmployeeId             = item.Employee,
                    PayRollTransactionCode = item.PayRollTransactionCode,
                    Amount              = item.Amount,
                    PaidDate            = payCurrentSequenceView.PayRollBeginDate,//DateTime.Now,
                    PayPeriodBegin      = payCurrentSequenceView.PayRollBeginDate,
                    PayPeriodEnd        = payCurrentSequenceView.PayRollEndDate,
                    PaySequence         = payCurrentSequenceView.PaySequence,
                    PayRollType         = item.PayRollType,
                    PayRollGroupCode    = item.PayRollGroupCode ?? 0,
                    ReversingEntry      = "N",
                    UpdateEntry         = "N",
                    TransactionType     = item.TransactionType,
                    PayRollLedgerNumber = nnNextNumber.NextNumberValue
                });
            }
            PayRollLedgerMod.PayRollLedger.AddPayRollLedgers(listNewLedgers).Apply();


            List <PayRollLedger> list = (await PayRollLedgerMod.PayRollLedger.Query().GetEntitiesByPaySequence(employee, payCurrentSequenceView.PaySequence)).ToList <PayRollLedger>();

            list.ForEach(e => e.Amount += 10M);
            decimal total = 0M;

            list.ForEach(e => total += e.Amount);

            PayRollLedgerMod.PayRollLedger.UpdatePayRollLedgers(list).Apply();

            List <PayRollLedger> listUpdate = (await PayRollLedgerMod.PayRollLedger.Query().GetEntitiesByPaySequence(employee, payCurrentSequenceView.PaySequence)).ToList <PayRollLedger>();
            decimal totalUpdate             = 0M;

            listUpdate.ForEach(e => totalUpdate += e.Amount);
            if (total != totalUpdate)
            {
                Assert.True(false);
            }

            PayRollLedgerMod.PayRollLedger.DeletePayRollLedgers(listUpdate).Apply();
        }
Example #3
0
        public async Task TestAddUpdatDelete()
        {
            PayRollCurrentPaySequenceModule PayRollCurrentPaySequenceMod = new PayRollCurrentPaySequenceModule();

            PayRollCurrentPaySequenceView view = new PayRollCurrentPaySequenceView()
            {
                PaySequence = 0,
                PayRollCurrentPaySequenceNumber = 0,
                PayRollCode      = 1,
                PayRollBeginDate = DateTime.Parse("10/7/2019"),
                PayRollEndDate   = DateTime.Parse("10/11/2019"),
                Frequency        = "Bi-Weekly",
                Active           = false
            };
            NextNumber nnNextNumber = await PayRollCurrentPaySequenceMod.PayRollCurrentPaySequence.Query().GetNextNumber();

            view.PayRollCurrentPaySequenceNumber = nnNextNumber.NextNumberValue;

            PayRollCurrentPaySequence payRollCurrentPaySequence = await PayRollCurrentPaySequenceMod.PayRollCurrentPaySequence.Query().MapToEntity(view);

            PayRollCurrentPaySequenceMod.PayRollCurrentPaySequence.AddPayRollCurrentPaySequence(payRollCurrentPaySequence).Apply();

            PayRollCurrentPaySequence newPayRollCurrentPaySequence = await PayRollCurrentPaySequenceMod.PayRollCurrentPaySequence.Query().GetEntityByNumber(view.PayRollCurrentPaySequenceNumber);

            Assert.NotNull(newPayRollCurrentPaySequence);

            newPayRollCurrentPaySequence.Frequency = "Bi-Weekly Update";

            PayRollCurrentPaySequenceMod.PayRollCurrentPaySequence.UpdatePayRollCurrentPaySequence(newPayRollCurrentPaySequence).Apply();

            PayRollCurrentPaySequenceView updateView = await PayRollCurrentPaySequenceMod.PayRollCurrentPaySequence.Query().GetViewById(newPayRollCurrentPaySequence.PayRollCurrentPaySequenceId);

            Assert.Same(updateView.Frequency, "Bi-Weekly Update");
            PayRollCurrentPaySequenceMod.PayRollCurrentPaySequence.DeletePayRollCurrentPaySequence(newPayRollCurrentPaySequence).Apply();
            PayRollCurrentPaySequence lookupPayRollCurrentPaySequence = await PayRollCurrentPaySequenceMod.PayRollCurrentPaySequence.Query().GetEntityById(view.PayRollCurrentPaySequenceId);

            Assert.Null(lookupPayRollCurrentPaySequence);
        }