Exemplo n.º 1
0
        /// <summary>
        /// Erstellt einen Abmeldeauftrag.
        /// </summary>
        /// <param name="userId">Id des Benutzers, der den Auftrag anlegt.</param>
        /// <param name="customerId">Id des Kunden.</param>
        /// <param name="vehicleId">Id des Fahrzeugs.</param>
        /// <param name="registrationId">Id der Zulassung.</param>
        /// <param name="locationId">Id des Kundenstandorts.</param>
        /// <param name="dbContext">Datenbankkontext für die Transaktion.</param>
        /// <returns>Den neuen Abmeldeauftrag.</returns>
        /// <remarks>Erstellt auch gleichzeitig den Order-Datensatz.</remarks>
        public static DeregistrationOrder CreateDeregistrationOrder(int userId, int customerId, Vehicle vehicle, Registration registration, int? locationId, 
            int zulassungsstelleId, DataClasses1DataContext dbContext)
        {
            var orderTypeId = dbContext.OrderType.Single(q => q.Id == (int)OrderTypes.Cancellation).Id;
            Order order = Order.CreateOrder(userId, customerId, orderTypeId, zulassungsstelleId, dbContext);
            order.LocationId = locationId;
            DeregistrationOrder deregistrationOrder = new DeregistrationOrder()
            {
                Order = order,
                Vehicle = vehicle,
                Registration = registration
            };

            dbContext.DeregistrationOrder.InsertOnSubmit(deregistrationOrder);
            dbContext.SubmitChanges();
            dbContext.WriteLogItem("Abmeldeauftrag angelegt.", LogTypes.INSERT, deregistrationOrder.OrderNumber, "DeregistrationOrder", vehicle.Id);
            return deregistrationOrder;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Erstellt eine neue Zulassung.
        /// </summary>
        /// <param name="carOwnerId">Id des Halters.</param>
        /// <param name="vehicleId">Id des Fahrzeugs.</param>
        /// <param name="licencenumber">Kennzeichen für die Zulassung.</param>
        /// <param name="evbNumber">eVB-Nummer der Fahrzeugversicherung.</param>
        /// <param name="generalInspectionDate">Datum der Hauptuntersuchung (HU).</param>
        /// <param name="registrationDate">Zulassungsdatum.</param>
        /// <param name="registrationDocumentNumber">Fahrzeugbriefnummer, falls vorhanden.</param>
        /// <param name="dbContext">Datenbankkontext für die Transaktion.</param>
        /// <returns>Die neue Zulassung.</returns>
        public static Registration CreateRegistration(CarOwner carOwner, Vehicle vehicle, string licencenumber, string evbNumber, DateTime? generalInspectionDate, 
            DateTime? registrationDate, string registrationDocumentNumber, string emissionCode, DataClasses1DataContext dbContext)
        {
            Registration registration = new Registration()
            {
                Vehicle = vehicle,
                CarOwner = carOwner,
                Licencenumber = licencenumber,
                GeneralInspectionDate = generalInspectionDate,
                RegistrationDate = registrationDate,
                RegistrationDocumentNumber = registrationDocumentNumber,
                eVBNumber = evbNumber,
                EmissionCode = emissionCode
            };

            dbContext.Registration.InsertOnSubmit(registration);
            dbContext.SubmitChanges();
            dbContext.WriteLogItem("Zulassung wurde angelegt.", LogTypes.INSERT, registration.Id, "Registration", vehicle.Id);

            return registration;
        }
Exemplo n.º 3
0
        public List<ResultMessages> VehicleRegistration(Registration newRegestration, string username, string password, string InternalId)
        {
            List<ResultMessages> results = new List<ResultMessages>();
            List<Guid> allowedCustomers = new List<Guid>();
            XMLHelper orderHelper = new XMLHelper();
            ResultMessages message = new ResultMessages();
            allowedCustomers = CheckLogin.CheckUser(username, password, InternalId);
            if (allowedCustomers.Count > 0)
            {
                using (DataClasses1DataContext dbContext = new DataClasses1DataContext(new Guid(ConfigurationManager.AppSettings["currentUser"])))
                {
                    try
                    {
                        dbContext.WriteLogItem("Zugriff von der IP Adresse: " + this.Context.Request.UserHostAddress + "Webservice VehicleRegistration()", LogTypes.INFO);
                        string file=orderHelper.XmlSerializeAndSave(newRegestration, OrderTypes.VehicleRegistration);

                        if (File.Exists(file))
                        {
                            ValidateOrderType.ValidateAndSaveRegistrationValues(newRegestration, dbContext, out results);
                        }
                        else
                        {
                            throw new Exception(file);
                        }
                    }

                    catch (Exception ex)
                    {
                        message.Error = "Fehler beim verabeiten der Daten, bitte wiederholen Sie den Vorgang" + Environment.NewLine + "Fehlermeldung: " + ex.Message;
                        results.Add(message);
                    }
                }
            }

            return results;
        }
Exemplo n.º 4
0
		private void detach_Registration(Registration entity)
		{
			this.SendPropertyChanging();
			entity.Vehicle = null;
		}
Exemplo n.º 5
0
		private void detach_Registration(Registration entity)
		{
			this.SendPropertyChanging();
			entity.CarOwner = null;
		}
Exemplo n.º 6
0
 partial void DeleteRegistration(Registration instance);
Exemplo n.º 7
0
 partial void UpdateRegistration(Registration instance);
Exemplo n.º 8
0
 partial void InsertRegistration(Registration instance);
Exemplo n.º 9
0
        public static void ValidateAndSaveRegistrationValues(Registration registrationObject, DataClasses1DataContext dbContext, out List<ResultMessages> messages)
        {
            ResultMessages result = new ResultMessages();
            messages = new List<ResultMessages>();

            foreach (RegistrationNeuzulassung neuzulassung in registrationObject.Neuzulassung)
            {
                result = new ResultMessages();

                if (getOpenedRegistrationOrder(neuzulassung.Vehicle.VIN).Count == 0)
                {
                    if (ValidateGuid(neuzulassung.Header))
                    {
                        string valGuid = ValidateGuid(neuzulassung.Header, dbContext);
                        if (valGuid == string.Empty)
                        {
                            if (IsVehicleInSystem(neuzulassung.Vehicle, dbContext) == null)
                            {
                                try
                                {
                                    CreateRegistration(neuzulassung, dbContext);
                                    result.Sucessed = "Sucessed imported VIN: " + neuzulassung.Vehicle.VIN;
                                    messages.Add(result);
                                }
                                catch (Exception ex)
                                {
                                    result.Error = ex.Message;
                                    result.Registration = neuzulassung;
                                    messages.Add(result);
                                }

                            }
                            else
                            {
                                result.Error = "Dieses Fahrzeug ist bereits im System vorhanden, meinten Sie vielleicht eine Wiederzulassung? Benutzen Sie bitte dafür die entsprechende Methode!";
                                result.Registration = neuzulassung;
                                messages.Add(result);
                            }

                        }
                        else
                        {
                            result.Error = valGuid;
                            result.Registration = neuzulassung;
                            messages.Add(result);
                        }

                    }
                    else
                    {
                        result.Error = "Eins oder mehrere Felder im Header sind keine gültigen Guids";
                        result.Registration = neuzulassung;
                        messages.Add(result);
                    }
                }
                else
                {
                    result.Error = "Für dieses Fahrzeug gibt es noch offene Aufträge";
                    result.Registration = neuzulassung;
                    messages.Add(result);
                }
            }
        }