public async Task <bool> Delete(ContractPaymentHistory ContractPaymentHistory) { if (await ValidateId(ContractPaymentHistory)) { } return(ContractPaymentHistory.IsValidated); }
public async Task <bool> Delete(ContractPaymentHistory ContractPaymentHistory) { await DataContext.ContractPaymentHistory.Where(x => x.Id == ContractPaymentHistory.Id).UpdateFromQueryAsync(x => new ContractPaymentHistoryDAO { DeletedAt = StaticParams.DateTimeNow }); return(true); }
public async Task <ContractPaymentHistory> Get(long Id) { ContractPaymentHistory ContractPaymentHistory = await UOW.ContractPaymentHistoryRepository.Get(Id); if (ContractPaymentHistory == null) { return(null); } return(ContractPaymentHistory); }
public Contract_ContractPaymentHistoryDTO(ContractPaymentHistory ContractPaymentHistory) { this.Id = ContractPaymentHistory.Id; this.ContractId = ContractPaymentHistory.ContractId; this.PaymentMilestone = ContractPaymentHistory.PaymentMilestone; this.PaymentPercentage = ContractPaymentHistory.PaymentPercentage; this.PaymentAmount = ContractPaymentHistory.PaymentAmount; this.Description = ContractPaymentHistory.Description; this.IsPaid = ContractPaymentHistory.IsPaid; this.Errors = ContractPaymentHistory.Errors; }
public async Task <ContractPaymentHistory> Get(long Id) { ContractPaymentHistory ContractPaymentHistory = await DataContext.ContractPaymentHistory.AsNoTracking() .Where(x => x.Id == Id).Select(x => new ContractPaymentHistory() { CreatedAt = x.CreatedAt, UpdatedAt = x.UpdatedAt, Id = x.Id, ContractId = x.ContractId, PaymentMilestone = x.PaymentMilestone, PaymentPercentage = x.PaymentPercentage, PaymentAmount = x.PaymentAmount, Description = x.Description, IsPaid = x.IsPaid, Contract = x.Contract == null ? null : new Contract { Id = x.Contract.Id, Code = x.Contract.Code, Name = x.Contract.Name, TotalValue = x.Contract.TotalValue, ValidityDate = x.Contract.ValidityDate, ExpirationDate = x.Contract.ExpirationDate, DeliveryUnit = x.Contract.DeliveryUnit, InvoiceAddress = x.Contract.InvoiceAddress, InvoiceZipCode = x.Contract.InvoiceZipCode, ReceiveAddress = x.Contract.ReceiveAddress, ReceiveZipCode = x.Contract.ReceiveZipCode, TermAndCondition = x.Contract.TermAndCondition, InvoiceNationId = x.Contract.InvoiceNationId, InvoiceProvinceId = x.Contract.InvoiceProvinceId, InvoiceDistrictId = x.Contract.InvoiceDistrictId, ReceiveNationId = x.Contract.ReceiveNationId, ReceiveProvinceId = x.Contract.ReceiveProvinceId, ReceiveDistrictId = x.Contract.ReceiveDistrictId, ContractTypeId = x.Contract.ContractTypeId, CompanyId = x.Contract.CompanyId, OpportunityId = x.Contract.OpportunityId, OrganizationId = x.Contract.OrganizationId, AppUserId = x.Contract.AppUserId, ContractStatusId = x.Contract.ContractStatusId, CreatorId = x.Contract.CreatorId, CustomerId = x.Contract.CustomerId, CurrencyId = x.Contract.CurrencyId, }, }).FirstOrDefaultAsync(); if (ContractPaymentHistory == null) { return(null); } return(ContractPaymentHistory); }
public async Task <bool> ValidateId(ContractPaymentHistory ContractPaymentHistory) { ContractPaymentHistoryFilter ContractPaymentHistoryFilter = new ContractPaymentHistoryFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = ContractPaymentHistory.Id }, Selects = ContractPaymentHistorySelect.Id }; int count = await UOW.ContractPaymentHistoryRepository.Count(ContractPaymentHistoryFilter); if (count == 0) { ContractPaymentHistory.AddError(nameof(ContractPaymentHistoryValidator), nameof(ContractPaymentHistory.Id), ErrorCode.IdNotExisted); } return(count == 1); }
public async Task <bool> Create(ContractPaymentHistory ContractPaymentHistory) { ContractPaymentHistoryDAO ContractPaymentHistoryDAO = new ContractPaymentHistoryDAO(); ContractPaymentHistoryDAO.Id = ContractPaymentHistory.Id; ContractPaymentHistoryDAO.ContractId = ContractPaymentHistory.ContractId; ContractPaymentHistoryDAO.PaymentMilestone = ContractPaymentHistory.PaymentMilestone; ContractPaymentHistoryDAO.PaymentPercentage = ContractPaymentHistory.PaymentPercentage; ContractPaymentHistoryDAO.PaymentAmount = ContractPaymentHistory.PaymentAmount; ContractPaymentHistoryDAO.Description = ContractPaymentHistory.Description; ContractPaymentHistoryDAO.IsPaid = ContractPaymentHistory.IsPaid; ContractPaymentHistoryDAO.CreatedAt = StaticParams.DateTimeNow; ContractPaymentHistoryDAO.UpdatedAt = StaticParams.DateTimeNow; DataContext.ContractPaymentHistory.Add(ContractPaymentHistoryDAO); await DataContext.SaveChangesAsync(); ContractPaymentHistory.Id = ContractPaymentHistoryDAO.Id; await SaveReference(ContractPaymentHistory); return(true); }
public async Task <ContractPaymentHistory> Update(ContractPaymentHistory ContractPaymentHistory) { if (!await ContractPaymentHistoryValidator.Update(ContractPaymentHistory)) { return(ContractPaymentHistory); } try { var oldData = await UOW.ContractPaymentHistoryRepository.Get(ContractPaymentHistory.Id); await UOW.Begin(); await UOW.ContractPaymentHistoryRepository.Update(ContractPaymentHistory); await UOW.Commit(); ContractPaymentHistory = await UOW.ContractPaymentHistoryRepository.Get(ContractPaymentHistory.Id); await Logging.CreateAuditLog(ContractPaymentHistory, oldData, nameof(ContractPaymentHistoryService)); return(ContractPaymentHistory); } catch (Exception ex) { await UOW.Rollback(); if (ex.InnerException == null) { await Logging.CreateSystemLog(ex, nameof(ContractPaymentHistoryService)); throw new MessageException(ex); } else { await Logging.CreateSystemLog(ex.InnerException, nameof(ContractPaymentHistoryService)); throw new MessageException(ex.InnerException); } } }
public async Task <bool> Update(ContractPaymentHistory ContractPaymentHistory) { ContractPaymentHistoryDAO ContractPaymentHistoryDAO = DataContext.ContractPaymentHistory.Where(x => x.Id == ContractPaymentHistory.Id).FirstOrDefault(); if (ContractPaymentHistoryDAO == null) { return(false); } ContractPaymentHistoryDAO.Id = ContractPaymentHistory.Id; ContractPaymentHistoryDAO.ContractId = ContractPaymentHistory.ContractId; ContractPaymentHistoryDAO.PaymentMilestone = ContractPaymentHistory.PaymentMilestone; ContractPaymentHistoryDAO.PaymentPercentage = ContractPaymentHistory.PaymentPercentage; ContractPaymentHistoryDAO.PaymentAmount = ContractPaymentHistory.PaymentAmount; ContractPaymentHistoryDAO.Description = ContractPaymentHistory.Description; ContractPaymentHistoryDAO.IsPaid = ContractPaymentHistory.IsPaid; ContractPaymentHistoryDAO.UpdatedAt = StaticParams.DateTimeNow; await DataContext.SaveChangesAsync(); await SaveReference(ContractPaymentHistory); return(true); }
private async Task SaveReference(ContractPaymentHistory ContractPaymentHistory) { }
public async Task <bool> Create(ContractPaymentHistory ContractPaymentHistory) { return(ContractPaymentHistory.IsValidated); }