Esempio n. 1
0
        public KundeDto InsertKunde(KundeDto kunde)
        {
            WriteActualMethod();
            KundeManager km = new KundeManager();

            return(km.Insert(kunde.ConvertToEntity()).ConvertToDto());
        }
Esempio n. 2
0
        public override async Task <KundeDto> DeleteKunde(KundeDto request, ServerCallContext context)
        {
            var kunde    = request.ConvertToEntity();
            var response = await kundeManager.DeleteKunde(kunde);

            return(response.ConvertToDto());
        }
Esempio n. 3
0
        public KundeDto InsertKunde(KundeDto kundeDto)
        {
            Kunde kunde = kundeDto.ConvertToEntity();

            autoReservationBusinessComponent.InsertKunde(kunde);
            return(kunde.ConvertToDto());
        }
Esempio n. 4
0
        public override async Task <KundeDto> Insert(KundeDto request, ServerCallContext context)
        {
            KundeManager manager  = new KundeManager();
            Kunde        kunde    = request.ConvertToEntity();
            Kunde        newKunde = await manager.Insert(kunde);

            return(newKunde.ConvertToDto());
        }
Esempio n. 5
0
        public override async Task <Empty> Delete(KundeDto request, ServerCallContext context)
        {
            KundeManager manager = new KundeManager();
            Kunde        kunde   = request.ConvertToEntity();
            await manager.Delete(kunde);

            return(new Empty());
        }
        public KundeDto DeleteKunde(KundeDto kundeDto)
        {
            WriteActualMethod();

            Kunde kunde = kundeDto.ConvertToEntity();

            return(autoReservationBusinessComponent.Delete(kunde).ConvertToDto());
        }
        public KundeDto UpdateKunde(KundeDto modified, KundeDto original)
        {
            WriteActualMethod();

            Kunde modKunde  = modified.ConvertToEntity();
            Kunde origKunde = original.ConvertToEntity();

            return(autoReservationBusinessComponent.Update(modKunde, origKunde).ConvertToDto());
        }
Esempio n. 8
0
 public KundeDto UpdateKunde(KundeDto kunde)
 {
     try {
         bc.UpdateKunde(kunde.ConvertToEntity());
     }
     catch (LocalOptimisticConcurrencyException <Kunde> e) {
         throw new FaultException <KundeDto>(e.MergedEntity.ConvertToDto(), e.Message);
     }
     return(kunde);
 }
 public void UpdateKunde(KundeDto modified, KundeDto original)
 {
     WriteActualMethod();
     try
     {
         _businessComponent.UpdateKunde(modified.ConvertToEntity(), original.ConvertToEntity());
     }
     catch (LocalOptimisticConcurrencyException <Kunde> e)
     {
         throw new FaultException <KundeDto>(e.MergedEntity.ConvertToDto());
     }
 }
 public void UpdateKunde(KundeDto kunde)
 {
     try
     {
         KundeManager.Update(kunde.ConvertToEntity());
     }
     catch (DbUpdateConcurrencyException)
     {
         var fault = new GenericFault("Update Concurrency Exception");
         throw new FaultException <GenericFault>(fault);
     }
 }
Esempio n. 11
0
 public KundeDto UpdateKunde(KundeDto kunde)
 {
     WriteActualMethod();
     try
     {
         return(new KundeManager().Update(kunde.ConvertToEntity()).ConvertToDto());
     }
     catch (OptimisticConcurrencyException <Kunde> ex)
     {
         throw new FaultException <KundeDto>(ex.MergedEntity.ConvertToDto(), ex.Message);
     }
 }
Esempio n. 12
0
 public KundeDto UpdateKunde(KundeDto kunde)
 {
     WriteActualMethod();
     try
     {
         return(service.UpdateKunde(kunde.ConvertToEntity()).ConvertToDto());
     }
     catch (LocalOptimisticConcurrencyException <Kunde> e)
     {
         throw new FaultException <KundeDto>(e.MergedEntity.ConvertToDto());
     }
 }
Esempio n. 13
0
        public override async Task <Empty> Delete(KundeDto request, ServerCallContext context)
        {
            try
            {
                KundeManager manager = new KundeManager();
                await manager.Delete(request.ConvertToEntity());

                return(new Empty());
            }
            catch (OptimisticConcurrencyException <Auto> e)
            {
                throw new RpcException(new Status(StatusCode.Aborted, e.Message));
            }
        }
