Exemplo n.º 1
0
 /// <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;
     }
 }
Exemplo n.º 2
0
 /// <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;
     }
 }
Exemplo n.º 3
0
 /// <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;
     }
 }
Exemplo n.º 4
0
        /// <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;
            }
        }