C# Class RockWeb.Blocks.Examples.SampleData

Inheritance: Rock.Web.UI.RockBlock
Datei anzeigen Open project: NewSpring/Rock

Public Methods

Method Description
AddNewFamilyAddress ( Group family, string locationTypeGuid, string street1, string street2, string city, string state, string postalCode, string country, RockContext rockContext ) : void

Adds the new family address.

CreateNewFamily ( List familyMembers, int campusId ) : Group

Creates a new family using the given set of people.

Protected Methods

Method Description
Block_BlockUpdated ( object sender, EventArgs e ) : void

Handles the BlockUpdated event of the SampleData control.

GetStories ( string saveFile ) : string

Extract the stories out of the XML comments and put them on the results page.

OnInit ( EventArgs e ) : void

Raises the E:System.Web.UI.Control.Init event.

OnLoad ( EventArgs e ) : void

Raises the E:System.Web.UI.Control.Load event.

bbtnLoadData_Click ( object sender, EventArgs e ) : void

This is the entry point for when the user clicks the "load data" button.

Private Methods

Method Description
AddConnections ( System.Xml.Linq.XElement elemConnections, RockContext rockContext ) : void

Adds the connections requests to the system from the given XML element.

AddDefinedTypeValue ( string stringValue, DefinedType definedType, RockContext rockContext ) : DefinedValue

Adds a new defined value to a given DefinedType.

AddFamilies ( System.Xml.Linq.XElement elemFamilies, RockContext rockContext ) : void

Handles adding families from the given XML element snippet

AddFamilyAddresses ( GroupService groupService, Group family, System.Xml.Linq.XElement addresses, RockContext rockContext ) : void

Adds the given addresses in the xml snippet to the given family.

AddFamilyAttendance ( Group family, System.Xml.Linq.XElement elemFamily, RockContext rockContext, Dictionary attendanceData ) : void

Grabs the necessary parameters from the XML and then calls the CreateAttendance() method to generate all the attendance data for the family.

AddFamilyGiving ( System.Xml.Linq.XElement elemGiving, string familyName, RockContext rockContext ) : void

Adds the family giving records. The giving element.

AddFollowing ( System.Xml.Linq.XElement elemFollowing, RockContext rockContext ) : void

Adds the following records from the given XML element.

AddGroups ( System.Xml.Linq.XElement elemGroups, RockContext rockContext ) : void

Handles adding groups from the given XML element snippet.

AddMetaphone ( ) : void

Adds a transaction to add the metaphone stuff for each person we've added.

AddNote ( int personId, string noteTypeName, string noteText, string noteDate, string byPersonGuid, string isPrivate, string isAlert, RockContext rockContext ) : void

Add a note on the given person's record.

AddPeoplesPreviousNames ( System.Xml.Linq.XElement elemFamilies, RockContext rockContext ) : void

Adds the peoples previous names.

AddPersonAttributes ( GroupMember groupMember, IEnumerable attributes, RockContext rockContext ) : void

Adds the person attributes and values found in the XML to the person's attribute-value collection.

AddPersonLogins ( RockContext rockContext ) : void

Adds any logins stored in the _peopleLoginsDictionary.

AddPersonNotes ( System.Xml.Linq.XElement elemFamilies, RockContext rockContext ) : void

Adds any notes for any people given in the XML file.

AddPreviousName ( int personAliasId, string previousLastName, RockContext rockContext ) : void

Adds the name of the previous.

AddRegistrationInstances ( System.Xml.Linq.XElement elemRegistrationInstances, RockContext rockContext ) : void

Adds any registration instances given in the XML file.

AddRegistrationTemplates ( System.Xml.Linq.XElement elemRegistrationTemplates, RockContext rockContext ) : void

Adds any registration templates given in the XML file.

AddRelationships ( System.Xml.Linq.XElement elemRelationships, RockContext rockContext ) : void

Adds a KnownRelationship record between the two supplied Guids with the given 'is' relationship type: Role / inverse Role ================================ step-parent / step-child grandparent / grandchild previous-spouse / previous-spouse can-check-in / allow-check-in-by parent / child sibling / sibling invited / invited-by related / related ...for xml such as:

AddToSecurityGroups ( System.Xml.Linq.XElement elemSecurityGroups, RockContext rockContext ) : void

Handles adding people to the security groups from the given XML element snippet.

AddWeeklySchedule ( Group group, string dayOfWeekName, string time ) : void

Adds a Weekly schedule to the given group.

AppendFormat ( string format ) : void

BuildFamilyMembersFromXml ( System.Xml.Linq.XElement elemMembers, RockContext rockContext ) : List