Esempio n. 14
0
        public override async Task <Empty> DeleteKunde(KundeDto request, ServerCallContext context)
        {
            try
            {
                var entity = request.ConvertToEntity();
                await _manager.DeleteEntity(entity);

                return(new Empty());
            }
            catch (Exception)
            {
                throw new RpcException(new Status(StatusCode.Internal, "Internal error occured."));
            }
        }
 public void DeleteKunde(KundeDto kundeToBeDeleteed)
 {
     WriteActualMethod();
     try { kundeManager.Delete(kundeToBeDeleteed.ConvertToEntity()); }
     catch (OptimisticConcurrencyException <Kunde> )
     {
         OptimisticConcurrencyFault ocf = new OptimisticConcurrencyFault
         {
             Operation   = "Delete",
             ProblemType = "Optimstic Cocurrency Error during deleting on Kunde!"
         };
         throw new FaultException <OptimisticConcurrencyFault>(ocf);
     }
 }
Esempio n. 16
0
        public override async Task <KundeDto> InsertKunde(KundeDto request, ServerCallContext context)
        {
            try
            {
                var entity   = request.ConvertToEntity();
                var response = await _manager.AddEntity(entity);

                return(response.ConvertToDto());
            }
            catch (Exception)
            {
                throw new RpcException(new Status(StatusCode.Internal, "Internal error occured."));
            }
        }
Esempio n. 17
0
        public override async Task <KundeDto> UpdateKunde(KundeDto request, ServerCallContext context)
        {
            try
            {
                var kunde    = request.ConvertToEntity();
                var response = await kundeManager.UpdateKunde(kunde);

                return(response.ConvertToDto());
            }
            catch (OptimisticConcurrencyException <Kunde> e)
            {
                throw new RpcException(new Status(StatusCode.Aborted, e.Message), e.MergedEntity.ToString());
            }
        }
Esempio n. 18
0
        public override async Task <KundeDto> Insert(KundeDto request, ServerCallContext context)
        {
            try
            {
                KundeManager manager = new KundeManager();
                Kunde        kunde   = await manager.Insert(request.ConvertToEntity());

                KundeDto result = kunde.ConvertToDto();
                return(result);
            }
            catch (OptimisticConcurrencyException <Auto> e)
            {
                throw new RpcException(new Status(StatusCode.Aborted, e.Message));
            }
        }
Esempio n. 19
0
 public override async Task <Empty> Update(KundeDto request, ServerCallContext context)
 {
     try
     {
         await ClientManager.Update(request.ConvertToEntity());
     }
     catch (OptimisticConcurrencyException <Kunde> exception)
     {
         throw new RpcException(
                   new Status(StatusCode.Aborted, "Concurrency Exception."),
                   exception.ToString()
                   );
     }
     return(new Empty());
 }
Esempio n. 20
0
        public void UpdateKunde(KundeDto modified, KundeDto original)
        {
            try
            {
                WriteActualMethod();
                BusinessComponent.UpdateKunde(modified.ConvertToEntity(), original.ConvertToEntity());
            }
            catch (LocalOptimisticConcurrencyException <Kunde> ex)
            {
                OptimisticConcurrencyException <KundeDto> enThrow = new OptimisticConcurrencyException <KundeDto>();
                enThrow.Entity = ex.Entity.ConvertToDto();

                throw new FaultException <OptimisticConcurrencyException <KundeDto> >(enThrow);
            }
        }
Esempio n. 21
0
 public KundeDto UpdateKunde(KundeDto kundeDto)
 {
     try {
         Kunde kunde = kundeDto.ConvertToEntity();
         autoReservationBusinessComponent.UpdateKunde(kunde);
         return(kunde.ConvertToDto());
     } catch (LocalOptimisticConcurrencyException <Kunde> ex)
     {
         OptimisticConcurrencyFaultContract ocfc = new OptimisticConcurrencyFaultContract
         {
             Operation = "UpdateKunde",
             Message   = ex.Message
         };
         throw new FaultException <OptimisticConcurrencyFaultContract>(ocfc);
     }
 }
        public void UpdateKunde(KundeDto kunde)
        {
            WriteActualMethod();
            IAutoReservationResultCallback cb = _createCallbackChannel();

            try
            {
                cb.SendKunde(kundeManager.Update(kunde.ConvertToEntity()).ConvertToDto());
            }
            catch (Exception ex)
            {
                cb.SendFault(new CommunicationFault {
                    Exception = ex.Message
                });
            }
        }
 public void RemoveKunde(KundeDto kunde)
 {
     WriteActualMethod();
     try
     {
         _kundeManager.Remove(kunde.ConvertToEntity());
     }
     catch (OptimisticConcurrencyException <Kunde> e)
     {
         throw new FaultException <OptimisticConcurrencyFault <KundeDto> >(
                   new OptimisticConcurrencyFault <KundeDto>()
                   )
               {
               };
     }
 }
