private void SaveAuto(Window addAutoWindow)
        {
            List <string> errMsgs = CheckFields();

            if (errMsgs.Count == 0)
            {
                Auto.Marke      = MarkeString;
                Auto.Tagestarif = int.Parse(TagestarifString);

                if (Auto is LuxusklasseAuto)
                {
                    ((LuxusklasseAuto)Auto).Basistarif = int.Parse(BasistarifString);
                }

                try
                {
                    Auto = autoManager.Insert(Auto);

                    DialogResult?.Invoke(true);
                }
                catch (DatabaseChangeException)
                {
                    displayer.DisplayError("Fehler beim Speichern", "Der Eintrag konnte nicht in die Datenbank gespeichert werden!");
                }
            }
            else
            {
                displayer.DisplayWarning("Fehler beim Erstellen eines Auto-Eintrags", String.Join("\n", errMsgs));
            }
        }
Exemple #2
0
        public AutoDto InsertAuto(AutoDto auto)
        {
            WriteActualMethod();
            AutoManager am = new AutoManager();

            return(am.Insert(auto.ConvertToEntity()).ConvertToDto());
        }
Exemple #3
0
        public override async Task <AutoDto> Insert(AutoDto request, ServerCallContext context)
        {
            AutoManager manager = new AutoManager();
            Auto        car     = request.ConvertToEntity();
            Auto        newcar  = await manager.Insert(car);

            return(newcar.ConvertToDto());
        }
        public void InsertAutoTest()
        {
            AutoManager autoManager = new AutoManager();
            Auto        auto        = new MittelklasseAuto {
                Marke = "Opel Corsa", Tagestarif = 100
            };
            Auto insertedAuto = autoManager.Insert(auto);

            Assert.AreEqual(4, insertedAuto.Id);
            Auto getAuto = autoManager.Auto(4);

            Assert.AreEqual("Opel Corsa", getAuto.Marke);
        }
        public override async Task <AutoDto> Insert(AutoDto request, ServerCallContext context)
        {
            try
            {
                AutoManager manager = new AutoManager();
                Auto        auto    = await manager.Insert(request.ConvertToEntity());

                AutoDto result = auto.ConvertToDto();
                return(result);
            }
            catch (OptimisticConcurrencyException <Auto> e)
            {
                throw new RpcException(new Status(StatusCode.Aborted, e.Message));
            }
        }
        public void AddAuto(AutoDto auto)
        {
            WriteActualMethod();
            IAutoReservationResultCallback cb = _createCallbackChannel();

            try
            {
                Auto insertedAuto = autoManager.Insert(auto.ConvertToEntity());
                cb.SendAuto(insertedAuto.ConvertToDto());
            }
            catch (DatabaseChangeException ex)
            {
                cb.SendFault(new CommunicationFault {
                    Exception = ex.Message
                });
            }
        }
 public void InsertAuto(AutoDto autoToBeInserted)
 {
     WriteActualMethod();
     autoManager.Insert(autoToBeInserted.ConvertToEntity());
 }
Exemple #8
0
        public override async Task <AutoDto> Insert(AutoDto request, ServerCallContext context)
        {
            Auto result = await CarManager.Insert(request.ConvertToEntity());

            return(result.ConvertToDto());
        }