protected void btnSave_Click(object sender, EventArgs e) { UnbindRelationship(); targetRelationship = SaveObject(targetRelationship); GoToManageContacts(); }
protected void wizAddContact_FinishButtonClick(object sender, EventArgs e) { if (!IsValid) { return; } targetIndividual = SaveObject(targetIndividual).ConvertTo <msIndividual>(); msRelationship newRelationship = new msRelationship { Type = targetRelationshipType.ID }; string targetEmail; if (targetRelationshipType.LeftSideType == msOrganization.CLASS_NAME) { newRelationship.LeftSide = targetOrganization.ID; newRelationship.RightSide = targetIndividual.ID; targetEmail = targetIndividual.EmailAddress; } else { newRelationship.RightSide = targetOrganization.ID; newRelationship.LeftSide = targetIndividual.ID; targetEmail = targetOrganization.EmailAddress; } newRelationship = SaveObject(newRelationship).ConvertTo <msRelationship>(); using (IConciergeAPIService proxy = GetConciegeAPIProxy()) { //The API GetOrCreatePortalUser will attempt to match the supplied credentials to a portal user, individual, or organization. //If a portal user is found it will be returned. If not and an individual / organization uses the email address it will create and return a new Portal User var result = proxy.SearchAndGetOrCreatePortalUser(targetEmail); if (sendInvitation) { //Send the welcome email proxy.SendWelcomePortalUserEmail(result.ResultValue.ID, targetEmail); } } string nextUrl = "~/profile/ManageContacts.aspx"; if (!string.IsNullOrWhiteSpace(ContextID)) { string.Format("{0}?contextID{1}", nextUrl, ContextID); } GoTo(nextUrl, string.Format("{0} has been successfully linked to {1}.", targetIndividual.Name, targetOrganization.Name)); }
/// <summary> /// Initializes the target object for the page /// </summary> /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing /// an event, the target object is an event. When looking up a directory, that's the target /// object. This method is intended to be overriden to initialize the target object for /// each page that needs it.</remarks> protected override void InitializeTargetObject() { base.InitializeTargetObject(); targetRelationship = LoadObjectFromAPI <msRelationship>(ContextID); if (targetRelationship == null) { GoToMissingRecordPage(); return; } targetRelationshipType = LoadObjectFromAPI <msRelationshipType>(targetRelationship.Type); if (targetRelationshipType == null) { GoToMissingRecordPage(); return; } leftSide = APIExtensions.LoadObjectFromAPI(targetRelationship.LeftSide); rightSide = APIExtensions.LoadObjectFromAPI(targetRelationship.RightSide); }