Esempio n. 24
0
 public void UpdateKunde(KundeDto original, KundeDto modified)
 {
     WriteActualMethod();
     try
     {
         _businessComponent.UpdateKunde(original.ConvertToEntity(), modified.ConvertToEntity());
     }
     catch (LocalOptimisticConcurrencyException <Kunde> e)
     {
         var fault = new LocalOptimisticConcurrencyFault()
         {
             Message = e.Message
         };
         throw new FaultException <LocalOptimisticConcurrencyFault>(fault);
     }
 }
        public void AddKunde(KundeDto kunde)
        {
            WriteActualMethod();
            IAutoReservationResultCallback cb = _createCallbackChannel();

            try
            {
                Kunde insertedKunde = kundeManager.Insert(kunde.ConvertToEntity());
                cb.SendKunde(insertedKunde.ConvertToDto());
            }
            catch (DatabaseChangeException ex)
            {
                cb.SendFault(new CommunicationFault {
                    Exception = ex.Message
                });
            }
        }
        public void CreateKunde(KundeDto customer)
        {
            WriteActualMethod();

            try
            {
                _kundeManager.Create(customer.ConvertToEntity());
            }
            catch (CustomerNotOfAgeException ex)
            {
                throw new FaultException <AutoReservationFault>(new AutoReservationFault
                {
                    ErrorCode    = AutoReservationFault.CustomerNot18YearsOld,
                    ErrorMessage = ex.Message
                });
            }
        }
        public void DeleteKunde(KundeDto customer)
        {
            WriteActualMethod();

            try
            {
                _kundeManager.Delete(customer.ConvertToEntity());
            }
            catch (OptimisticConcurrencyException <Kunde> ex)
            {
                throw new FaultException <AutoReservationFault>(new AutoReservationFault
                {
                    ErrorCode    = AutoReservationFault.DataHasBeenModifiedInMeantime,
                    ErrorMessage = $"Database Entity-State: {ex.MergedEntity.ConvertToDto()}"
                });
            }
        }
Esempio n. 28
0
        public override async Task <Empty> Update(KundeDto request, ServerCallContext context)
        {
            KundeManager manager = new KundeManager();
            Kunde        kunde   = request.ConvertToEntity();

            try
            {
                await manager.Update(kunde);
            }
            catch (OptimisticConcurrencyException <Kunde> exception) //TODO error handling evtl. noch nicht korrekt
            {
                throw new RpcException(new Status(
                                           StatusCode.Aborted,
                                           "Conccurency Exception."
                                           ), exception.ToString());
            }
            return(new Empty());
        }
Esempio n. 29
0
        public override async Task <Empty> UpdateKunde(KundeDto request, ServerCallContext context)
        {
            try
            {
                var entity = request.ConvertToEntity();
                await _manager.UpdateEntity(entity);

                return(new Empty());
            }
            catch (Exception e)
            {
                if (e is OptimisticConcurrencyException <Kunde> specificException)
                {
                    throw new RpcException(new Status(StatusCode.Aborted, e.Message), specificException.MergedEntity.ToString());
                }
                throw new RpcException(new Status(StatusCode.Internal, "Internal error occured."));
            }
        }
Esempio n. 30
0
        public void updateKunde(KundeDto kunde)
        {
            WriteActualMethod();
            try
            {
                _kundenManager.UpdateKunde(kunde.ConvertToEntity());
            }
            catch (InvalidOperationException)
            {
                OutOfRangeFault fault = new OutOfRangeFault
                {
                    Operation = "update"
                };

                throw new FaultException <OutOfRangeFault>(fault);
            }
            catch (DbUpdateConcurrencyException)
            {
                ConcurrencyFault fault = new ConcurrencyFault();

                throw new FaultException <ConcurrencyFault>(fault);
            }
        }