/// <summary> /// /// </summary> /// <param name="entityDTO"></param> public override void Update(OperationDTO operationDTO) { try { OperationTableAdapter.Update(operationDTO.Amount, (short)operationDTO.Type, operationDTO.Person.ID, operationDTO.ID); } catch (Exception) { throw; } }
/// <summary> /// /// </summary> /// <param name="entityDTO"></param> /// <returns></returns> public override int Add(OperationDTO operationDTO) { try { int Id = OperationTableAdapter.Insert(operationDTO.Amount, (short)operationDTO.Type, operationDTO.Person.ID); return(Id); } catch (Exception) { throw; } }
/// <summary> /// /// </summary> /// <returns></returns> public override IEnumerable <OperationDTO> GetAll() { try { OperationTableAdapter.Fill(OperationDataTable); IEnumerable <OperationDTO> operationDTOs = OperationDataTable.Select(operationRow => new OperationDTO() { ID = operationRow.ID, Amount = operationRow.Amount, Type = (OperationType)operationRow.Type, Person = PersonDAO.Instance.GetById(operationRow.Person_ID) }); return(operationDTOs); } catch (Exception) { throw; } }
/// <summary> /// /// </summary> /// <param name="Id"></param> /// <returns></returns> public override OperationDTO GetById(int Id) { try { OperationTableAdapter.Fill(OperationDataTable); BorrowNlendDataSet.OperationRow operationRow = OperationDataTable.First(opRow => opRow.ID == Id); OperationDTO operationDTO = new OperationDTO() { ID = operationRow.ID, Amount = operationRow.Amount, Type = (OperationType)operationRow.Type, Person = PersonDAO.Instance.GetById(operationRow.Person_ID) }; return(operationDTO); } catch (Exception) { throw; } }