protected override void InitializePage() { base.InitializePage(); MultiStepWizards.PlaceAnOrder.InitializeShoppingCart(); int pn; if (int.TryParse(Request.QueryString["pn"], out pn)) { PageNumber = pn; } else { PageNumber = 0; } var currentCategory = SessionManager.Get <string>(CurrentCategoryCacheKey); if (currentCategory != ContextID) { LoadFresh(); SessionManager.Set(CurrentCategoryCacheKey, ContextID); } else { Bind(); } // MS-1634 if (CurrentEntity != null && MultiStepWizards.PlaceAnOrder.ShoppingCart != null && (MultiStepWizards.PlaceAnOrder.ShoppingCart.BillTo == null || MultiStepWizards.PlaceAnOrder.ShoppingCart.ShipTo == null)) { MultiStepWizards.PlaceAnOrder.ShoppingCart.BillTo = MultiStepWizards.PlaceAnOrder.ShoppingCart.ShipTo = CurrentEntity.ID; using (var proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { PreProcessOrder(proxy); } } hlCategory.Visible = false; if (TargetCategory != null) { hlCategory.Text = string.Format("{0}", TargetCategory.Name); hlCategory.NavigateUrl = string.Format("~/onlinestorefront/BrowseMerchandise.aspx?contextID={0}", TargetCategory.ID); hlCategory.Visible = true; } if (Categories.Count > 0) { blCategories.DataSource = Categories; blCategories.DataBind(); } else { phCategories.Visible = false; } BindRecentItems(); }
/// <summary> /// Demonstrates how to retrieve Membership information based on a provided Individual ID /// Also demonstrates howto use the MemberSuite Search Object /// For more information, please see https://help.production.membersuite.com/hc/en-us/articles/115001903246-Search-in-MemberSuite /// </summary> private static void SearchMembershipRecords() { using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { // you will need to provide a valid Individual ID for to get this to work string individualID = "cbc968d7-0006-c479-1a71-0b3b91980e7a"; var s = new Search("Membership"); s.AddOutputColumn("Status"); s.AddOutputColumn("Name"); s.AddOutputColumn("ReceivesMemberBenefits"); s.AddCriteria(Expr.Equals("Individual.Id", individualID)); var result = api.ExecuteSearch(s, 0, 0); if (result.Success && result.ResultValue.Table.Rows.Count > 0) { Console.WriteLine(string.Format("Name = {0}, ReceivesMemberBenefits = {1}, Status = {2}", result.ResultValue.Table.Rows[0]["Name"], result.ResultValue.Table.Rows[0]["ReceivesMemberBenefits"], result.ResultValue.Table.Rows[0]["Status"])); } else { Console.WriteLine("Fail"); } } }
/// <summary> /// Demonstrates how to either get PortalUser information for a provided EmailAddress or create a PortalUser account if one doesn't exist /// 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 /// </summary> /// <param name="emailAddress"></param> private static void FindOrCreatePortalUser(string emailAddress) { if (!string.IsNullOrWhiteSpace(emailAddress)) { using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { var result = api.SearchAndGetOrCreatePortalUser(emailAddress); //The portal user in the result will be null if the e-mail didn't match anywhere if (result.ResultValue != null) { var portalUser = result.ResultValue.ConvertTo <msPortalUser>(); Console.WriteLine(string.Format("PortalUser FirstName {0}, PortalUser LastName {1}, PortalUser EmailAddress {2}, PortalUser CreatedDate", portalUser.FirstName, portalUser.LastName, portalUser.EmailAddress, portalUser.CreatedDate)); } else { Console.WriteLine("The email address does not match any Portal User, Individual or Organization"); } } } else { Console.WriteLine("Email Address is empty"); } }
/// <summary> /// Demonstrates updating a Custom Object record and Inserting a new one /// For more information, please see... /// https://help.production.membersuite.com/hc/en-us/articles/115002960103-System-Overview-Configuration-How-To-Create-a-Custom-Object /// https://help.production.membersuite.com/hc/en-us/articles/115002985646-System-Overview-Configuration-Reference-Create-a-Custom-Object-Field-Descriptions /// https://help.production.membersuite.com/hc/en-us/articles/115002985666-System-Overview-Configuration-Custom-Objects /// https://help.production.membersuite.com/hc/en-us/articles/115002985586-System-Overview-Configuration-How-To-Edit-a-Custom-Object /// https://help.production.membersuite.com/hc/en-us/articles/115002986266-System-Overview-Configuration-How-To-Delete-a-Custom-Object /// </summary> private static void UpdateCustomObjects() { using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { var cusObjSearch = new Search("FakeCustomObject__c"); //You'll need to create your own objects for this to work cusObjSearch.AddCriteria(Expr.Equals("Owner.LocalID", 101292)); //In this example, the FakeCustomObject derives from the Individual Object. So we are using the Owner.Local to query the Individual's LocalID and get back a specific FakeCustomObject record var cusObjResult = api.GetObjectBySearch(cusObjSearch, null); if (cusObjResult.ResultValue != null) //Update existing record { var mso = new MemberSuiteObject(); mso.Fields["CompanyName__c"] = "TestCompany4"; mso.Fields["Description__c"] = "This is a test"; mso.Fields["Website__c"] = "www.test.com"; mso.Fields["Name"] = "test Trans"; mso.Fields["Owner"] = cusObjResult.ResultValue; var saveResult = api.Save(mso); } else //Insert new record { var meta = api.DescribeObject("FakeCustomObject__c").ResultValue; var instance = MemberSuiteObject.FromClassMetadata(meta).ConvertTo <msCustomObjectInstance>(); instance.Owner = cusObjResult.ResultValue.Fields["ID"].ToString(); instance.Fields["CompanyName__c"] = "TestCompany4"; instance.Fields["Description__c"] = "This is a test"; instance.Fields["Website__c"] = "www.test.com"; instance.Fields["Name"] = "test Trans"; var insertResult = api.Save(instance); } } }
protected void rptRecentItems_ItemCommand(object sender, RepeaterCommandEventArgs e) { if (e.Item == null) { return; } var selectedProduct = MultiStepWizards.PlaceAnOrder.RecentlyAddedItems[e.Item.ItemIndex]; var lineItem = MultiStepWizards.PlaceAnOrder.ShoppingCart.LineItems.FirstOrDefault(x => x.Product == selectedProduct["ID"].ToString()); //If the line item is null it has been removed by editing the cart so remove it from the recent item list if (lineItem == null) { MultiStepWizards.PlaceAnOrder.RecentlyAddedItems.Remove(selectedProduct); return; } if (lineItem.Quantity > 1) { lineItem.Quantity--; } else { MultiStepWizards.PlaceAnOrder.ShoppingCart.LineItems.Remove(lineItem); using (var proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { PreProcessOrder(proxy); } } MultiStepWizards.PlaceAnOrder.RecentlyAddedItems.Remove(selectedProduct); BindRecentItems(); }
protected void gvShoppingCart_RowDeleting(object sender, GridViewDeleteEventArgs e) { using (IConciergeAPIService proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { loadDataFromConcierge(proxy); } }
/// <summary> /// Demonstrates how to retrieve Membership information based on a provided First and Last Name /// For more information, please see https://help.production.membersuite.com/hc/en-us/articles/115001903246-Search-in-MemberSuite /// </summary> private static void SearchMembershipRecords2() { string _userChapter = string.Empty; string _userLocalId = string.Empty; string _userName = string.Empty; string _status = string.Empty; using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { Search chapSearch = new Search(msMembership.CLASS_NAME); chapSearch.AddOutputColumn("Membership.PrimaryChapter"); chapSearch.AddOutputColumn("PrimaryChapter.Name"); chapSearch.AddOutputColumn("LocalID"); chapSearch.AddOutputColumn("Name"); chapSearch.AddOutputColumn("Status.Name"); chapSearch.AddCriteria(Expr.Equals("Name", "TestFirstName TestLastName")); var chapResult = api.ExecuteSearch(chapSearch, 0, null); if (chapResult.Success) { if (chapResult.Errors.Count < 0 || chapResult.ResultValue.Table.Rows.Count > 0) { _userChapter = chapResult.ResultValue.Table.Rows[0]["PrimaryChapter.Name"].ToString(); _userLocalId = chapResult.ResultValue.Table.Rows[0]["LocalID"].ToString(); _userName = chapResult.ResultValue.Table.Rows[0]["Name"].ToString(); _status = chapResult.ResultValue.Table.Rows[0]["Status.Name"].ToString(); } } } Console.WriteLine(string.Format("UserChapter= {0}, UserID= {1}, UserName= {2}, Status= {3}", _userChapter, _userLocalId, _userName, _status)); }
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; } }
public static MemberSuiteObject LoadObjectFromAPI(string id) { using (var proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { return(proxy.LoadObjectFromAPI(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()) { 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; } } } }
/// <summary> /// Executes multiple searches against the Concierge API /// </summary> /// <param name="searchesToRun">List of searches to run.</param> /// <param name="startRecord">The start record.</param> /// <param name="maximumNumberOfRecordsToReturn">The maximum number of records to return.</param> /// <returns></returns> public static List <SearchResult> GetMultipleSearchResults(List <Search> searchesToRun, int startRecord, int?maximumNumberOfRecordsToReturn) { using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { return(api.GetMultipleSearchResults(searchesToRun, startRecord, maximumNumberOfRecordsToReturn)); } }
/// <summary> /// Executes a search against the Concierge API /// </summary> /// <param name="searchToRun">The search to run.</param> /// <param name="startRecord">The start record.</param> /// <param name="maximumNumberOfRecordsToReturn">The maximum number of records to return.</param> /// <returns></returns> public static SearchResult GetSearchResult(Search searchToRun, int startRecord, int?maximumNumberOfRecordsToReturn) { using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { return(api.GetSearchResult(searchToRun, startRecord, maximumNumberOfRecordsToReturn)); } }
/// <summary> /// Demonstrates reading custom field(s) that are tied to a Built-In Membersuite object /// For more information, please see... /// https://help.production.membersuite.com/hc/en-us/articles/115002960103-System-Overview-Configuration-How-To-Create-a-Custom-Object /// https://help.production.membersuite.com/hc/en-us/articles/115002985646-System-Overview-Configuration-Reference-Create-a-Custom-Object-Field-Descriptions /// https://help.production.membersuite.com/hc/en-us/articles/115002985666-System-Overview-Configuration-Custom-Objects /// https://help.production.membersuite.com/hc/en-us/articles/115002985586-System-Overview-Configuration-How-To-Edit-a-Custom-Object /// https://help.production.membersuite.com/hc/en-us/articles/115002986266-System-Overview-Configuration-How-To-Delete-a-Custom-Object /// </summary> private static void GetCustomObjects() { using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { var search = new Search { Type = "EventRegistration" }; search.AddOutputColumn("Event.Name"); search.AddOutputColumn("Name"); search.AddOutputColumn("CustomObject1__c"); //this object derives from the EventRegistration Object search.AddOutputColumn("CustomObject2__c"); //this object derives from the EventRegistration Object search.AddOutputColumn("Individual.FirstName"); search.AddOutputColumn("Individual.LastName"); search.AddOutputColumn("Individual.EmailAddress"); search.AddOutputColumn("Individual.CustomObject1__c"); //this object derives from the Individual Object search.AddOutputColumn("Order.BalanceDue"); var localID = 10009; //this represents the localID for the eventRegistration. You'll need to input a real ID for this to work search.AddCriteria(Expr.Equals("LocalID", localID)); var result = api.ExecuteSearch(search, 0, 0); if (result.Success && result.ResultValue.Table.Rows.Count > 0) { foreach (DataRow row in result.ResultValue.Table.Rows) { Console.WriteLine(string.Format("EventName = {0}, Name = {1}, EventReg CustomObject1__c = {2}, EventReg CustomObject2 = {3}, FirstName = {4}, LastName = {5}, EmailAddress = {6}, Individual CustomObject1 = {7}, BalanceDue = {8}", row["Event.Name"], row["Name"], row["CustomObject1__c"], row["CustomObject2__c"], row["Individual.FirstName"], row["Individual.LastName"], row["Individual.EmailAddress"], row["Individual.CustomObject1__c"], row["Order.BalanceDue"])); } } } }
public static bool CanAccessFile(string fileID) { // we'll do a search here to avoid downloading the file Search s = new Search(msFile.CLASS_NAME); s.AddOutputColumn("FileFolder"); s.AddOutputColumn("FileCabinet"); s.AddCriteria(Expr.Equals("ID", fileID)); SearchResult sr; using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) sr = api.GetSearchResult(s, 0, 1); if (sr.TotalRowCount == 0) { return(false); } DataRow dr = sr.Table.Rows[0]; string folderID = Convert.ToString(dr["FileFolder"]); string fileCabinet = Convert.ToString(dr["FileCabinet"]); // now, can I access the folder? if (string.IsNullOrWhiteSpace(fileCabinet) || string.IsNullOrWhiteSpace(folderID)) { return(false); } return(CanAccess(fileCabinet, folderID, ConciergeAPI.CurrentEntity.ID)); }
public static bool HasSessions(string eventId) { var key = string.Format("EventLogic::HasSessions_{0}", eventId); var returnValue = SessionManager.Get <bool?>(key, () => { if (string.IsNullOrEmpty(eventId)) { return(false); } var search = new Search(msSession.CLASS_NAME); search.AddCriteria(Expr.Equals("ParentEvent", eventId)); search.AddCriteria(Expr.Equals("VisibleInPortal", true)); using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { var result = api.ExecuteSearch(search, 0, 1); return(result != null && result.ResultValue != null && result.ResultValue.TotalRowCount > 0); } }); return(returnValue.HasValue ? returnValue.Value : false); }
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 void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string contextID = Request["contextID"]; if (string.IsNullOrEmpty(contextID)) { contextID = "2537d8c3-0006-ce10-841f-0b371e6de173"; } lRecordID.Text = contextID; if (contextID == null) { return; } var proxy = ConciergeAPIProxyGenerator.GenerateProxy(); var mso = proxy.Get(contextID).ResultValue; if (mso == null) { lRecordName.Text = "Error loading record"; return; } lRecordName.Text = mso.SafeGetValue <string>("Name"); // every object has a name lRecordType.Text = mso.ClassType; rptFields.DataSource = mso.Fields; rptFields.DataBind(); } }
public static msPortalPageLayoutContainer GetAppropriatePageLayout(this MemberSuiteObject mso) { var typeId = mso.SafeGetValue <string>("Type"); var objectType = mso.ClassType; if (string.IsNullOrWhiteSpace(typeId)) { return(GetDefaultPageLayout(objectType)); } var key = string.Format("GetAppropriatePageLayout::{0}_{1}", objectType, typeId); return(SessionManager.Get(key, () => { // let's get the type using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { var msoType = api.Get(typeId).ResultValue; var layoutId = msoType.SafeGetValue <string>("PortalPageLayout"); if (string.IsNullOrWhiteSpace(layoutId)) { return GetDefaultPageLayout(objectType); } var pageLayout = api.Get(layoutId).ResultValue.ConvertTo <msPortalPageLayoutContainer>(); return pageLayout; } })); }
public static T LoadObjectFromAPI <T>(string id) where T : msAggregate { using (var proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { return(proxy.LoadObjectFromAPI(id).ConvertTo <T>()); } }
public static MemberSuiteObject SaveObject(MemberSuiteObject msoObjectToSave) { using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { var result = api.Save(msoObjectToSave); return(result.ResultValue); } }
private void Bind() { BindMerchandises(); using (var proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { LoadDataFromConcierge(proxy); } }
/// <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()) { loadDataFromConcierge(proxy); } }
/// <summary> /// Initializes the page. /// </summary> /// <remarks>This method runs on the first load of the page, and does NOT /// run on postbacks. If you want to run a method on PostBacks, override the /// Page_Load event</remarks> protected override void InitializePage() { base.InitializePage(); //MS-1634 if (CurrentEntity != null && MultiStepWizards.PlaceAnOrder.ShoppingCart != null && (MultiStepWizards.PlaceAnOrder.ShoppingCart.BillTo == null || MultiStepWizards.PlaceAnOrder.ShoppingCart.ShipTo == null)) { MultiStepWizards.PlaceAnOrder.ShoppingCart.BillTo = MultiStepWizards.PlaceAnOrder.ShoppingCart.ShipTo = CurrentEntity.ID; using (IConciergeAPIService proxy = ConciergeAPIProxyGenerator.GenerateProxy()) { preProcessOrder(proxy); } } hlCategory.Visible = false; if (targetCategory != null) { hlAllMerchandise.Text += " >"; hlCategory.Text = string.Format("{0}", targetCategory["Name"]); hlCategory.NavigateUrl = string.Format("~/onlinestorefront/BrowseMerchandise.aspx?contextID={0}", targetCategory["ID"]); hlCategory.Visible = true; } imgMerchandise.ImageUrl = GetImageUrl(Convert.ToString(targetMerchandise["Image"])); blCategories.DataSource = dtCategories; blCategories.DataBind(); bindRecentItems(); hlCartSubTotal.Text = string.Format("Cart Subtotal: {0:C}", preProcessedOrderPacket.FinalizedOrder.ConvertTo <msOrder>().LineItems.Sum( x => x.UnitPrice * x.Quantity)); litPrice.Text = targetMerchandise["DisplayPriceAs"] != DBNull.Value && string.IsNullOrWhiteSpace(targetMerchandise["DisplayPriceAs"].ToString()) ? targetMerchandise["DisplayPriceAs"].ToString() : string.Format("{0:C}", (decimal)targetMerchandise["Price"]); // MS-4786 if (describedProduct == null) { return; } var describedPrice = string.IsNullOrWhiteSpace(describedProduct.DisplayPriceAs) ? string.Format("{0:C}", describedProduct.Price) : describedProduct.DisplayPriceAs; litPrice.Text = describedProduct.Price < (decimal)targetMerchandise["Price"] ? string.Format("<strike>{0}</strike> {1}", litPrice.Text, describedPrice) : describedPrice; }
protected override bool CheckSecurity() { if (!base.CheckSecurity()) { return(false); } using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) return(api.CheckEntitlement(msResumeAccessEntitlement.CLASS_NAME, ConciergeAPI.CurrentEntity.ID, null).ResultValue.IsEntitled); }
public static bool IsInvited(string eventID, string individualID) { Search s = new Search("EventInvitee"); s.AddCriteria(Expr.Equals("Event", eventID)); s.AddCriteria(Expr.Equals("Invitee", individualID)); using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) return(api.GetSearchResult(s, 0, 1).TotalRowCount > 0); }
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)); } }
public override void Run() { /* This demo is designed to show you whether or not an individual is an member is active or not. * Remember the MemberSuite object model as follows: * * Individual -this is a person * | * ----> Membership - a membership record is tied to an individual. A member is an individual (or organization) with a membership record tied to it. * * Fortunately, there's a field on the Individual search called Membership. We can use that to figure out a person's status. Generally, an individual * is a member if they have a membership record with ReceivesMemberBenefits set to true * * Remember you can always see objects/fields by going to the api documentation at http://api.docs.membersuite.com. * * For another (more detailed) example, check out LoginToPortalAndPullMemberInformation sample. */ // 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()) { string msql = "select LocalID,FirstName, LastName, Membership.ReceivesMemberBenefits from Individual order by LastName"; // If I needed to check the membership status of someone whose ID I knew, I would say: // string msql = "select TOP 1 LocalID,FirstName, LastName, Membership.ReceivesMemberBenefits from Individual where ID = '%%Id%%' order by LastName"; var result = api.ExecuteMSQL(msql, 0, null); if (!result.Success) { Console.WriteLine("Search failed: {0}", result.FirstErrorMessage); return; } Console.WriteLine("Search successful: {0} results returned.", result.ResultValue.SearchResult.TotalRowCount); foreach (DataRow row in result.ResultValue.SearchResult.Table.Rows) { Console.WriteLine("#{0} - {1}, {2} - Is this person a member? {3}", row["LocalID"], row["LastName"], row["FirstName"], row["Membership.ReceivesMemberBenefits"]); } } }
public static bool CanAccess(string fileCabinetID, string folderID, string entityID) { // ok, first, let's see what kind of file cabinet it is using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) { var msoFileCabinet = api.Get(fileCabinetID).ResultValue; switch (msoFileCabinet.ClassType) { case msCommitteeFileCabinet.CLASS_NAME: if (CommitteeLogic.IsMember(api, msoFileCabinet.SafeGetValue <string>( msCommitteeFileCabinet.FIELDS.Committee), ConciergeAPI.CurrentEntity.ID)) { return(true); } break; case msSectionFileCabinet.CLASS_NAME: return(CanViewMembershipDocuments(api, msoFileCabinet.SafeGetValue <string>("Section"), entityID)); case msChapterFileCabinet.CLASS_NAME: return(CanViewMembershipDocuments(api, msoFileCabinet.SafeGetValue <string>("Chapter"), entityID)); case msOrganizationalLayerFileCabinet.CLASS_NAME: return(CanViewMembershipDocuments(api, msoFileCabinet.SafeGetValue <string>("OrganizationalLayer"), entityID)); } // ok - now, am I entitled to the file folder? // I'm going to check the folder directly, and then all of the parent folders var entitlements = api.ListEntitlements(ConciergeAPI.CurrentEntity.ID, msFileFolderEntitlement.CLASS_NAME).ResultValue; if (entitlements.Exists(x => x.Context == folderID)) { return(true); } // ok, what about any parent folders? var folderInfo = api.DescribeFolder(folderID).ResultValue; if (folderInfo.ParentFolders != null) { foreach (var pf in folderInfo.ParentFolders) { if (entitlements.Exists(x => x.Context == pf.FolderID)) // if you have access to the parent, you're good { return(true); } } } } return(false); // no access }
private void _populateDigitalLocker() { List <EntitlementReport> report; using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) report = api.ListEntitlements(ConciergeAPI.CurrentEntity.ID, msFileFolderEntitlement.CLASS_NAME). ResultValue; liDigitalLibrary.Visible = report != null && report.Count > 0; }
private void _setupMyReports() { List <EntitlementReport> report; using (var api = ConciergeAPIProxyGenerator.GenerateProxy()) report = api.ListEntitlements(ConciergeAPI.CurrentEntity.ID, msSearchEntitlement.CLASS_NAME). ResultValue; liReports.Visible = report != null && report.Count > 0; }