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"; }
// Use this for initialization // void Start () { // ShowReview(1); // } public void ShowReview(int _stationId) { reviews = new Reviews_DAO(); if (resuilt != null && resuilt.Rows.Count > 0) { resuilt.Rows.Clear(); DesTroyResuiltItem(); } resuilt = reviews.GetReviewByStationId(_stationId); countRow = resuilt.Rows.Count; // Debug.Log("countRow new "+countRow); if (countRow > 0) { for (int i = 0; i < resuilt.Rows.Count; i++) { var go = GameObject.Instantiate(ItemReview) 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 = "ItemReview" + i; go.GetComponent <ItemReview_UI>().SetValues("Review: " + i, resuilt[i]["Name"].ToString(), resuilt[i]["Rating"].ToString(), resuilt[i]["Comment"].ToString()); } } }
// Use this for initialization // void Start () // { // Debug.Log(); // } public void Init(int _stationID) { reviews = new Reviews(); reviewsDao = new Reviews_DAO(); facilitiesDao = new Facilities_DAO(); DateReview.GetComponent <UILabel>().text = DateTime.Now.Date.ToString("dd-MM-yyyy"); reviews.Date = DateReview.GetComponent <UILabel>().text; Debug.Log(reviews.Date); stationID = _stationID; reviews.Stationid = stationID; EventDelegate.Add(buttonBack.GetComponent <UIButton>().onClick, () => { gameObject.GetComponentInParent <AppManager>().form[2].SetActive(true); gameObject.SetActive(false); }); EventDelegate.Add(Rating.GetComponent <UIPopupList>().onChange, () => { Debug.Log(ConvertStarToPoint(Rating.GetComponent <UIPopupList>().value)); reviews.Rating = ConvertStarToPoint(Rating.GetComponent <UIPopupList>().value); }); EventDelegate.Add(TypeOfFacilities.GetComponent <UIPopupList>().onChange, () => { Debug.Log("Facilities ID: " + facilitiesDao.GetFacilitiesIDByName(TypeOfFacilities.GetComponent <UIPopupList>().value) + " | facilities Name: " + TypeOfFacilities.GetComponent <UIPopupList>().value); reviews.Facilitiyid = facilitiesDao.GetFacilitiesIDByName( TypeOfFacilities.GetComponent <UIPopupList>().value); }); EventDelegate.Add(Save.GetComponent <UIButton>().onClick, () => { reviews.Comment = Comment.GetComponent <UIInput>().value; EnableAllControl(false); PopupSave.SetActive(true); EventDelegate.Add(GameObject.Find("PopUp/btnBack").GetComponent <UIButton>().onClick, () => { EnableAllControl(true); PopupSave.SetActive(false); }); EventDelegate.Add(GameObject.Find("PopUp/btnConfirm").GetComponent <UIButton>().onClick, () => { SaveData(); EnableAllControl(true); PopupSave.SetActive(false); }); } ); EventDelegate.Add(ShareFb.GetComponent <UIButton>().onClick, () => { EnableAllControl(false); reviews.Comment = Comment.GetComponent <UIInput>().value; FB.Init(() => { if (!FB.IsLoggedIn) { FB.Logout(); FB.Login("public_profile,email,user_friends", (FBResult resuit) => { PopupFb.SetActive(true); PopupFb.GetComponent <PopupShareFb_UI>().ShareFeed(reviews); }); } else { FB.Login("public_profile,email,user_friends", (FBResult resuit) => { PopupFb.SetActive(true); PopupFb.GetComponent <PopupShareFb_UI>().ShareFeed(reviews); }); } }); }); }