/// <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(); targetCompetitionEntry = LoadObjectFromAPI <msCompetitionEntry>(ContextID); targetJudgingRound = LoadObjectFromAPI <msJudgingRound>(JudgingRoundId); if (targetCompetitionEntry == null) { GoToMissingRecordPage(); return; } targetCompetition = LoadObjectFromAPI <msCompetition>(targetCompetitionEntry.Competition); if (targetCompetition == null) { GoToMissingRecordPage(); return; } targetEntrant = LoadObjectFromAPI <msIndividual>(targetCompetitionEntry.Entrant); if (targetEntrant == null) { GoToMissingRecordPage(); return; } }
private void Save() { var primaryOrganizationRoles = targetObject.SafeGetValue <List <string> >("PrimaryOrganizationRoles__rtg"); if (primaryOrganizationRoles != null) { var orgId = targetObject.SafeGetValue <string>("PrimaryOrganization"); foreach (var primaryOrganizationRole in primaryOrganizationRoles) { CRMLogic.ErrorOutIfOrganizationContactRestrictionApplies(orgId, primaryOrganizationRole, targetObject.ID); } } targetObject = SaveObject(targetObject).ConvertTo <msIndividual>(); if (targetObject.ID == CurrentEntity.ID) { ConciergeAPI.CurrentEntity = targetObject; ConciergeAPI.CurrentUser = LoadObjectFromAPI <msPortalUser>(ConciergeAPI.CurrentUser.ID); } if (PortalConfiguration.Current.SendEmailWhenUserUpdatesInformation) { //Send the update confirmation email using (IConciergeAPIService proxy = GetConciegeAPIProxy()) proxy.SendTransactionalEmail(EmailTemplates.CRM.UserInformationUpdate, targetObject.ID, null); } QueueBannerMessage("Your profile was updated successfully."); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); targetEmailAddress = MultiStepWizards.AddContact.EmailAddress; targetIndividual = MultiStepWizards.AddContact.Individual; targetRelationshipType = MultiStepWizards.AddContact.RelationshipType; sendInvitation = MultiStepWizards.AddContact.SendInvitation; }
protected void wizAddContact_NextButtonClick(object sender, WizardNavigationEventArgs e) { switch (e.CurrentStepIndex) { case 0: lblAlreadyExists.Visible = false; targetEmailAddress = tbEmailAddress.Text; MultiStepWizards.AddContact.EmailAddress = targetEmailAddress; string relationshipTypeId = string.IsNullOrWhiteSpace(RelationshipTypeId) ? ddlRelationshipType.SelectedValue : RelationshipTypeId; targetRelationshipType = LoadObjectFromAPI <msRelationshipType>(relationshipTypeId); MultiStepWizards.AddContact.RelationshipType = targetRelationshipType; targetIndividual = unbindAndSearch(targetEmailAddress); try { CRMLogic.ErrorOutIfOrganizationContactRestrictionApplies( targetOrganization.ID, targetRelationshipType.ID); } catch (Exception ex) { cvContactRestriction.ErrorMessage = ex.Message; cvContactRestriction.IsValid = false; e.Cancel = true; return; } if (targetIndividual != null) { if (activeRelationshipExists(targetOrganization, targetIndividual, targetRelationshipType)) { lblAlreadyExists.Text = string.Format("Email Address <b>{0}</b> was found related to <b>{1} {2}</b>, who already has an active <b>{3}</b> relationship to <b>{4}</b>.", targetEmailAddress, targetIndividual.FirstName, targetIndividual.LastName, targetRelationshipType.Name, targetOrganization.Name); lblAlreadyExists.Visible = true; e.Cancel = true; return; } MultiStepWizards.AddContact.Individual = targetIndividual; wizAddContact.ActiveStepIndex = 2; } break; case 1: targetIndividual = unbindNewIndividual(); MultiStepWizards.AddContact.Individual = targetIndividual; MultiStepWizards.AddContact.SendInvitation = chkSendInvitation.Checked; break; } }
protected void unbindIndividual(msIndividual individual) { individual.FirstName = tbFirstName.Text; individual.LastName = tbLastName.Text; individual.EmailAddress = tbEmailAddress.Text; if (ConciergeAPI.CurrentEntity == null) { individual["Home_Address"] = acBillingAddress.Address; } }
protected msIndividual unbindNewIndividual() { msIndividual result = new msIndividual(); result.FirstName = tbFirstName.Text; result.LastName = tbLastName.Text; result.EmailAddress = tbEmailAddress.Text; return(result); }
static void Main(string[] args) { MemberSuiteAPI msAPI = new MemberSuiteAPI("https://rest-blue-internal.financial.membersuite.com", "hj2", "Password1!", "77vb3ihs1lrpoee0fc0q415iub", "27969"); msOrganization a = msAPI.GraphQLQueries.RunGetOrganization("8902ce52-0007-cb23-a2a8-0b39828645e9"); msEvent b = msAPI.GraphQLQueries.RunGetEvent("8902ce52-0078-c450-0978-0b3f2d50b2e2", "8902ce52-0006-c741-3888-0b3f474d7ca2"); msIndividual c = msAPI.GraphQLQueries.RunGetIndividual("8902ce52-0006-c741-3888-0b3f474d7ca2"); msMerchandisesearch d = msAPI.GraphQLQueries.RunGetMerchandise("21", "0", "2019-02-11T13:55:44.703Z", "2019-02-11T13:55:44.703Z", "8902ce52-0006-c255-d1de-0b3f327d1b78"); msEventregistrationforuser e = msAPI.GraphQLQueries.RunGetEventRegistrationForUser("8902ce52-0006-c255-d1de-0b3f327d1b78"); }
protected void btnContinue_Click(object sender, EventArgs e) { if (!IsValid) { Refresh(); return; } if (targetIndividual == null) { using (IConciergeAPIService proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { findOrCreateIndividual(proxy); } } if (targetIndividual == null) { QueueBannerError("Unable to find/create individual"); Refresh(); return; } //ONLY if the individual does not have a preferred address set and a Home_Address type is defined then set the Home_Address to be the billing address supplied (MS-1083) if (targetIndividual.PreferredAddressType == null && targetIndividual.Fields.ContainsKey("Home_Address")) { targetIndividual["Home_Address"] = acBillingAddress.Address; targetIndividual = SaveObject(targetIndividual).ConvertTo <msIndividual>(); // Have to update this in case it needs to be updated again (MS-1083) ConciergeAPI.CurrentEntity = targetIndividual; } unbindOrder(); unbindCreditCard(); using (IConciergeAPIService proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { var info = processOrder(proxy); if (info.Status == LongRunningTaskStatus.Running) { GoTo("/orders/OrderQueued.aspx"); } if (info.Status == LongRunningTaskStatus.Failed) { throw new ConciergeClientException(ConciergeErrorCode.IllegalOperation, info.AdditionalInfo); } QueueBannerMessage(string.Format("Your donation was processed successfully.", targetOrder.LocalID)); GoTo(string.Format("~/donations/DonationComplete.aspx?contextID={0}", info.WorkflowID)); } }
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(); targetCompetitionEntry = LoadObjectFromAPI <msCompetitionEntry>(ContextID); targetJudgingRound = LoadObjectFromAPI <msJudgingRound>(JudgingRoundId); if (targetCompetitionEntry == null || targetJudgingRound == null) { GoToMissingRecordPage(); return; } targetCompetition = LoadObjectFromAPI <msCompetition>(targetCompetitionEntry.Competition); if (targetCompetition == null) { GoToMissingRecordPage(); return; } targetEntrant = LoadObjectFromAPI <msIndividual>(targetCompetitionEntry.Entrant); if (targetEntrant == null) { GoToMissingRecordPage(); return; } //Search for an existing score card for this judge/competition entry/round and if not found create a new one Search sScoreCard = new Search { Type = msScoreCard.CLASS_NAME, Context = targetCompetitionEntry.ID }; sScoreCard.AddOutputColumn("ID"); sScoreCard.AddCriteria(Expr.Equals("Judge", ConciergeAPI.CurrentEntity.ID)); sScoreCard.AddCriteria(Expr.Equals("Entry", targetCompetitionEntry.ID)); sScoreCard.AddCriteria(Expr.Equals("Round", targetJudgingRound.ID)); SearchResult srScoreCard = APIExtensions.GetSearchResult(sScoreCard, 0, 1); targetScoreCard = srScoreCard.Table != null && srScoreCard.Table.Rows.Count > 0 ? LoadObjectFromAPI <msScoreCard>(srScoreCard.Table.Rows[0]["ID"].ToString()) : new msScoreCard { Entry = targetCompetitionEntry.ID, Judge = ConciergeAPI.CurrentEntity.ID, Round = targetJudgingRound.ID, Scores = new List <msScoreCardScore>(), Name = string.Format("{0} Scores for {1} {2} Round", targetCompetition.Name, targetEntrant.Name, targetJudgingRound.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(); string targetIndividualID = string.IsNullOrWhiteSpace(ContextID) ? CurrentEntity.ID : ContextID; targetObject = LoadObjectFromAPI <msIndividual>(targetIndividualID); if (targetObject == null) { GoToMissingRecordPage(); } }
private void setupRecommendationTarget() { switch (targetRecommendation.ClassType) { case msCertificationRecommendation.CLASS_NAME: target = LoadObjectFromAPI <msIndividual>( LoadObjectFromAPI <msCertification>( targetRecommendation.SafeGetValue <string>(msCertificationRecommendation.FIELDS.Certification)).Owner); break; default: throw new NotSupportedException("Unknown recommendation type"); } }
protected bool activeRelationshipExists(msOrganization organization, msIndividual individual, msRelationshipType relationshipType) { Search sRelationship = new Search("RelationshipsForARecord"); sRelationship.Context = organization.ID; sRelationship.AddOutputColumn("ID"); sRelationship.AddCriteria(Expr.Equals("Type_ID", relationshipType.ID)); sRelationship.AddCriteria(Expr.Equals("Target_ID", individual.ID)); sRelationship.AddCriteria(Expr.Equals("IsActive", true)); sRelationship.AddSortColumn("ID"); SearchResult srRelationship = APIExtensions.GetSearchResult(sRelationship, 0, null); return(srRelationship.TotalRowCount > 0); }
/// <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(); //Load the chapter and individual from the context id in the query string targetChapter = LoadObjectFromAPI <msChapter>(ContextID); if (targetChapter == null) { GoToMissingRecordPage(); return; } if (targetChapter.Leaders == null) { targetChapter.Leaders = new List <msMembershipLeader>(); } if (string.IsNullOrWhiteSpace(IndividualID)) { targetLeader = new msMembershipLeader(); } else { //Check the individual ID - if it's specified then this is an edit command and load the individual targetIndividual = LoadObjectFromAPI <msIndividual>(IndividualID); targetLeader = targetChapter.Leaders.Where(x => x.Individual == IndividualID).SingleOrDefault(); if (targetIndividual == null) { GoToMissingRecordPage(); return; } IsInEditMode = true; } if (targetLeader == null) { GoToMissingRecordPage(); return; } currentLeader = targetChapter.Leaders.Find(x => x.Individual == CurrentEntity.ID); }
/// <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(); using (IConciergeAPIService proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { searchForProducts(proxy); } targetOrder = new msOrder(); if (ConciergeAPI.CurrentEntity != null) { targetIndividual = ConciergeAPI.CurrentEntity.ConvertTo <msIndividual>(); divSaveContact.Visible = false; divDonate.Visible = true; divPayment.Visible = true; rfvProducts.Enabled = true; spnNameRequired.Visible = rfvCCNameOnCard.Enabled = true; spnCreditCardRequired.Visible = rfvCreditCardNumber.Enabled = true; //spnCVVRequired.Visible = rfvCardSecurity.Enabled = revCCV.Enabled=true; spnExpirationRequired.Visible = true; hfOrderBillToId.Value = targetIndividual.ID; dvPriorityData.InnerHtml = GetPriorityPaymentsConfig(hfOrderBillToId.Value); } else { divPayment.Visible = false; rfvProducts.Enabled = false; spnNameRequired.Visible = rfvCCNameOnCard.Enabled = false; spnCreditCardRequired.Visible = rfvCreditCardNumber.Enabled = revCCV.Enabled = false; spnCVVRequired.Visible = rfvCardSecurity.Enabled = false; spnExpirationRequired.Visible = false; } acBillingAddress.Host = this; }
public override void Run() { /* The point of this sample is to demonstrate the use of a handy SDK feature - the error handler. * This handler will automatically throw an exception, to be caught by a method of your choice, any time * a request is unsuccessful. This keeps you from having to write code like: * * if (!result.Success) * { * Console.WriteLine("Operation failed: {0}", result.FirstErrorMessage); * return; * } * * ...after every request. We use this extensively in our API-consuming code to simply our code base; executing * code can always assume an API request was successful.*/ // First, we need to prepare the proxy with the proper security settings. // This allows the proxy to generate the appropriate security header. For more information // on how to get these settings, see http://api.docs.membersuite.com in the Getting Started section if (!ConciergeAPIProxyGenerator.IsSecretAccessKeySet) { ConciergeAPIProxyGenerator.SetAccessKeyId(ConfigurationManager.AppSettings["AccessKeyID"]); ConciergeAPIProxyGenerator.SetSecretAccessKey(ConfigurationManager.AppSettings["SecretAccessKey"]); ConciergeAPIProxyGenerator.AssociationId = ConfigurationManager.AppSettings["AssociationID"]; } // ok, let's generate our API proxy using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { ConciergeClientExtensions.OnResultError += new EventHandler <ConciergeResultErrorArgs>(ConciergeClientExtensions_OnResultError); ConciergeClientExtensions.SessionExpired += new EventHandler(ConciergeClientExtensions_SessionExpired); // now, let's intentionally cause an error by trying to save an empty individual msIndividual indiv = new msIndividual(); api.Save(indiv); Console.WriteLine("This line will never be reached, as an exception has occurred in the last request."); } }
protected void findOrCreateIndividual(IConciergeAPIService serviceProxy) { //First try to locate an individual by e-mail Search sIndividualByEmail = new Search { Type = msIndividual.CLASS_NAME }; sIndividualByEmail.AddOutputColumn("ID"); SearchOperationGroup emailFilter = new SearchOperationGroup(); emailFilter.Criteria.Add(Expr.Equals("EmailAddress", tbEmailAddress.Text)); emailFilter.Criteria.Add(Expr.Equals("EmailAddress2", tbEmailAddress.Text)); emailFilter.Criteria.Add(Expr.Equals("EmailAddress3", tbEmailAddress.Text)); emailFilter.GroupType = SearchOperationGroupType.Or; sIndividualByEmail.AddCriteria(emailFilter); //Search for individuals by email SearchResult srIndividualByEmail = APIExtensions.GetSearchResult(sIndividualByEmail, 0, null); if (srIndividualByEmail.Table != null && srIndividualByEmail.Table.Rows.Count == 1) { DataRow drIndividual = srIndividualByEmail.Table.Rows[0]; targetIndividual = serviceProxy.LoadObjectFromAPI <msIndividual>(drIndividual["ID"].ToString()); } else { //Could not locate an individual by e-mail or had multiple hits - need to create a new individual targetIndividual = CreateNewObject <msIndividual>(); unbindIndividual(targetIndividual); var saveResult = serviceProxy.Save(targetIndividual); targetIndividual = saveResult.ResultValue.ConvertTo <msIndividual>(); } ConciergeAPI.CurrentEntity = targetIndividual; }
private void initializePendingRegistrations() { var group = MultiStepWizards.GroupRegistration.Group; msEvent ev = MultiStepWizards.GroupRegistration.Event; var order = MultiStepWizards.GroupRegistration.Order; if (group == null || group.ID != targetOrganization.ID) // no group, or wrong group { return; } if (ev == null || ev.ID != targetEvent.ID) // no event or wrong event { return; } if (order == null || order.LineItems == null || order.LineItems.Count == 0) { return; } var api = GetConciegeAPIProxy(); // now, process the order to get prices order = api.PreProcessOrder(order).ResultValue.FinalizedOrder.ConvertTo <msOrder>(); DataTable dt = new DataTable(); dt.Columns.Add("ID"); dt.Columns.Add("LocalID"); dt.Columns.Add("Name"); dt.Columns.Add("Fee"); dt.Columns.Add("Cost", typeof(decimal)); DataRow currentRow = null; foreach (msOrderLineItem li in order.LineItems) { // now, do we have an override specified - or, is it duped? msIndividual i = LoadObjectFromAPI <msIndividual>(li.OverrideShipTo); if (i == null) { continue; } // this code assumes the registration fee is first if (currentRow == null || Convert.ToString(currentRow["ID"]) != i.ID) // new row { currentRow = dt.NewRow(); dt.Rows.Add(currentRow); currentRow["LocalID"] = i.LocalID; currentRow["Name"] = i.Name; var productName = api.GetName(li.Product).ResultValue; currentRow["Fee"] = productName; currentRow["Cost"] = li.Total; currentRow["ID"] = i.ID; } else { currentRow["Cost"] = (decimal)currentRow["Cost"] + li.Total; // increment the fee } } gvPendingRegistrations.DataSource = dt; gvPendingRegistrations.DataBind(); btnCompleteGroup.Visible = true; pnlPending.Visible = true; lblTotalPending.Text = order.LineItems.Sum(x => x.Total).ToString("C"); }
protected void btnContinue_Click(object sender, EventArgs e) { bool enableValidators = ddlIndividual.SelectedValue == "-1"; rfvFirstName.Enabled = enableValidators; rfvLastName.Enabled = enableValidators; rfvEmail.Enabled = enableValidators; rfvRoles.Enabled = enableValidators; Validate(); if (!IsValid) { return; } // ok - do we have a registration? string userID = ddlIndividual.SelectedValue; if (userID == "-1") // then we have to create an individual { msIndividual i = new msIndividual(); i.FirstName = tbFirstName.Text; i.LastName = tbLastName.Text; i.EmailAddress = tbEmail.Text; i["PrimaryOrganization__rtg"] = targetOrganization.ID; List <string> roles = new List <string>(); foreach (ListItem li in lbRoles.Items) { if (li.Selected) { roles.Add(li.Value); } } i["PrimaryOrganizationRoles__rtg"] = roles; i = SaveObject <msIndividual>(i); userID = i.ID; QueueBannerMessage(string.Format("Individual #{0} - {1} {2} has been saved successfully.", i.LocalID, i.FirstName, i.LastName)); } else { // is this person in our list? Can't add them if so var order = MultiStepWizards.GroupRegistration.Order; if (order != null) { foreach (msOrderLineItem li in order.LineItems) { if (li.OverrideShipTo == userID) { cvSelectedTwice.IsValid = false; return; } } } // ok, let's figure out if this person is already registered if (EventLogic.IsRegistered(targetEvent.ID, userID)) { cvAlreadyRegistered.IsValid = false; return; } } MultiStepWizards.GroupRegistration.Group = targetOrganization; MultiStepWizards.GroupRegistration.RegistrantID = userID; MultiStepWizards.GroupRegistration.Event = targetEvent;; GoTo(string.Format("Register_SelectFee.aspx?contextID={0}&mode=group&organizationID={1}&individualID={2}", targetEvent.ID, targetOrganization.ID, userID)); }
public override void Run() { /* This sample is going to login to the association and create a record with a name, * email, and birthday that you specify. Once saved, the system will display the ID * of the individual created, the age (which MemberSuite calculates), and will automatically * launch the 360 view of that record in the web browser */ // First, we need to prepare the proxy with the proper security settings. // This allows the proxy to generate the appropriate security header. For more information // on how to get these settings, see http://api.docs.membersuite.com in the Getting Started section if (!ConciergeAPIProxyGenerator.IsSecretAccessKeySet) { ConciergeAPIProxyGenerator.SetAccessKeyId(ConfigurationManager.AppSettings["AccessKeyID"]); ConciergeAPIProxyGenerator.SetSecretAccessKey(ConfigurationManager.AppSettings["SecretAccessKey"]); ConciergeAPIProxyGenerator.AssociationId = ConfigurationManager.AppSettings["AssociationID"]; } // ok, let's generate our API proxy using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { // now, we want to create a new individual // First, we need to get a description of the individual // The description will tell the client SDK how to "build" the object; in other words, what the fields are // and what the default values are. So if you set a default value for LastName to 'Smith', the Describe // operation will have that in the metadata. When you construct the object, it will then have the last name // defaulted to 'Smith' ClassMetadata meta = api.DescribeObject("Individual").ResultValue; // now, create our MemberSuiteObject MemberSuiteObject mso = MemberSuiteObject.FromClassMetadata(meta); /* it's always easier to use the typed MemberSuiteObject * * You could just instantiate this directly by saying: * * msIndividual p = new msIndividual(); * * This would work - but without the class metadata, the object would not respect any of the defaults * that are set up. It would be a totally blank object.*/ msIndividual person = mso.ConvertTo <msIndividual>(); // now, you don't have to use dictionaries and string keys, you can access the object directly Console.WriteLine("Please enter a first name and press ENTER."); person.FirstName = Console.ReadLine(); Console.WriteLine("Please enter a last name and press ENTER."); person.LastName = Console.ReadLine(); person.EmailAddress = "*****@*****.**"; Console.WriteLine("Please enter a birthdate and press ENTER."); string date = Console.ReadLine(); DateTime dob; if (!DateTime.TryParse(date, out dob)) { Console.WriteLine("Invalid birthdate... exiting..."); return; } person.DateOfBirth = dob; // ok, so we can save this now var result = api.Save(person); if (!result.Success) { throw new ApplicationException("Unable to save: " + result.FirstErrorMessage); } msIndividual newPerson = result.ResultValue.ConvertTo <msIndividual>(); Console.WriteLine("Successfully saved individual #{0} - {1}. Age is {2}. ", newPerson.LocalID, newPerson.Name, newPerson.Age); Console.WriteLine("URL is:"); Console.WriteLine("https://console.production.membersuite.com/app/console/individual/view?c=" + newPerson.ID); } }