public void DisplayDetail(int _stationid)
    {
        stationsDao = new Stations_DAO();
        reviewsDao  = new Reviews_DAO();
        photosDao   = new Photos_DAO();
        pPhotos     = new Photos();
        stationId   = _stationid;

        EventDelegate.Add(buttonWriteReview.GetComponent <UIButton>().onClick,
                          () =>
        {
            Addreview.SetActive(true);
            Addreview.GetComponent <AddReview_UI>().Init(_stationid);
            gameObject.SetActive(false);
        });

        EventDelegate.Add(ButtonCountPhotos.GetComponent <UIButton>().onClick,
                          () =>
        {
            PhotosDetail.SetActive(true);
//                                  PhotosDetail.GetComponent<PhotoDetail_UI>().DesTroyResuiltItem();
            PhotosDetail.GetComponent <PhotoDetail_UI>().Setphotos(_stationid);
            gameObject.SetActive(false);
        });

        EventDelegate.Add(ButtonBack.GetComponent <UIButton>().onClick, Clickback);
        EventDelegate.Add(buttonAddPhotos.GetComponent <UIButton>().onClick, ClickAddPhotos);
        EventDelegate.Add(ButtonCountReview.GetComponent <UIButton>().onClick, () => {
            ReviewDetail.SetActive(true);
            ReviewDetail.GetComponent <ReviewDetail_UI>().ShowReview(_stationid);
            EventDelegate.Add(
                buttonBackDetail.GetComponent <UIButton>().onClick,
                () =>
            {
                ReviewDetail.SetActive(false);
            });
        });


        resuilt = stationsDao.GetStationById(_stationid);
        StationName.GetComponent <UILabel>().text    = resuilt[0]["Name"].ToString();
        StationCity.GetComponent <UILabel>().text    = resuilt[0]["LocationName"].ToString();
        Wifi.GetComponent <UILabel>().text           = ConvertPoint(resuilt[0]["Wifi"].ToString());
        Toilet.GetComponent <UILabel>().text         = ConvertPoint(resuilt[0]["Toilet"].ToString());
        Trolleys.GetComponent <UILabel>().text       = ConvertPoint(resuilt[0]["Trolley"].ToString());
        Refeshment.GetComponent <UILabel>().text     = ConvertPoint(resuilt[0]["Refreshment"].ToString());
        Atm.GetComponent <UILabel>().text            = ConvertPoint(resuilt[0]["ATM"].ToString());
        DisabledAccess.GetComponent <UILabel>().text = ConvertPoint(resuilt[0]["DisabledAccess"].ToString());

        //

        ButtonCountReview.GetComponentInChildren <UILabel>().text = reviewsDao.CoutNumReview(_stationid) + " Review";
        ButtonCountPhotos.GetComponentInChildren <UILabel>().text = photosDao.CoutNumPhotos(_stationid) + " Photos";
    }
示例#2
0
    // Use this for initialization

    public void Innit()
    {
        Debug.Log("Start Innit");
        crrStation     = new Stations();
        TxtStation     = GameObject.Find("txtStationID/Label");
        TxtStationName = GameObject.Find("txtStationName/Label");

        CbUnderground = GameObject.Find("Underground");
        CbRail        = GameObject.Find("Rail");
        CbDlr         = GameObject.Find("DLR");
        LbLocation    = GameObject.Find("lbLocation");

        CbWifi        = GameObject.Find("Wifi");
        CbToilets     = GameObject.Find("Toilets");
        CbTrolleys    = GameObject.Find("Trolleys");
        CbRefesh      = GameObject.Find("Refesh");
        CbAtm         = GameObject.Find("ATM");
        CbPhone       = GameObject.Find("Phone");
        BtnAddStation = GameObject.Find("btnAddStation");


        Debug.Log("DAO Innit");
        stationDAO  = new Stations_DAO();
        locationDAO = new Location_DAO();

        Debug.Log("Data Innit");
        TxtStation.GetComponent <UILabel>().text = (stationDAO.getMaxStaID() + 1).ToString();


        Debug.Log("Fill Data Innit");
        resuilt = locationDAO.getAllLocations();
        for (int i = 0; i < resuilt.Rows.Count; i++)
        {
            LbLocation.GetComponent <UIPopupList>().items.Add(resuilt[i]["Name"].ToString());
        }

        Debug.Log("Event Innit");
        EventDelegate.Add(LbLocation.GetComponent <UIPopupList>().onChange,
                          () =>
        {
            Debug.Log(LbLocation.GetComponent <UIPopupList>().value);
            Location = LbLocation.GetComponent <UIPopupList>().value;
        });

        EventDelegate.Add(BtnAddStation.GetComponent <UIButton>().onClick, BtnClickAddNewStation);

        Debug.Log("End Innit");
    }
    public void ShowResult(string _location)
    {
        Debug.Log(_location);
        stations = new Stations_DAO();
        resuilt  = stations.GetStationByLocation(_location);
        countRow = resuilt.Rows.Count;

        if (resuilt.Rows.Count > 0)
        {
            for (int i = 0; i < resuilt.Rows.Count; i++)
            {
                var go = GameObject.Instantiate(ItemResuilt) as GameObject;
                go.transform.parent        = UIgrid.transform;
                go.transform.localScale    = new Vector3(1, 1, 1);
                go.transform.localPosition = new Vector3(0, -250 * i, 0);
                go.name = "Result" + i;
                go.GetComponent <ItemResult_UI>()
                .SetResult(resuilt[i]["Name"].ToString(), resuilt[i]["PhotoFile"].ToString(), int.Parse(resuilt[i]["Wifi"].ToString()),
                           int.Parse(resuilt[i]["Toilet"].ToString()), int.Parse(resuilt[i]["Trolley"].ToString()), int.Parse(resuilt[i]["Refreshment"].ToString()), int.Parse(resuilt[i]["ATM"].ToString()), int.Parse(resuilt[i]["DisabledAccess"].ToString()));
//                Debug.Log("item "+i);
            }
        }
    }
