Esempio n. 1
0
    ///<summary>
    /// Retrieves a single reward from the Rewards table via the DataService.
    ///</summary>
    ///<param name="rewardName">A string representing the Reward you are requesting</param>
    ///<returns>Returns a DO_Reward object containing the data of that reward.</returns>
    public DO_Reward GetSpecificReward(string rewardName)
    {
        IEnumerable <Rewards> reward = dataService.SearchForReward(rewardName);
        DO_Reward             result = null;

        foreach (var row in reward)
        {
            result = new DO_Reward(row.reward_id, row.reward_name, row.reward_type, row.reward_url);
        }
        return(result);
    }
Esempio n. 2
0
    private void SetupSceneEdit()
    {
        //Entering scene from: rewards_list

        if (!controller.IsThereACurrentPhoto())
        {
            Debug.Log(CLASSNAME + "***** Current Photo not set");
            //Send request for data to controller
            DO_Reward reward = controller.RequestRewardToEdit();
            if (reward.Equals(null))
            {
                Debug.LogError(CLASSNAME + "Error retrieving Reward to edit");
            }
            rewardName      = reward.reward_name;
            editId          = reward.id;
            titleLabel.text = TITLE_EDIT;
            saveButton.GetComponentInChildren <Text>().text = "Update";
            bool result = controller.CheckForRewardImage(rewardName);

            Debug.Log(CLASSNAME + "***** Does Photo Exist: " + result.ToString());
        }

        /*
         * Entering scene from: reward_camera
         */
        else
        {
            Debug.Log(CLASSNAME + "***** Current Photo set");
            //Original scene entry by Edit
            if (controller.KeyToEdit != "")
            {
                rewardName      = controller.KeyToEdit;
                titleLabel.text = TITLE_EDIT;
            }
            //Original scene entry by Add New
            else
            {
                rewardName      = controller.NewRewardName;
                titleLabel.text = TITLE_ADD;
            }
        }


        //Set UI for editing
        inputFieldObj.SetActive(false);
        rewardNameTextObj.SetActive(true);
        rewardNameTextObj.GetComponent <Text>().text = rewardName;
        Debug.Log("***** REWARD NAME: " + rewardName);
        //Disable save button
        saveButton.interactable = false;
    }
    private void SetupSceneEdit()
    {
        /*
         * Entering scene from: rewards_list
         */

        //Send request for data to controller
        DO_Reward reward = controller.RequestRewardToEdit();

        rewardName = reward.reward_name;
        rewardUrl  = controller.RequestWebRewardUrl();
        Debug.Log("reward name: " + reward.reward_name + ", reward type: " + reward.reward_type + ", reward url: " + reward.reward_url);

        editId          = reward.id;
        titleLabel.text = TITLE_EDIT;
        saveButton.GetComponentInChildren <Text>().text = "Update";

        if (!controller.IsThereACurrentPhoto())
        {
            Debug.Log(CLASSNAME + "***** Current Photo not set");

            if (reward.Equals(null))
            {
                Debug.LogError(CLASSNAME + "Error retrieving Reward to edit");
            }

            bool result = controller.CheckForRewardImage(rewardName);
            Debug.Log(CLASSNAME + "***** Does Photo Exist: " + result.ToString());
        }



        //Set up UI for editing
        inputFieldObj.SetActive(false);
        rewardNameTextObj.SetActive(true);
        rewardNameTextObj.GetComponent <Text>().text = rewardName;
        Debug.Log("***** REWARD NAME: " + rewardName);


        currentUrl.text = rewardUrl;

        Debug.Log("////////// REWARD URL: " + rewardUrl);

        //Disable save button
        saveButton.interactable = false;
    }
Esempio n. 4
0
    ///<summary>
    /// Retrieves the Rewards table data from the DataService.
    ///</summary>
    ///<returns>Returns a Dictionary(string, DO_Reward) containing the table's data.</returns>
    public Dictionary <string, DO_Reward> GetRewardsList()
    {
        Debug.Log(CLASSNAME + "Retrieving all rewards");
        Dictionary <string, DO_Reward> rewardList = new Dictionary <string, DO_Reward>();
        IEnumerable <Rewards>          rewards    = dataService.GetRewardsTable();
        DO_Reward rewardEntry;

        foreach (var row in rewards)
        {
            //Debug.Log(CLASSNAME + "******* Reward: " + row.reward_name);
            rewardEntry = new DO_Reward(
                row.reward_id,
                row.reward_name,
                row.reward_type,
                row.reward_url

                );

            rewardList.Add(row.reward_name, rewardEntry);
        }
        return(rewardList);
    }