Exemplo n.º 1
0
    public void setTruck(int truckID, int truckLicense, string manufacturer, string model, string kmToDate, string hand, float purchaseCost, string purchaseYear, int truckTypeID, string urea, string onRoadDate, string insuranceExpiredDate, string func)
    {
        DateTime dOnRoad;

        if (onRoadDate.Contains("."))
        {
            dOnRoad = DateTime.Parse(onRoadDate);
        }
        else
        {
            dOnRoad = DateTime.ParseExact(onRoadDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
        }

        DateTime dInsurance;

        if (insuranceExpiredDate.Contains("."))
        {
            dInsurance = DateTime.Parse(insuranceExpiredDate);
        }
        else
        {
            dInsurance = DateTime.ParseExact(insuranceExpiredDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
        }

        Trucks t = new Trucks(truckID, truckLicense, manufacturer, model, kmToDate, hand, purchaseCost, purchaseYear, new TruckTypes(truckTypeID, ""), urea, dOnRoad, dInsurance);

        t.setTruck(func);
    }