public InventoryService(IIOBalanceV2Repository <Product> product, IIOBalanceV2Repository <BatchInventoryLog> batchInventoryLog) { this._product = product; this._batchInventoryLog = batchInventoryLog; this.batchInventoryLog = new IOBalanceDBV2Entity.BatchInventoryLog(); this.product = new IOBalanceDBV2Entity.Product(); }
public long SaveBatchInvetoryLogs(BatchInventoryLogDto newDetails) { this.batchInventoryLog = newDetails.DtoToEntity(); var insertedBatchInventoryLog = this._batchInventoryLog.Insert(this.batchInventoryLog); if (insertedBatchInventoryLog.IsNull()) { return(0); } return(insertedBatchInventoryLog.BatchInventoryId); }
public bool UpdateBatchInventoryLogs(long batchInventoryId, string resultMessage) { var oldDetails = GetAllBatchInventory().Where(b => b.BatchInventoryId == batchInventoryId).FirstOrDefault(); oldDetails.ResultMessage = resultMessage; this.batchInventoryLog = new IOBalanceDBV2Entity.BatchInventoryLog(); this.batchInventoryLog = oldDetails.DtoToEntity(); if (this._batchInventoryLog.Update(this.batchInventoryLog, x => x.BatchInventoryId == batchInventoryId).IsNull()) { return(false); } return(true); }
public static IOBalanceDBV2Entity.BatchInventoryLog DtoToEntity(this BatchInventoryLogDto dto) { IOBalanceDBV2Entity.BatchInventoryLog entity = null; if (!dto.IsNull()) { entity = new IOBalanceDBV2Entity.BatchInventoryLog { BatchInventoryId = dto.BatchInventoryId, CreatedBy = dto.CreatedBy, DateCreated = dto.DateCreated, FileName = dto.FileName, ResultMessage = dto.ResultMessage }; } return(entity); }