public BudgetActualsView GetBudgetActualsView(BudgetRangeView budgetRangeView) { Task <BudgetActualsView> budgetActualsViewTask = Task.Run(async() => await _unitOfWork.budgetRepository.GetActualsView(budgetRangeView)); Task.WaitAll(budgetActualsViewTask); return(budgetActualsViewTask.Result); }
public async Task <BudgetActualsView> GetActualsView(BudgetRangeView budgetRangeView, string actualsKeyCode, string hoursKeyCode) { try { // Udc udcActuals = await GetUdc("GENERALLEDGERTYPE", "AA"); //Udc udcHours = await GetUdc("GENERALLEDGERTYPE", "HA"); BudgetActualsView budgetActualsView = applicationViewFactory.MapBudgetRangeToBudgetActuals(budgetRangeView); //query actual amounts decimal actualAmount = await(from e in _dbContext.GeneralLedger where e.AccountId == budgetRangeView.AccountId && e.Gldate >= budgetRangeView.StartDate && e.Gldate <= budgetRangeView.EndDate && e.LedgerType == actualsKeyCode select e.Amount ).SumAsync(); budgetActualsView.ActualAmount = actualAmount; //query actual hours decimal?actualHours = await(from e in _dbContext.GeneralLedger where e.AccountId == budgetRangeView.AccountId && e.Gldate >= budgetRangeView.StartDate && e.Gldate <= budgetRangeView.EndDate && e.LedgerType == hoursKeyCode select e.Units ).SumAsync(); budgetActualsView.ActualHours = actualHours ?? 0; return(budgetActualsView); } catch (Exception ex) { throw new Exception(GetMyMethodName(), ex); } }
public async Task <IActionResult> GetBudgetRangeView(long budgetRangeId) { BudgetRangeModule invMod = new BudgetRangeModule(); BudgetRangeView view = await invMod.BudgetRange.Query().GetViewById(budgetRangeId); return(Ok(view)); }
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 <BudgetActualsView> GetBudgetActualsView(BudgetRangeView budgetRangeView) { Udc udcActuals = await _unitOfWork.udcRepository.GetUdc("GENERALLEDGERTYPE", "AA"); Udc udcHours = await _unitOfWork.udcRepository.GetUdc("GENERALLEDGERTYPE", "HA"); BudgetActualsView budgetActualsView = await _unitOfWork.budgetRepository.GetActualsView(budgetRangeView, udcActuals.KeyCode, udcHours.KeyCode); return(budgetActualsView); }
public IBudgetRange CreateBudgetRange(BudgetRangeView budgetRange) { try { Task <CreateProcessStatus> resultStatus = Task.Run(async() => await unitOfWork.budgetRangeRepository.CreateBudgetRange(budgetRange)); Task.WaitAll(resultStatus); processStatus = resultStatus.Result; return(this as IBudgetRange); } catch (Exception ex) { throw new Exception(GetMyMethodName(), ex); } }
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 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 async Task TestCreateBudget() { BudgetModule budgetMod = new BudgetModule(); BudgetRangeView budgetRangeView = new BudgetRangeView(); //personal mortgage ChartOfAccount coa = await budgetMod.ChartOfAccount.Query().GetEntity("1000", "1200", "502", "01"); budgetRangeView.StartDate = DateTime.Parse("1/1/2018");; budgetRangeView.EndDate = DateTime.Parse("12/31/2018");; budgetRangeView.Location = coa.Location; budgetRangeView.GenCode = coa.GenCode; budgetRangeView.SubCode = coa.SubCode; budgetRangeView.CompanyCode = coa.Company.CompanyCode; budgetRangeView.BusUnit = coa.BusUnit; budgetRangeView.ObjectNumber = coa.ObjectNumber; budgetRangeView.Subsidiary = coa.Subsidiary; budgetRangeView.AccountId = coa.AccountId; budgetRangeView.SupervisorCode = coa.SupCode; BudgetView budgetView = new BudgetView(); budgetMod.BudgetRange.CreateBudgetRange(budgetRangeView).Apply(); BudgetRangeView budgetRangeLookupView = await budgetMod.BudgetRange.Query().GetBudgetRange(budgetRangeView.AccountId, budgetRangeView.StartDate, budgetRangeView.EndDate); budgetMod.Budget.MapRangeToBudgetView(ref budgetView, budgetRangeLookupView); BudgetActualsView budgetActualsView = await budgetMod.Budget.Query().GetBudgetActualsView(budgetRangeLookupView); budgetView.BudgetAmount = 768 * 12; budgetView.BudgetHours = 0; budgetView.ProjectedAmount = 800 * 12; budgetView.ProjectedHours = 0; budgetView.ActualAmount = budgetActualsView.ActualAmount; budgetView.ActualHours = budgetActualsView.ActualHours; budgetMod.Budget.TransactBudget(budgetView).Apply(); Assert.True(true); }
public IFluentBudget MapRangeToBudgetView(ref BudgetView budgetView, BudgetRangeView budgetRangeView) { applicationViewFactory.MapRangeToBudgetViewEntity(ref budgetView, budgetRangeView); return(this as IFluentBudget); }
public abstract BudgetActualsView MapBudgetRangeToBudgetActuals(BudgetRangeView budgetRangeView);
public abstract void MapRangeToBudgetViewEntity(ref BudgetView budgetView, BudgetRangeView budgetRangeView);
public IBudget MapRangeToBudgetView(ref BudgetView budgetView, BudgetRangeView budgetRangeView) { unitOfWork.budgetRepository.MapRangeToBudgetView(ref budgetView, budgetRangeView); return(this as IBudget); }