示例#4
0
    private void insertStation()
    {
        try
        {
            locationDAO     = new Location_DAO();
            stationDAO      = new Stations_DAO();
            crrStation      = new Stations();
            crrStation.Id   = int.Parse(TxtStation.GetComponent <UILabel>().text);
            crrStation.Name = TxtStationName.GetComponent <UILabel>().text;

            if (CbUnderground.GetComponent <UIToggle>().value)
            {
                crrStation.Type = 1;
            }
            if (CbRail.GetComponent <UIToggle>().value)
            {
                crrStation.Type = 2;
            }
            if (CbDlr.GetComponent <UIToggle>().value)
            {
                crrStation.Type = 3;
            }

            crrStation.LocationId = locationDAO.getLocationIDbyName(Location);

            if (CbWifi.GetComponent <UIToggle>().value)
            {
                crrStation.Wifi = 1;
            }
            if (CbToilets.GetComponent <UIToggle>().value)
            {
                crrStation.Toilet = 1;
            }
            if (CbTrolleys.GetComponent <UIToggle>().value)
            {
                crrStation.Trolleys = 1;
            }
            if (CbRefesh.GetComponent <UIToggle>().value)
            {
                crrStation.Refreshment = 1;
            }
            if (CbAtm.GetComponent <UIToggle>().value)
            {
                crrStation.Atm = 1;
            }
            if (CbPhone.GetComponent <UIToggle>().value)
            {
                crrStation.Phone = 1;
            }
            //Assumps that has disabled access
            crrStation.DisabledAccess = 1;

            //Open to confirmation

            //Check PK
            if (crrStation.Id > stationDAO.getMaxStaID())
            {
                //Insert to DB
                if (stationDAO.InsertStation(crrStation))
                {
                    //Log Success
                    Debug.ClearDeveloperConsole();
                    Debug.Log(crrStation.Id);
                    Debug.Log(crrStation.Name);
                    Debug.Log(crrStation.Type);
                    Debug.Log(crrStation.LocationId);
                    Debug.Log(crrStation.Wifi);
                    Debug.Log(crrStation.Toilet);
                    Debug.Log(crrStation.Trolleys);
                    Debug.Log(crrStation.Refreshment);
                    Debug.Log(crrStation.Atm);
                    Debug.Log(crrStation.Phone);
                    Debug.Log("Insert Success");
                    //Redirect To Home
                }
                else
                {
                    Debug.ClearDeveloperConsole();
                    Debug.Log(crrStation.Id);
                    Debug.Log(crrStation.Name);
                    Debug.Log(crrStation.Type);
                    Debug.Log(crrStation.LocationId);
                    Debug.Log(crrStation.Wifi);
                    Debug.Log(crrStation.Toilet);
                    Debug.Log(crrStation.Trolleys);
                    Debug.Log(crrStation.Refreshment);
                    Debug.Log(crrStation.Atm);
                    Debug.Log(crrStation.Phone);
                    Debug.Log("Insert Failed");
                }
            }
            else
            {
                Debug.Log("PK Issue");
            }
        }
        catch (Exception ex)
        {
            Debug.ClearDeveloperConsole();
            Debug.Log("Exception");
        }
    }