示例#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);
        }
示例#3
0
        public async Task <IActionResult> DeletePayRollEarnings([FromBody] PayRollEarningsView view)
        {
            PayRollEarningsModule invMod          = new PayRollEarningsModule();
            PayRollEarnings       payRollEarnings = await invMod.PayRollEarnings.Query().MapToEntity(view);

            invMod.PayRollEarnings.DeletePayRollEarnings(payRollEarnings).Apply();

            return(Ok(view));
        }
        public async Task <IList <PayRollEarnings> > MapToEntity(IList <PayRollEarningsView> inputObjects)
        {
            IList <PayRollEarnings> list = new List <PayRollEarnings>();
            Mapper mapper = new Mapper();

            foreach (var item in inputObjects)
            {
                PayRollEarnings outObject = mapper.Map <PayRollEarnings>(item);
                list.Add(outObject);
            }
            await Task.Yield();

            return(list);
        }
示例#5
0
        public async Task <IActionResult> UpdatePayRollEarnings([FromBody] PayRollEarningsView view)
        {
            PayRollEarningsModule invMod = new PayRollEarningsModule();

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


            invMod.PayRollEarnings.UpdatePayRollEarnings(payRollEarnings).Apply();

            PayRollEarningsView retView = await invMod.PayRollEarnings.Query().GetViewById(payRollEarnings.PayRollEarningsId);


            return(Ok(retView));
        }
示例#6
0
        public async Task <IActionResult> AddPayRollEarnings([FromBody] PayRollEarningsView view)
        {
            PayRollEarningsModule invMod = new PayRollEarningsModule();

            NextNumber nnPayRollEarnings = await invMod.PayRollEarnings.Query().GetNextNumber();

            view.PayRollEarningsNumber = nnPayRollEarnings.NextNumberValue;

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

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

            PayRollEarningsView newView = await invMod.PayRollEarnings.Query().GetViewByNumber(view.PayRollEarningsNumber);


            return(Ok(newView));
        }
        public async Task <PayRollEarningsView> GetViewByNumber(long payRollEarningsNumber)
        {
            PayRollEarnings detailItem = await _unitOfWork.payRollEarningsRepository.GetEntityByNumber(payRollEarningsNumber);

            return(await MapToView(detailItem));
        }
示例#8
0
 public IFluentPayRollEarnings DeletePayRollEarnings(PayRollEarnings deleteObject)
 {
     unitOfWork.payRollEarningsRepository.DeleteObject(deleteObject);
     this.processStatus = CreateProcessStatus.Delete;
     return(this as IFluentPayRollEarnings);
 }
示例#9
0
 public IFluentPayRollEarnings AddPayRollEarnings(PayRollEarnings newObject)
 {
     unitOfWork.payRollEarningsRepository.AddObject(newObject);
     this.processStatus = CreateProcessStatus.Insert;
     return(this as IFluentPayRollEarnings);
 }