public async Task <PayRollPaySequenceView> MapToView(PayRollPaySequence inputObject) { Mapper mapper = new Mapper(); PayRollPaySequenceView outObject = mapper.Map <PayRollPaySequenceView>(inputObject); await Task.Yield(); return(outObject); }
public async Task TestAddUpdatDelete() { PayRollTotalsModule PayRollTotalsMod = new PayRollTotalsModule(); PayRollPaySequenceModule PayRollPaySequenceModule = new PayRollPaySequenceModule(); int payRollGroupCode = 1; PayRollTotalsView view = new PayRollTotalsView() { Employee = 1, EarningCode = 1, EarningType = "E", Amount = 3000, PayRollGroupCode = payRollGroupCode //public long PaySeqence { get; set; } //public DateTime PayRollBeginDate { get; set; } //public DateTime PayRollEndDate { get; set; } }; NextNumber nnNextNumber = await PayRollTotalsMod.PayRollTotals.Query().GetNextNumber(); view.PayRollTotalsNumber = nnNextNumber.NextNumberValue; PayRollPaySequenceView viewPaySequence = await PayRollPaySequenceModule.PayRollPaySequence.Query().GetCurrentPaySequenceByGroupCode(payRollGroupCode); if (viewPaySequence != null) { view.PaySeqence = viewPaySequence.PaySequence; view.PayRollBeginDate = viewPaySequence.PayRollBeginDate; view.PayRollEndDate = viewPaySequence.PayRollEndDate; } PayRollTotals payRollTotals = await PayRollTotalsMod.PayRollTotals.Query().MapToEntity(view); PayRollTotalsMod.PayRollTotals.AddPayRollTotals(payRollTotals).Apply(); PayRollTotals newPayRollTotals = await PayRollTotalsMod.PayRollTotals.Query().GetEntityByNumber(view.PayRollTotalsNumber); Assert.NotNull(newPayRollTotals); newPayRollTotals.Amount = 3000.01M; PayRollTotalsMod.PayRollTotals.UpdatePayRollTotals(newPayRollTotals).Apply(); PayRollTotalsView updateView = await PayRollTotalsMod.PayRollTotals.Query().GetViewById(newPayRollTotals.PayRollTotalsId); if (updateView.Amount != 3000.01M) { Assert.True(true); } PayRollTotalsMod.PayRollTotals.DeletePayRollTotals(newPayRollTotals).Apply(); PayRollTotals lookupPayRollTotals = await PayRollTotalsMod.PayRollTotals.Query().GetEntityById(view.PayRollTotalsId); Assert.Null(lookupPayRollTotals); }
public async Task TestAddUpdatDelete() { PayRollPaySequenceModule PayRollPaySequenceMod = new PayRollPaySequenceModule(); int payRollGroupCode = 1; PayRollPaySequenceView view = new PayRollPaySequenceView() { PayRollBeginDate = DateTime.Parse("9/9/2019") , PayRollEndDate = DateTime.Parse("9/13/2019") , PayRollGroupCode = payRollGroupCode , Frequency = "Bi-Weekly" }; long maxSequencenumber = PayRollPaySequenceMod.PayRollPaySequence.Query().GetMaxPaySequenceByGroupCode(payRollGroupCode); view.PaySequence = maxSequencenumber + 1; NextNumber nnNextNumber = await PayRollPaySequenceMod.PayRollPaySequence.Query().GetNextNumber(); view.PayRollPaySequenceNumber = nnNextNumber.NextNumberValue; PayRollPaySequence payRollPaySequence = await PayRollPaySequenceMod.PayRollPaySequence.Query().MapToEntity(view); PayRollPaySequenceMod.PayRollPaySequence.AddPayRollPaySequence(payRollPaySequence).Apply(); PayRollPaySequence newPayRollPaySequence = await PayRollPaySequenceMod.PayRollPaySequence.Query().GetEntityByNumber(view.PayRollPaySequenceNumber); Assert.NotNull(newPayRollPaySequence); newPayRollPaySequence.Frequency = "Bi-Week (update)"; PayRollPaySequenceMod.PayRollPaySequence.UpdatePayRollPaySequence(newPayRollPaySequence).Apply(); PayRollPaySequenceView updateView = await PayRollPaySequenceMod.PayRollPaySequence.Query().GetViewById(newPayRollPaySequence.PayRollPaySequenceId); Assert.Same(updateView.Frequency, "Bi-Week (update)"); PayRollPaySequenceMod.PayRollPaySequence.DeletePayRollPaySequence(newPayRollPaySequence).Apply(); PayRollPaySequence lookupPayRollPaySequence = await PayRollPaySequenceMod.PayRollPaySequence.Query().GetEntityById(view.PayRollPaySequenceId); Assert.Null(lookupPayRollPaySequence); }
public async Task TestGetByDateRangeandCode() { PayRollPaySequenceModule PayRollPaySequenceMod = new PayRollPaySequenceModule(); DateTime payRollBeginDate = DateTime.Parse("9/9/2000"); DateTime payRollEndDate = DateTime.Parse("9/13/2000"); int payRollGroupCode = 1; PayRollPaySequenceView view = new PayRollPaySequenceView() { PayRollBeginDate = payRollBeginDate , PayRollEndDate = payRollEndDate , PayRollGroupCode = payRollGroupCode , Frequency = "Bi-Weekly" }; long maxSequencenumber = PayRollPaySequenceMod.PayRollPaySequence.Query().GetMaxPaySequenceByGroupCode(payRollGroupCode); view.PaySequence = maxSequencenumber + 1; NextNumber nnNextNumber = await PayRollPaySequenceMod.PayRollPaySequence.Query().GetNextNumber(); view.PayRollPaySequenceNumber = nnNextNumber.NextNumberValue; PayRollPaySequence payRollPaySequence = await PayRollPaySequenceMod.PayRollPaySequence.Query().MapToEntity(view); PayRollPaySequenceMod.PayRollPaySequence.AddPayRollPaySequence(payRollPaySequence).Apply(); PayRollPaySequenceView viewTest = await PayRollPaySequenceMod.PayRollPaySequence.Query().GetByDateRangeAndCode( payRollBeginDate, payRollEndDate, payRollGroupCode); Assert.NotNull(viewTest); PayRollPaySequence newPayRollPaySequence = await PayRollPaySequenceMod.PayRollPaySequence.Query().GetEntityById(viewTest.PayRollPaySequenceId); PayRollPaySequenceMod.PayRollPaySequence.DeletePayRollPaySequence(newPayRollPaySequence).Apply(); PayRollPaySequence lookupPayRollPaySequence = await PayRollPaySequenceMod.PayRollPaySequence.Query().GetEntityById(view.PayRollPaySequenceId); }