Exemple #1
0
    /// <summary>
    /// Gets and bulk updates polls. Called when the "Get and bulk update polls" button is pressed.
    /// Expects the CreatePoll method to be run first.
    /// </summary>
    private bool GetAndBulkUpdatePolls()
    {
        // Prepare the parameters
        string where = "PollCodeName LIKE N'MyNewPoll%'";

        // Get the data
        DataSet polls = PollInfoProvider.GetPolls(where, null);

        if (!DataHelper.DataSourceIsEmpty(polls))
        {
            // Loop through the individual items
            foreach (DataRow pollDr in polls.Tables[0].Rows)
            {
                // Create object from DataRow
                PollInfo modifyPoll = new PollInfo(pollDr);

                // Update the properties
                modifyPoll.PollDisplayName = modifyPoll.PollDisplayName.ToUpper();

                // Save the changes
                PollInfoProvider.SetPollInfo(modifyPoll);
            }

            return(true);
        }

        return(false);
    }