private BudgetRange MapToEntity(BudgetRangeView inputObject) { Mapper mapper = new Mapper(); BudgetRange outObject = mapper.Map <BudgetRange>(inputObject); return(outObject); }
public async Task <IActionResult> DeleteBudgetRange([FromBody] BudgetRangeView view) { BudgetRangeModule invMod = new BudgetRangeModule(); BudgetRange budgetRange = await invMod.BudgetRange.Query().MapToEntity(view); invMod.BudgetRange.DeleteBudgetRange(budgetRange).Apply(); return(Ok(view)); }
public async Task TestAddUpdatDelete() { BudgetModule BudgetMod = new BudgetModule(); ChartOfAccount chartOfAccount = await BudgetMod.ChartOfAccount.Query().GetEntityById(42); BudgetRange budgetRange = await BudgetMod.BudgetRange.Query().GetEntityById(1); BudgetView view = new BudgetView() { BudgetAmount = 5216M, ActualHours = 0M, ActualAmount = 768M, AccountId = chartOfAccount.AccountId, RangeId = budgetRange.RangeId, ProjectedAmount = 9600, ProjectedHours = 0, ActualsAsOfDate = DateTime.Parse("12/9/2019"), AccountDescription = chartOfAccount.Description, CompanyCode = chartOfAccount.CompanyCode, BusUnit = chartOfAccount.BusUnit, ObjectNumber = chartOfAccount.ObjectNumber, Subsidiary = chartOfAccount.Subsidiary, RangeIsActive = budgetRange.IsActive, RangeStartDate = budgetRange.StartDate, RangeEndDate = budgetRange.EndDate, SupervisorCode = budgetRange.SupervisorCode }; NextNumber nnNextNumber = await BudgetMod.Budget.Query().GetNextNumber(); view.BudgetNumber = nnNextNumber.NextNumberValue; Budget budget = await BudgetMod.Budget.Query().MapToEntity(view); BudgetMod.Budget.AddBudget(budget).Apply(); Budget newBudget = await BudgetMod.Budget.Query().GetEntityByNumber(view.BudgetNumber); Assert.NotNull(newBudget); newBudget.BudgetAmount = 100M; BudgetMod.Budget.UpdateBudget(newBudget).Apply(); BudgetView updateView = await BudgetMod.Budget.Query().GetViewById(newBudget.BudgetId); if (updateView.BudgetAmount == 100M) { Assert.True(true); } BudgetMod.Budget.DeleteBudget(newBudget).Apply(); Budget lookupBudget = await BudgetMod.Budget.Query().GetEntityById(view.BudgetId); Assert.Null(lookupBudget); }
public async Task TestAddUpdatDelete() { BudgetRangeModule BudgetRangeMod = new BudgetRangeModule(); ChartOfAccount chartOfAccount = await BudgetRangeMod.ChartOfAccount.Query().GetEntityById(42); Company company = await BudgetRangeMod.Company.Query().GetEntityById(1); BudgetRangeView view = new BudgetRangeView() { StartDate = DateTime.Parse("1/1/2019"), EndDate = DateTime.Parse("12/31/2019"), Location = chartOfAccount.Location, GenCode = chartOfAccount.GenCode, CompanyCode = company.CompanyCode, BusUnit = chartOfAccount.BusUnit, Subsidiary = chartOfAccount.Subsidiary, AccountId = chartOfAccount.AccountId, ObjectNumber = chartOfAccount.ObjectNumber, SupervisorCode = "4366", LastUpdated = DateTime.Parse("12/8/2019"), IsActive = true, PayCycles = 12, AccountDescription = chartOfAccount.Description }; NextNumber nnNextNumber = await BudgetRangeMod.BudgetRange.Query().GetNextNumber(); view.BudgetRangeNumber = nnNextNumber.NextNumberValue; BudgetRange budgetRange = await BudgetRangeMod.BudgetRange.Query().MapToEntity(view); BudgetRangeMod.BudgetRange.AddBudgetRange(budgetRange).Apply(); BudgetRange newBudgetRange = await BudgetRangeMod.BudgetRange.Query().GetEntityByNumber(view.BudgetRangeNumber); Assert.NotNull(newBudgetRange); newBudgetRange.IsActive = false; BudgetRangeMod.BudgetRange.UpdateBudgetRange(newBudgetRange).Apply(); BudgetRangeView updateView = await BudgetRangeMod.BudgetRange.Query().GetViewById(newBudgetRange.RangeId); if (updateView.IsActive == false) { Assert.True(true); } BudgetRangeMod.BudgetRange.DeleteBudgetRange(newBudgetRange).Apply(); BudgetRange lookupBudgetRange = await BudgetRangeMod.BudgetRange.Query().GetEntityById(view.RangeId); Assert.Null(lookupBudgetRange); }
public async Task <IActionResult> UpdateBudgetRange([FromBody] BudgetRangeView view) { BudgetRangeModule invMod = new BudgetRangeModule(); BudgetRange budgetRange = await invMod.BudgetRange.Query().MapToEntity(view); invMod.BudgetRange.UpdateBudgetRange(budgetRange).Apply(); BudgetRangeView retView = await invMod.BudgetRange.Query().GetViewById(budgetRange.RangeId); return(Ok(retView)); }
public BudgetRangeView(BudgetRange budgetRange) { this.RangeId = budgetRange.RangeId; this.StartDate = budgetRange.StartDate; this.EndDate = budgetRange.EndDate; this.Location = budgetRange.Location; this.GenCode = budgetRange.GenCode; this.SubCode = budgetRange.SubCode; this.CompanyCode = budgetRange.CompanyCode; this.BusinessUnit = budgetRange.BusinessUnit; this.ObjectNumber = budgetRange.ObjectNumber; this.Subsidiary = budgetRange.Subsidiary; this.AccountId = budgetRange.AccountId; this.SupervisorCode = budgetRange.SupervisorCode; }
public async Task <IActionResult> AddBudgetRange([FromBody] BudgetRangeView view) { BudgetRangeModule invMod = new BudgetRangeModule(); NextNumber nnBudgetRange = await invMod.BudgetRange.Query().GetNextNumber(); view.BudgetRangeNumber = nnBudgetRange.NextNumberValue; BudgetRange budgetRange = await invMod.BudgetRange.Query().MapToEntity(view); invMod.BudgetRange.AddBudgetRange(budgetRange).Apply(); BudgetRangeView newView = await invMod.BudgetRange.Query().GetViewByNumber(view.BudgetRangeNumber); return(Ok(newView)); }
public IFluentBudgetRange AddBudgetRange(BudgetRange newObject) { unitOfWork.budgetRangeRepository.AddObject(newObject); this.processStatus = CreateProcessStatus.Insert; return(this as IFluentBudgetRange); }
public IFluentBudgetRange DeleteBudgetRange(BudgetRange deleteObject) { unitOfWork.budgetRangeRepository.DeleteObject(deleteObject); this.processStatus = CreateProcessStatus.Delete; return(this as IFluentBudgetRange); }