Takes the given XML element and creates a family member collection. If the person already exists, their record will be loaded otherwise a new person will be created using all the attributes for the given 'person' tag.

CreateAttendance ( ICollection familyMembers, System.DateTime startingDate, System.DateTime endDate, int pctAttendance, int pctAttendedRegularService, int scheduleId, int altScheduleId, Dictionary attendanceData ) : void

Adds attendance data for each child for each weekend since the starting date up to the weekend ending X weeks ago (endingWeeksAgo). It will randomly skip a weekend based on the percentage (pctAttendance) and it will vary which service they attend between the scheduleId and altScheduleId based on the percentage (pctAttendedRegularService) given.

CreateGiving ( System.Guid personGuid, System.DateTime startingDate, System.DateTime endDate, Frequency frequency, int percentGive, int growRatePercent, int growFrequencyWeeks, int specialGiftPercent, decimal>.Dictionary accountAmountDict, LinkedList circularImageList, RockContext rockContext ) : void

Creates the giving records for the given parameters.

DeleteExistingFamilyData ( System.Xml.Linq.XElement families, RockContext rockContext ) : void

Deletes the family's addresses, phone numbers, photos, viewed records, and people. TODO: delete attendance codes for attendance data that's about to be deleted when we delete the person record.

DeleteExistingGroups ( System.Xml.Linq.XElement elemGroups, RockContext rockContext ) : void

Delete all groups found in the given XML.

DeleteGroupAndMemberData ( Group group, RockContext rockContext ) : void

Generic method to delete the members of a group and then the group.

DeleteRegistrationTemplates ( System.Xml.Linq.XElement elemRegistrationTemplates, RockContext rockContext ) : void

Deletes the registration templates.

DownloadFile ( string fileUrl, string fileOutput ) : bool

Download the given fileUrl and store it at the fileOutput.

FlattenInnerExceptions ( Exception ex ) : string

Flattens exception's innerexceptions and returns an Html formatted string useful for debugging.

FormatMultipleFeeCosts ( IEnumerable options ) : string

Formats the fee cost options for the CostValue field.

GenerateRandomCode ( int len ) : string

A little method to generate a random sequence of characters of a certain length.

GetOrAddDefinedValueId ( string theValue, DefinedType aDefinedType, RockContext rockContext ) : int

Gets or adds a new DefinedValue to the given DefinedTypeCache and returns the Id of the value.

ProcessXml ( string sampleXmlFile ) : void

Process all the data in the XML file; deleting stuff and then adding stuff. as per https://github.com/SparkDevNetwork/Rock/wiki/z.-Rock-Solid-Demo-Church-Specification#wiki-xml-data

RecordSuccess ( ) : void

Records the current date into the SampleData system setting so that other blocks (such as the RockUpdate) can know that sample data has been loaded.

SaveImage ( string imageUrl, BinaryFileType binaryFileType, string binaryFileTypeSettings, RockContext context ) : BinaryFile

Fetches the given remote photoUrl and stores it locally in the binary file table then returns Id of the binary file.

VerifyXMLDocumentExists ( ) : void

Verify that the configured XML document exists.

Method Details

AddNewFamilyAddress() public method

Adds the new family address.
public AddNewFamilyAddress ( Group family, string locationTypeGuid, string street1, string street2, string city, string state, string postalCode, string country, RockContext rockContext ) : void
family Group The family.
locationTypeGuid string The location type unique identifier.
street1 string The street1.
street2 string The street2.
city string The city.
state string The state.
postalCode string The zip.
country string
rockContext Rock.Data.RockContext The rock context.
return void

Block_BlockUpdated() protected method

Handles the BlockUpdated event of the SampleData control.
protected Block_BlockUpdated ( object sender, EventArgs e ) : void
sender object The source of the event.
e System.EventArgs The instance containing the event data.
return void

CreateNewFamily() public method

Creates a new family using the given set of people.
public CreateNewFamily ( List familyMembers, int campusId ) : Group
familyMembers List The family members.
campusId int The campus identifier.
return Group

GetStories() protected method

Extract the stories out of the XML comments and put them on the results page.
protected GetStories ( string saveFile ) : string
saveFile string
return string

OnInit() protected method

Raises the E:System.Web.UI.Control.Init event.
protected OnInit ( EventArgs e ) : void
e System.EventArgs An object that contains the event data.
return void

OnLoad() protected method

Raises the E:System.Web.UI.Control.Load event.
protected OnLoad ( EventArgs e ) : void
e System.EventArgs The object that contains the event data.
return void

bbtnLoadData_Click() protected method

This is the entry point for when the user clicks the "load data" button.
protected bbtnLoadData_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void