コード例 #1
0
        public async Task <PayRollTransactionsByEmployeeView> MapToView(PayRollTransactionsByEmployee inputObject)
        {
            Mapper mapper = new Mapper();
            PayRollTransactionsByEmployeeView outObject = mapper.Map <PayRollTransactionsByEmployeeView>(inputObject);
            await Task.Yield();

            return(outObject);
        }
コード例 #2
0
        public async Task <IActionResult> DeletePayRollTransactionsByEmployee([FromBody] PayRollTransactionsByEmployeeView view)
        {
            PayRollTransactionsByEmployeeModule invMod = new PayRollTransactionsByEmployeeModule();
            PayRollTransactionsByEmployee       payRollTransactionsByEmployee = await invMod.PayRollTransactionsByEmployee.Query().MapToEntity(view);

            invMod.PayRollTransactionsByEmployee.DeletePayRollTransactionsByEmployee(payRollTransactionsByEmployee).Apply();

            return(Ok(view));
        }
コード例 #3
0
        public async Task <IList <PayRollTransactionsByEmployee> > MapToEntity(IList <PayRollTransactionsByEmployeeView> inputObjects)
        {
            IList <PayRollTransactionsByEmployee> list = new List <PayRollTransactionsByEmployee>();
            Mapper mapper = new Mapper();

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

            return(list);
        }
コード例 #4
0
        public async Task <IActionResult> AddPayRollTransactionsByEmployee([FromBody] PayRollTransactionsByEmployeeView view)
        {
            PayRollTransactionsByEmployeeModule invMod = new PayRollTransactionsByEmployeeModule();

            NextNumber nnPayRollTransactionsByEmployee = await invMod.PayRollTransactionsByEmployee.Query().GetNextNumber();

            view.PayRollTransactionsByEmployeeNumber = nnPayRollTransactionsByEmployee.NextNumberValue;

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

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

            PayRollTransactionsByEmployeeView newView = await invMod.PayRollTransactionsByEmployee.Query().GetViewByNumber(view.PayRollTransactionsByEmployeeNumber);


            return(Ok(newView));
        }
コード例 #5
0
 public IFluentPayRollTransactionsByEmployee DeletePayRollTransactionsByEmployee(PayRollTransactionsByEmployee deleteObject)
 {
     unitOfWork.payRollTransactionsByEmployeeRepository.DeleteObject(deleteObject);
     this.processStatus = CreateProcessStatus.Delete;
     return(this as IFluentPayRollTransactionsByEmployee);
 }
コード例 #6
0
 public IFluentPayRollTransactionsByEmployee AddPayRollTransactionsByEmployee(PayRollTransactionsByEmployee newObject)
 {
     unitOfWork.payRollTransactionsByEmployeeRepository.AddObject(newObject);
     this.processStatus = CreateProcessStatus.Insert;
     return(this as IFluentPayRollTransactionsByEmployee);
 }
コード例 #7
0
        public async Task <PayRollTransactionsByEmployeeView> GetViewByNumber(long payRollTransactionsByEmployeeNumber)
        {
            PayRollTransactionsByEmployee detailItem = await _unitOfWork.payRollTransactionsByEmployeeRepository.GetEntityByNumber(payRollTransactionsByEmployeeNumber);

            return(await MapToView(detailItem));
        }
コード例 #8
0
        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);
        }