public async Task <IActionResult> DeleteJobCostLedger([FromBody] JobCostLedgerView view) { JobCostLedgerModule invMod = new JobCostLedgerModule(); JobCostLedger jobCostLedger = await invMod.JobCostLedger.Query().MapToEntity(view); invMod.JobCostLedger.DeleteJobCostLedger(jobCostLedger).Apply(); return(Ok(view)); }
public async Task TestAddUpdatDelete() { JobCostLedgerModule JobCostLedgerMod = new JobCostLedgerModule(); Contract contract = await JobCostLedgerMod.Contract.Query().GetEntityById(6); JobMaster jobMaster = await JobCostLedgerMod.JobMaster.Query().GetEntityById(40); JobPhase jobPhase = await JobCostLedgerMod.JobPhase.Query().GetEntityById(180); JobCostType jobCostType = await JobCostLedgerMod.JobCostType.Query().GetEntityById(2); JobCostLedgerView view = new JobCostLedgerView() { JobMasterId = jobMaster.JobMasterId, ContractId = contract.ContractId, EstimatedHours = 0, EstimatedAmount = 0, JobPhaseId = jobPhase.JobPhaseId, ActualHours = 0, ActualCost = 0, ProjectedHours = 0, CommittedHours = 0, CommittedAmount = 100M, Description = "JC Ledger Detail", TransactionType = "PO", Source = "Job Costing", JobCostTypeId = jobCostType.JobCostTypeId }; NextNumber nnNextNumber = await JobCostLedgerMod.JobCostLedger.Query().GetNextNumber(); view.JobCostLedgerNumber = nnNextNumber.NextNumberValue; JobCostLedger jobCostLedger = await JobCostLedgerMod.JobCostLedger.Query().MapToEntity(view); JobCostLedgerMod.JobCostLedger.AddJobCostLedger(jobCostLedger).Apply(); JobCostLedger newJobCostLedger = await JobCostLedgerMod.JobCostLedger.Query().GetEntityByNumber(view.JobCostLedgerNumber); Assert.NotNull(newJobCostLedger); newJobCostLedger.Description = "JobCostLedger Test Update"; JobCostLedgerMod.JobCostLedger.UpdateJobCostLedger(newJobCostLedger).Apply(); JobCostLedgerView updateView = await JobCostLedgerMod.JobCostLedger.Query().GetViewById(newJobCostLedger.JobCostLedgerId); Assert.Same(updateView.Description, "JobCostLedger Test Update"); JobCostLedgerMod.JobCostLedger.DeleteJobCostLedger(newJobCostLedger).Apply(); JobCostLedger lookupJobCostLedger = await JobCostLedgerMod.JobCostLedger.Query().GetEntityById(view.JobCostLedgerId); Assert.Null(lookupJobCostLedger); }
public async Task <IActionResult> UpdateJobCostLedger([FromBody] JobCostLedgerView view) { JobCostLedgerModule invMod = new JobCostLedgerModule(); JobCostLedger jobCostLedger = await invMod.JobCostLedger.Query().MapToEntity(view); invMod.JobCostLedger.UpdateJobCostLedger(jobCostLedger).Apply(); JobCostLedgerView retView = await invMod.JobCostLedger.Query().GetViewById(jobCostLedger.JobCostLedgerId); return(Ok(retView)); }
public async Task <IActionResult> AddJobCostLedger([FromBody] JobCostLedgerView view) { JobCostLedgerModule invMod = new JobCostLedgerModule(); NextNumber nnJobCostLedger = await invMod.JobCostLedger.Query().GetNextNumber(); view.JobCostLedgerNumber = nnJobCostLedger.NextNumberValue; JobCostLedger jobCostLedger = await invMod.JobCostLedger.Query().MapToEntity(view); invMod.JobCostLedger.AddJobCostLedger(jobCostLedger).Apply(); JobCostLedgerView newView = await invMod.JobCostLedger.Query().GetViewByNumber(view.JobCostLedgerNumber); return(Ok(newView)); }
public IFluentJobCostLedger DeleteJobCostLedger(JobCostLedger deleteObject) { unitOfWork.jobCostLedgerRepository.DeleteObject(deleteObject); this.processStatus = CreateProcessStatus.Delete; return(this as IFluentJobCostLedger); }
public IFluentJobCostLedger AddJobCostLedger(JobCostLedger newObject) { unitOfWork.jobCostLedgerRepository.AddObject(newObject); this.processStatus = CreateProcessStatus.Insert; return(this as IFluentJobCostLedger); }