Ejemplo n.º 1
0
    /// <summary>
    /// Gets and bulk updates memberships. Called when the "Get and bulk update memberships" button is pressed.
    /// Expects the CreateMembership method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateMemberships()
    {
        // Prepare the parameters
        string where = "MembershipName LIKE N'MyNewMembership%'";

        // Get the data
        DataSet memberships = MembershipInfoProvider.GetMemberships(where, null);

        if (!DataHelper.DataSourceIsEmpty(memberships))
        {
            // Loop through the individual items
            foreach (DataRow membershipDr in memberships.Tables[0].Rows)
            {
                // Create object from DataRow
                MembershipInfo modifyMembership = new MembershipInfo(membershipDr);

                // Update the properties
                modifyMembership.MembershipDisplayName = modifyMembership.MembershipDisplayName.ToUpper();

                // Save the changes
                MembershipInfoProvider.SetMembershipInfo(modifyMembership);
            }

            return(true);
        }

        return(false);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Gets and bulk updates memberships. Called when the "Get and bulk update memberships" button is pressed.
    /// Expects the CreateMembership method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateMemberships()
    {
        // Prepare the parameters
        string where = "MembershipName LIKE N'MyNewMembership%'";

        // Get the data from database
        var memberships = MembershipInfoProvider.GetMemberships().Where(where);

        // Loop through the individual items
        foreach (MembershipInfo modifyMembership in memberships)
        {
            // Update the properties
            modifyMembership.MembershipDisplayName = modifyMembership.MembershipDisplayName.ToUpper();

            // Save the changes
            MembershipInfoProvider.SetMembershipInfo(modifyMembership);
        }

        // Return TRUE if any object was found and updated, FALSE otherwise
        return(memberships.Count > 0);
    }