/// <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); if (targetCompetitionEntry == null) { GoToMissingRecordPage(); return; } targetCompetition = LoadObjectFromAPI <msCompetition>(targetCompetitionEntry.Competition); if (targetCompetition == null) { GoToMissingRecordPage(); return; } targetEntryStatus = LoadObjectFromAPI <msCompetitionEntryStatus>(targetCompetitionEntry.Status); using (IConciergeAPIService proxy = GetConciegeAPIProxy()) { Search s = new Search(msCustomField.CLASS_NAME); s.AddCriteria(Expr.Equals(msCustomField.FIELDS.Competition, targetCompetition.ID)); targetCompetitionQuestions = proxy.GetObjectsBySearch(s, null, 0, null). ResultValue.Objects.ConvertTo <msCustomField>(); } }
protected string executeDownloadableSearch() { using (IConciergeAPIService serviceProxy = GetConciegeAPIProxy()) { return(serviceProxy.ExecuteSearchWithFileOutput(targetSearch, BuiltInSearchOutputTypes.ExcelFormatted, false).ResultValue); } }
protected void gvDuplicates_RowCommand(Object sender, GridViewCommandEventArgs e) { if (e.CommandName.ToLower() == "select") { if (MultiStepWizards.CreateAccount.InitiatedByLeader) { MultiStepWizards.CreateAccount.InitiatedByLeader = false; GoTo(string.Format("~/membership/Join.aspx?entityID={0}", e.CommandArgument)); return; } msPortalUser portalUser = null; using (IConciergeAPIService proxy = GetConciegeAPIProxy()) { portalUser = proxy.GetOrCreatePortalUserForEntity(e.CommandArgument.ToString()).ResultValue; } if (portalUser == null) { GoTo("~/profile/UnableToCreateAccount.aspx"); return; } GoTo(string.Format("~/profile/EmailLoginInformation.aspx?contextID={0}", portalUser.ID)); return; } }
protected override void loadDataFromConcierge(IConciergeAPIService proxy) { base.loadDataFromConcierge(proxy); Search sDiscussionPosts = new Search(msDiscussionPost.CLASS_NAME); sDiscussionPosts.AddOutputColumn("ID"); sDiscussionPosts.AddOutputColumn("Name"); sDiscussionPosts.AddOutputColumn("CreatedDate"); sDiscussionPosts.AddOutputColumn("Post"); sDiscussionPosts.AddOutputColumn("PostedBy"); sDiscussionPosts.AddOutputColumn("PostedBy.Name"); sDiscussionPosts.AddOutputColumn("PostedBy.Discussions_DiscussionPosts"); sDiscussionPosts.AddOutputColumn("PostedBy.Image"); sDiscussionPosts.AddCriteria(Expr.Equals("Topic", targetDiscussionTopic.ID)); sDiscussionPosts.AddCriteria(Expr.Equals("Status", DiscussionPostStatus.Approved.ToString())); sDiscussionPosts.AddSortColumn("CreatedDate", true); sDiscussionPosts.AddSortColumn("Name"); SearchResult srDiscussionPosts = proxy.GetSearchResult(sDiscussionPosts, PageStart, PAGE_SIZE); dtDiscussionPosts = srDiscussionPosts.Table; for (int i = 0; i < dtDiscussionPosts.Columns.Count; i++) { dtDiscussionPosts.Columns[i].ColumnName = dtDiscussionPosts.Columns[i].ColumnName.Replace(".", "_"); } SetCurrentPageFromResults(srDiscussionPosts, hlFirstPage, hlPrevPage, hlNextPage, lNumPages, null, null, null, lCurrentPage); }
protected void DeleteItem(string id) { using (IConciergeAPIService serviceProxy = GetServiceAPIProxy()) { serviceProxy.Delete(id); } }
protected bool isModerator() { using (IConciergeAPIService proxy = GetConciegeAPIProxy()) { return(isModerator(proxy)); } }
protected void loadSubscription() { using (IConciergeAPIService proxy = GetConciegeAPIProxy()) { loadSubscription(proxy); } }
public static string GetFolderPath(IConciergeAPIService api, string folderID) { if (api == null) { throw new ArgumentNullException("api"); } if (folderID == null) { throw new ArgumentNullException("folderID"); } Search sFolders = new Search(msFileFolder.CLASS_NAME); sFolders.AddCriteria(Expr.Equals("ID", folderID)); sFolders.AddOutputColumn("FolderPath"); var sr = api.GetSearchResult(sFolders, 0, 1); if (sr.TotalRowCount > 0) { return((string)sr.Table.Rows[0]["FolderPath"]); } return(null); }
public static MemberSuiteObject GetFileCabinetContext(IConciergeAPIService api, msFileFolder targetFolder) { var msoCabinet = api.Get(targetFolder.FileCabinet).ResultValue; switch (msoCabinet.ClassType) { case msCommitteeFileCabinet.CLASS_NAME: return(api.Get(msoCabinet.SafeGetValue <string>(msCommitteeFileCabinet.FIELDS.Committee)).ResultValue); case msChapterFileCabinet.CLASS_NAME: return(api.Get(msoCabinet.SafeGetValue <string>(msChapterFileCabinet.FIELDS.Chapter)).ResultValue); case msSectionFileCabinet.CLASS_NAME: return(api.Get(msoCabinet.SafeGetValue <string>(msSectionFileCabinet.FIELDS.Section)).ResultValue); case msOrganizationalLayerFileCabinet.CLASS_NAME: return(api.Get(msoCabinet.SafeGetValue <string>(msOrganizationalLayerFileCabinet.FIELDS.OrganizationalLayer)).ResultValue); case msAssociationFileCabinet.CLASS_NAME: return(null); default: throw new NotSupportedException("Unknown cabinet " + msoCabinet.ClassType); } }
private SearchManifest buildSearchManifest() { SearchManifest result; using (IConciergeAPIService proxy = GetServiceAPIProxy()) { Search s = new Search("MembershipWithFlowdown"); foreach (var f in PortalConfiguration.Current.MembershipDirectoryTabularResultsFields) { s.AddOutputColumn(f); } result = proxy.DescribeCompiledSearch(s).ResultValue; } //Always add the owner ID as an output column and sort on name result.DefaultSelectedFields = new List <SearchOutputColumn> { new SearchOutputColumn { Name = "Owner.ID", DisplayName = "Owner ID" } }; result.DefaultSortFieds = new List <SearchSortColumn> { new SearchSortColumn { Name = "Owner.Name" } }; result.DefaultSelectedFields.AddRange( from field in result.Fields select new SearchOutputColumn { Name = field.Name, DisplayName = field.Label }); return(result); }
/// <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(); if (MultiStepWizards.SearchDirectory.SearchManifest == null) { MultiStepWizards.SearchDirectory.SearchManifest = buildSearchManifest(); } using (IConciergeAPIService proxy = GetConciegeAPIProxy()) { var s = new Search("MembershipWithFlowdown"); PortalConfiguration.Current.MembershipDirectorySearchFields.ForEach(x => s.AddOutputColumn(x)); targetCriteriaFields = proxy.DescribeCompiledSearch(s).ResultValue.Fields; foreach (var f in targetCriteriaFields) { f.PortalPrompt = null; // MS-923 if (f.DataType == FieldDataType.Reference && f.DisplayType == FieldDisplayType.TextBox) { f.DisplayType = FieldDisplayType.AjaxComboBox; // MS-925 } var labelOverride = PortalConfiguration.GetOverrideFor( Request.Url.LocalPath, ColumnHeaderOverridePrefix + f.Name, "Text"); if (labelOverride != null) { f.Label = labelOverride.Value; } } } }
protected void loadDataFromConcierge(IConciergeAPIService serviceProxy) { targetCompetition = serviceProxy.LoadObjectFromAPI <msCompetition>(ContextID); if (targetCompetition == null) { GoToMissingRecordPage(); return; } targetEntryInfo = targetCompetition.GetCompetitionEntryInformation(); // now check judging if (ConciergeAPI.CurrentEntity == null) { return; } Search s = new Search("JudgingTeamMember"); s.AddOutputColumn("Team.ID"); s.AddCriteria(Expr.Equals("Team.Competition.ID", targetCompetition.ID)); s.AddCriteria(Expr.Equals("Member.ID", ConciergeAPI.CurrentEntity.ID)); SearchResult sr = APIExtensions.GetSearchResult(s, 0, 1); if (sr.TotalRowCount > 0 && sr.Table != null && sr.Table.Rows.Count > 0) { judgingTeamID = sr.Table.Rows[0]["Team.ID"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // now, let's assume the identity // first, we need a proxy // The "False" means we DON'T want the API to throw an exception if an error occurs IConciergeAPIService proxy = ConciergeAPIProxyGenerator.GenerateProxy(); // now, let's contact the API and use the session ID provided var loginResult = proxy.WhoAmI(); if (!loginResult.Success) // something went wrong { Response.Write("There was a problem: " + loginResult.Errors[0].Message); return; } // let's save the session ID - now, its part of the header // once we've done that, we can use the API across postbacks and pages // b/c the session will be sent in the header of each request ConciergeAPIProxyGenerator.SessionID = loginResult.ResultValue.SessionID; msUser user = new msUser(loginResult.ResultValue.User); // ok, let's set our user name lblUserName.Text = user.Name; tbUserDepartment.Text = user.Department; lblUserDepartment.Text = user.Department; } }
private void SetCategories(IConciergeAPIService proxy) { if (_cachedCategories == null) { _cachedCategories = SessionManager.Get <DataTable>(CategoryCacheKey); } if (_cachedCategories != null) { Categories = new DataView(_cachedCategories); return; } var s = new Search { Type = msProductCategory.CLASS_NAME, ID = msProductCategory.CLASS_NAME }; s.AddOutputColumn("ID"); s.AddOutputColumn("Name"); s.AddCriteria(Expr.Equals("IsActive", true)); s.AddCriteria(Expr.Equals("ProductType", "Merchandise")); s.AddSortColumn("Name"); var results = proxy.GetSearchResult(s, 0, null); _cachedCategories = results.Table; SessionManager.Set(CategoryCacheKey, results.Table); Categories = new DataView(_cachedCategories); }
public void AddReferenceNamesToTargetObject(IConciergeAPIService proxy) { if (EditMode || PageLayout == null || MemberSuiteObject == null || Metadata == null) { return; } foreach (var controlSection in PageLayout.Sections) { foreach (var controlMetadata in controlSection.LeftControls.Union(controlSection.RightControls)) { if (string.IsNullOrWhiteSpace(controlMetadata.DataSourceExpression) || !Metadata.Fields.Exists(x => x.Name == controlMetadata.DataSourceExpression)) { continue; } FieldMetadata fieldMetadata = Metadata.Fields.Single(x => x.Name == controlMetadata.DataSourceExpression); if (fieldMetadata.DataType != FieldDataType.Reference) { continue; } string value = MemberSuiteObject.SafeGetValue(controlMetadata.DataSourceExpression) as string; if (string.IsNullOrWhiteSpace(value)) { continue; } MemberSuiteObject referencedObject = proxy.Get(value).ResultValue; MemberSuiteObject[controlMetadata.DataSourceExpression + "_Name__transient"] = referencedObject["Name"]; } } }
private SearchManifest buildSearchManifest() { SearchManifest result; using (IConciergeAPIService proxy = GetServiceAPIProxy()) { result = proxy.DescribeSearch(msResume.CLASS_NAME, null).ResultValue; result.Fields.Clear(); result.Fields = proxy.GetSearchFieldMetadataFromFullPath(msResume.CLASS_NAME, null, PortalConfiguration.Current.ResumeTabularResultsFields).ResultValue; } //Always add the resume ID as an output column and sort on name result.DefaultSelectedFields = new List <SearchOutputColumn> { new SearchOutputColumn { Name = "ID", DisplayName = "ID" } }; result.DefaultSortFieds = new List <SearchSortColumn> { new SearchSortColumn { Name = "Owner.Name" } }; result.DefaultSelectedFields.AddRange( from field in result.Fields select new SearchOutputColumn { Name = field.Name, DisplayName = field.Label }); return(result); }
protected void gvShoppingCart_RowDeleting(object sender, GridViewDeleteEventArgs e) { using (IConciergeAPIService proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { loadDataFromConcierge(proxy); } }
protected LongRunningTaskStatusInfo processOrder(IConciergeAPIService api) { var processedOrderPacket = api.PreProcessOrder(targetOrder).ResultValue; cleanOrder = processedOrderPacket.FinalizedOrder.ConvertTo <msOrder>(); //Reset the total because a donation can be any amount - the product price returned from preprocessing is just the "suggested donation" cleanOrder.LineItems[0].Total = targetOrder.Total; // now, let's set the total - in case the product has added additional stuff like shipping/taxes cleanOrder.Total = cleanOrder.LineItems.Sum(x => x.Total); cleanOrder.PaymentMethod = OrderPaymentMethod.CreditCard; cleanOrder.CreditCardNumber = targetCreditCard.CardNumber; cleanOrder.CreditCardExpirationDate = targetCreditCard.CardExpirationDate; cleanOrder.CCVCode = targetCreditCard.CCVCode; cleanOrder.BillingAddress = acBillingAddress.Address; // cleanOrder.BillingEmailAddress = tbEmailAddress.Text; var info = api.ProcessOrder(cleanOrder, null).ResultValue; // let's wait return(OrderUtilities.WaitForOrderToComplete(api, info)); }
protected bool isModerator(IConciergeAPIService proxy) { if (hasLeaderSearchBeenRun) { return(leader != null && leader.CanModerateDiscussions); } if (targetChapter != null) { Search sChapterLeader = GetChapterLeaderSearch(targetChapter.ID); SearchResult srChapterLeader = proxy.GetSearchResult(sChapterLeader, 0, 1); leader = ConvertLeaderSearchResult(srChapterLeader); hasLeaderSearchBeenRun = true; } if (targetSection != null) { Search sSectionLeader = GetSectionLeaderSearch(targetSection.ID); SearchResult srSectionLeader = proxy.GetSearchResult(sSectionLeader, 0, 1); leader = ConvertLeaderSearchResult(srSectionLeader); hasLeaderSearchBeenRun = true; } if (targetOrganizationalLayer != null) { Search sOrganizationalLayerLeader = GetOrganizationalLayerLeaderSearch(targetOrganizationalLayer.ID); SearchResult srOrganizationalLayerLeader = proxy.GetSearchResult(sOrganizationalLayerLeader, 0, 1); leader = ConvertLeaderSearchResult(srOrganizationalLayerLeader); hasLeaderSearchBeenRun = true; } return(leader != null && leader.CanModerateDiscussions); }
protected override void InstantiateCustomFields(IConciergeAPIService proxy) { cfsAbstractCustomFields.MemberSuiteObject = targetAbstract; cfsAbstractCustomFieldsConfirm.MemberSuiteObject = targetAbstract; var pageLayout = targetAbstract.GetAppropriatePageLayout(); divAdditionalInfo.Visible = false; if ((pageLayout == null || pageLayout.Metadata == null || pageLayout.Metadata.IsEmpty())) { return; } divAdditionalInfoConfirm.Visible = divAdditionalInfo.Visible = true; // setup the metadata cfsAbstractCustomFields.Metadata = targetAbstract.DescribeObject(); cfsAbstractCustomFields.PageLayout = pageLayout.Metadata; cfsAbstractCustomFields.Render(); //The lifecycle here is a little strange because of the wizard. Force a bind/harvest at this point to set the confirm fields cfsAbstractCustomFieldsConfirm.Metadata = cfsAbstractCustomFields.Metadata; cfsAbstractCustomFieldsConfirm.PageLayout = cfsAbstractCustomFields.PageLayout; cfsAbstractCustomFieldsConfirm.AddReferenceNamesToTargetObject(proxy); cfsAbstractCustomFieldsConfirm.Render(); }
/// <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()) { loadTargetOrder(proxy); if (targetOrder == null) { GoToMissingRecordPage(); } // If an Order found, try to get a related Gift object var giftSearch = new Search(msGift.CLASS_NAME); giftSearch.AddCriteria(Expr.Equals(msFinancialTransaction.FIELDS.Order, ContextID)); var result = proxy.GetObjectsBySearch(giftSearch, msAggregate.FIELDS.ID, 0, 1); if (result.Success && result.ResultValue.TotalRowCount > 0) { targetGift = result.ResultValue.Objects[0].ConvertTo <msGift>(); if (targetGift != null) { hlViewOrder.NavigateUrl = "/donations/ViewGift.aspx?contextID=" + targetGift.ID; } else { // If a gift not found, at least go to the completed Order hlViewOrder.NavigateUrl = "/financial/ViewOrder.aspx?contextID=" + targetOrder.ID; } } } }
private void checkEmailExistsGetOrCreatePortalUser(IConciergeAPIService serviceProxy) { //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 ConciergeResult <msPortalUser> result = serviceProxy.SearchAndGetOrCreatePortalUser(tbEmail.Text); //The portal user in the result will be null if the e-mail didn't match anywhere if (result.ResultValue == null) { return; } var portalUser = result.ResultValue.ConvertTo <msPortalUser>(); if (MultiStepWizards.CreateAccount.InitiatedByLeader) { MultiStepWizards.CreateAccount.InitiatedByLeader = false; GoTo(string.Format("~/membership/Join.aspx?entityID={0}", portalUser.Owner)); } else { GoTo( string.Format( "~/profile/EmailLoginInformation.aspx?contextID={0}", portalUser.ID)); } }
private void loginWithToken() { string tokenString = Request.Form["Token"]; if (string.IsNullOrWhiteSpace(tokenString)) { return; } byte[] token = Convert.FromBase64String(tokenString); // Sign the data using the portal's private key. Concierge API will use this to authenticate the // originator of the request byte[] portalTokenSignature = signToken(token); ConciergeResult <LoginResult> result; using (IConciergeAPIService proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { result = proxy.LoginWithToken(token, ConfigurationManager.AppSettings["SigningCertificateId"], portalTokenSignature); } if (result == null || !result.Success) { ResultsMessage.Text += string.Format("<br/><br/>Error: {0}", result == null ? "No Results" : result.FirstErrorMessage); return; } setSession(result.ResultValue); }
protected override void InstantiateCustomFields(IConciergeAPIService proxy) { instantiateEditFields(proxy); instantiateViewFields(proxy); }
protected void SaveAndGoToNextStep() { using (IConciergeAPIService proxy = GetConciegeAPIProxy()) { targetCompetitionEntry = proxy.Save(targetCompetitionEntry).ResultValue.ConvertTo <msCompetitionEntry>(); // clear cached info as certain info may change targetCompetition.ClearCompetitionEntryInformation(); if (MultiStepWizards.EnterCompetition.EntryFee != null) { GoToOrderForm(); return; } // send out the confirmation proxy.SendTransactionalEmail( targetCompetition.ConfirmationEmail ?? EmailTemplates.Awards.CompetitionEntrySubmissionConfirmation, targetCompetitionEntry.ID, null); } QueueBannerMessage(string.Format("Competition Entry #{0} was created successfully.", targetCompetitionEntry.LocalID)); GoHome(); }
protected void determineContextAndSendEmail(IConciergeAPIService serviceProxy) { targetPortalUser = serviceProxy.Get(ContextID).ResultValue.ConvertTo <msPortalUser>(); //Send the forgotten password email serviceProxy.SendForgottenPortalPasswordEmail(targetPortalUser.Name, CompleteUrl); }
protected override void InitializePage() { base.InitializePage(); using (IConciergeAPIService proxy = GetServiceAPIProxy()) { loadDataFromConcierge(proxy); trPostsPendingApproval.Visible = isModerator(proxy); } lblNoForumsFound.Visible = dtForums.Rows.Count == 0; lblBy.Visible = drLastPostPendingApproval != null; hlPostsPendingApproval.NavigateUrl += TargetDiscussionBoard.ID; if (drLastPostPendingApproval != null) { hlLastPost.Text = Convert.ToString(drLastPostPendingApproval["DiscussionPost.Name"]); hlLastPost.NavigateUrl += drLastPostPendingApproval["DiscussionPost"]; lblLastPostPostedBy.Text = Convert.ToString(drLastPostPendingApproval["DiscussionPost.PostedBy.Name"]); lblLastPostDate.Text = FormatDate(drLastPostPendingApproval["DiscussionPost.CreatedDate"]); } rptForums.DataSource = dtForums; rptForums.DataBind(); PageTitleExtension.Text = string.Format("{0} Discussion Board", TargetDiscussionBoard.Name); }
protected void btnSave_Click(object sender, EventArgs e) { if (!IsValid) { return; } unbindObjectFromPage(); targetObject = SaveObject(targetObject).ConvertTo <msOrganization>(); if (targetObject.ID == CurrentEntity.ID) { ConciergeAPI.CurrentEntity = targetObject; } 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."); GoHome(); }
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."); }
private void buildSearchManifest(IConciergeAPIService proxy) { if (MultiStepWizards.SearchJobPostings.SearchManifest == null) { MultiStepWizards.SearchJobPostings.SearchManifest = proxy.DescribeSearch(msJobPosting.CLASS_NAME, null).ResultValue; } ; }