Esempio n. 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);
    }
Esempio n. 2
0
    public void okClicked()
    {
        if (isOther)
        {
            if (make.text == "" | model.text == "" | year.text == "" | colour.text == "" | lattitude.text == "" | longitude.text == "" | price.text == "" | problem.text == "")
            {
                //input field message
                SSTools.ShowMessage("input field empty", SSTools.Position.bottom, SSTools.Time.twoSecond);
                return;
            }

            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setMake(make.text);
            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setModel(model.text);
            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setYear(int.Parse(year.text));
            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setColour(colour.text);
            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setlattitude(float.Parse(lattitude.text));
            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setlongitude(float.Parse(longitude.text));

            //create service request receipt
            loginActivity loginactivity = canvas.GetComponent <loginActivity> ();
            loginactivity.totalIDCount++;
            loginactivity.saveTotalIDCount();
            serviceRequestReceipt reciept = new serviceRequestReceipt(loginactivity.totalIDCount, activitymanager.getCustomerLoggedIn().id, problem.text, float.Parse(price.text));
            reciept.car = canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car;

            activitymanager.addServiceRequest(reciept);
            //loginactivity.saveReceipt(activitymanager.getCustomerLoggedIn().id,reciept);

            //serviceRequestReciept currentReciept = activitymanager.getServiceRequest (activitymanager.getServiceRequestSize () - 1);
            activitymanager.getCustomerLoggedIn().addServiceRequest(reciept);

            loginactivity.saveCustomer(activitymanager.getCustomerLoggedIn());


            //currentReciept.customer = activitymanager.getCustomerLoggedIn();
            //currentReciept.car = activitymanager.getCustomerLoggedIn ().car;
            SSTools.ShowMessage("request Sent", SSTools.Position.bottom, SSTools.Time.twoSecond);
            backButtonServiceRequestClicked();
            canvas.GetComponent <homeMenuScript> ().createRowsOfRequests();
        }
        else
        {
            if (make.text == "" | model.text == "" | year.text == "" | colour.text == "" | lattitude.text == "" | longitude.text == "")
            {
                //input field message
                SSTools.ShowMessage("input field empty", SSTools.Position.bottom, SSTools.Time.twoSecond);
                return;
            }

            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setMake(make.text);
            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setModel(model.text);
            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setYear(int.Parse(year.text));
            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setColour(colour.text);
            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setlattitude(float.Parse(lattitude.text));
            canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car.setlongitude(float.Parse(longitude.text));

            //create service request receipt
            loginActivity loginactivity = canvas.GetComponent <loginActivity> ();
            loginactivity.totalIDCount++;
            loginactivity.saveTotalIDCount();
            serviceRequestReceipt reciept = new serviceRequestReceipt(loginactivity.totalIDCount, activitymanager.getCustomerLoggedIn().id, service.name, service.price);
            reciept.car = canvas.GetComponent <activityManager> ().getCustomerLoggedIn().car;

            activitymanager.addServiceRequest(reciept);
            //loginactivity.saveReceipt(activitymanager.getCustomerLoggedIn().id,reciept);

            //serviceRequestReciept currentReciept = activitymanager.getServiceRequest (activitymanager.getServiceRequestSize () - 1);
            activitymanager.getCustomerLoggedIn().addServiceRequest(reciept);

            loginactivity.saveCustomer(activitymanager.getCustomerLoggedIn());


            //currentReciept.customer = activitymanager.getCustomerLoggedIn();
            //currentReciept.car = activitymanager.getCustomerLoggedIn ().car;
            SSTools.ShowMessage("request Sent", SSTools.Position.bottom, SSTools.Time.twoSecond);
            backButtonServiceRequestClicked();
            canvas.GetComponent <homeMenuScript> ().createRowsOfRequests();
        }

        requestPriceText.gameObject.SetActive(true);
        requestTypeText.gameObject.SetActive(true);
        carText.gameObject.SetActive(true);
        priceText.gameObject.SetActive(true);
        price.gameObject.SetActive(false);
        problem.gameObject.SetActive(false);
        isOther = false;
    }