예제 #1
0
    // Use this for initialization
    void Start()
    {
        animationscript = transform.GetComponent <animationScript>();
        activitymanager = transform.GetComponent <activityManager> ();


        //creating customers
        Customer customer1 = new Customer(1, "harry", "hazelton", "h", "p");
        Customer customer2 = new Customer(2, "Connor", "Jones", "c", "p");

        //adding customers to dictionary

        dictionaryCustomer.Add(customer1.getEmail(), customer1);
        dictionaryCustomer.Add(customer2.getEmail(), customer2);



        Mechanic mechanic1 = new Mechanic(3, "Steve", "Harvey", "s", "p");
        Mechanic mechanic2 = new Mechanic(4, "Aladin", "Harvey", "a", "p");

        //adding mechanics to dictionary
        dictionaryMechanic.Add(mechanic1.getEmail(), mechanic1);
        dictionaryMechanic.Add(mechanic2.getEmail(), mechanic2);

        //create service request
        customer2.car = new Car();
        customer2.car.setMake("toyota");
        customer2.car.setModel("aurion");
        print(customer1.car.getMake());
        activitymanager.addServiceRequest(new serviceRequestReciept("fuel", 29f));
        activitymanager.getServiceRequest(0).customerId = customer2.getID();
        activitymanager.getServiceRequest(0).car        = new Car();
        activitymanager.getServiceRequest(0).car.setMake("toyota");
        activitymanager.getServiceRequest(0).car.setModel("aurion");
        customer2.addServiceRequest(activitymanager.getServiceRequest(0));

        Data data = new Data();

        data.saveCustomer(customer2);
    }
예제 #2
0
    public void createRowsOfRequests()
    {
        foreach (Transform child in rowPrefabParent.transform)
        {
            GameObject.Destroy(child.gameObject);
        }
        serviceRequestReceipt a;

        numberOfRows             = 0;
        numberOfRequestsMechanic = 0;
        numberOfRequests         = 0;

//		totalNumberOfRowsMechanic = activitymanager.getMechanicLoggedIn ().getServiceRequestSize ();
//		//print (totalNumberOfRowsMechanic + "size");
//		for (int x = 0; x < totalNumberOfRowsMechanic; x++) {
//			addRowMechanic ();
//
//
//		}

        print("started creatiing");
        totalNumberOfRows = activitymanager.serviceRequestReceipts.Count;
        print(totalNumberOfRows);
        print(totalNumberOfRows);
        for (int i = 0; i < totalNumberOfRows; i++)
        {
            a = activitymanager.getServiceRequest(i);
            //status 0 = not accepted, status 1 = accepted waiting to be finished, status 2 = finished
            if (a.getStatus() == 1)
            {
                if (a.mechanicId == activitymanager.getMechanicLoggedIn().id)
                {
                    addRowMechanic(a);
                }
            }
            else if (a.getStatus() == 0)
            {
                addRowUniversal(a);
            }
        }
    }