Beispiel #1
0
        public BaseResponse GetMemberByUsername(string user)
        {
            MembershipLogic target = new MembershipLogic();
            BaseResponse    actual = target.GetMemberByUserName(user);

            return(actual);
        }
Beispiel #2
0
        //public bool Login(string user, string pwd)
        //{
        //    MembershipLogic target = new MembershipLogic();
        //    BaseResponse actual = target.Login(user, pwd, "", "");
        //    return actual != null && actual.TypedResponse != null && actual.TypedResponse.Success;
        //}
        public bool UpdateUsername(string nu, string iu, string ip)
        {
            MembershipLogic target = new MembershipLogic();
            BaseResponse    actual = target.UpdateUsername(nu, iu, ip, debug);

            return(actual != null && actual.TypedResponse != null && actual.TypedResponse.Success);
        }
    protected void btnContinue_Click(object sender, EventArgs e)
    {
        if (!IsValid)
        {
            var tbCardNumber = BillingInfoWidget.FindControl("tbCardNumber") as TextBox;
            if (tbCardNumber != null)
            {
                tbCardNumber.Text = string.Empty;
            }
            return;
        }

        var payment = BillingInfoWidget.GetPaymentInfo();

        targetPayment.PaymentMethod = payment.PaymentMethod;
        // MSIV-330
        targetPayment.Total = targetPayment.LineItems.Sum(x => x.Total);

        processPayment(payment);

        MultiStepWizards.MakePayment.Clear();

        // Clear any cached Membership checks since a payment could trigger a Membership Update.
        MembershipLogic.ClearMemberCaches();

        QueueBannerMessage(string.Format("Your payment for {0:C} has been processed.", targetPayment.Total));

        GoHome();
    }
Beispiel #4
0
        public BaseResponse GetMemberByMemberId(string mbrid)
        {
            MembershipLogic target = new MembershipLogic();

            return(target.GetMemberById(mbrid, true));
            //return actual != null && actual.TypedResponse != null && actual.TypedResponse.Success;
        }
Beispiel #5
0
        public bool UpdatePassword(string nu, string np)
        {
            MembershipLogic target = new MembershipLogic();
            BaseResponse    actual = target.UpdatePassword(nu, np, debug);

            return(actual != null && actual.TypedResponse != null && actual.TypedResponse.Success);
        }
        public BaseResponse UpdateMember(string hashed_memberid,
                                         string salutation, string firstname, string lastname, string suffix,
                                         string professionaltitle, string email, bool optin, string businessname, string address1,
                                         string address2, string address3,
                                         string city, string state, string postalcode, string country,
                                         string phone, string screenname)
        {
            BaseResponse baseResponse = new BaseResponse();

            try
            {
                baseResponse = new MembershipLogic().UpdateMember(Cryptography.DeHash(hashed_memberid, true),
                                                                  salutation, firstname, lastname, suffix,
                                                                  professionaltitle, email, optin, businessname, address1, address2, address3,
                                                                  city, state, postalcode, country,
                                                                  phone, screenname,
                                                                  false);
            }
            catch (Exception ex)
            {
                EventLogger.LogError("MembershipService.UpdateMember",
                                     string.Format("Message: {0} \r\nStackTrace: {1}", ex.Message, ex.StackTrace));
            }
            return(baseResponse);
        }
    protected void ClearAndRedirect()
    {
        MultiStepWizards.RenewMembership.Clear();

        // Clear any cached Membership checks since a Membership Order has just processed.
        MembershipLogic.ClearMemberCaches();

        GoTo(string.Format("~/orders/OrderComplete.aspx?contextID={0}", OrderId));
    }
 public void GetMemberProfile()
 {
     BaseResponse actual = new MembershipLogic().GetMemberProfile(memberid, debug);
     if (actual != null && actual.TypedResponse != null && actual.TypedResponse.Success)
     {
         Assert.AreEqual((actual.TypedResponse as GetMemberResponse).MemberData.FirstName == originalfirstname, true);
     }
     else { Assert.AreEqual(1, 0); };
 }
 public void GetSubscriptionOffers()
 {
     BaseResponse actual = new MembershipLogic().GetSubscriptionOffers(suboffermemberid, debug);
     if (actual != null && actual.TypedResponse != null && actual.TypedResponse.Success)
     {
         Assert.AreEqual((actual.TypedResponse as GetMemberResponse).RenewalOffers == null, false);
     }
     else { Assert.AreEqual(1, 0); };
 }
Beispiel #10
0
        public static msOrderLineItem AddItemToShoppingCart(int qty, DataRow selectedProduct)
        {
            var hasActiveMemberhip = ConciergeAPI.CurrentEntity != null && MembershipLogic.IsActiveMember(ConciergeAPI.CurrentEntity.ID);

            string productID = selectedProduct["ID"].ToString();
            // MS-5819 (Modified 12/18/2014) Use the member price for members when adding items to the online store.
            object  price     = null;
            decimal unitPrice = 0M;

            if (hasActiveMemberhip && selectedProduct.Table.Columns.Contains(msProduct.FIELDS.MemberPrice) && selectedProduct[msProduct.FIELDS.MemberPrice] != DBNull.Value)
            {
                price = selectedProduct[msProduct.FIELDS.MemberPrice];
            }
            else if (selectedProduct[msProduct.FIELDS.Price] != DBNull.Value)
            {
                price = selectedProduct[msProduct.FIELDS.Price];
            }

            if (price != null)
            {
                unitPrice = Convert.ToDecimal(price);
            }
            //Add the line item to the shopping cart
            var lineItem = new msOrderLineItem
            {
                Quantity        = qty,
                Product         = productID,
                UnitPrice       = unitPrice,
                Total           = unitPrice * qty,
                OrderLineItemID = Guid.NewGuid().ToString()
            };

            MultiStepWizards.PlaceAnOrder.ShoppingCart.LineItems.Add(lineItem);

            //Add this as a recently added item
            if (MultiStepWizards.PlaceAnOrder.RecentlyAddedItems == null)
            {
                MultiStepWizards.PlaceAnOrder.RecentlyAddedItems = new List <DataRow>();
            }

            if (MultiStepWizards.PlaceAnOrder.RecentlyAddedItems.Count >= NumberOfRecentItemsToDisplay)
            {
                MultiStepWizards.PlaceAnOrder.RecentlyAddedItems.RemoveAt(0);
            }

            selectedProduct["Quantity"] = 1;
            MultiStepWizards.PlaceAnOrder.RecentlyAddedItems.Add(selectedProduct);
            return(lineItem);
        }
        public BaseResponse GetMemberByUserName(string username)
        {
            BaseResponse baseResponse = new BaseResponse();

            try
            {
                baseResponse = new MembershipLogic().GetMemberByUserName(username);
            }
            catch (Exception ex)
            {
                EventLogger.LogError("MembershipService.GetMemberByUserName",
                                     string.Format("Message: {0} \r\nStackTrace: {1}", ex.Message, ex.StackTrace));
            }
            return(baseResponse);
        }
Beispiel #12
0
        public BaseResponse UpdateUserName(string newusername, string oldusername, string hashed_password)
        {
            BaseResponse baseResponse = new BaseResponse();

            try
            {
                baseResponse = new MembershipLogic().UpdateUsername(newusername, oldusername, Cryptography.DeHash(hashed_password, true), false);
            }
            catch (Exception ex)
            {
                EventLogger.LogError("SecureServices.UpdateUsername",
                                     string.Format("Message: {0} \r\nStackTrace: {1}", ex.Message, ex.StackTrace));
            }
            return(baseResponse);
        }
        public BaseResponse GetMemberByCusId(string hashed_cusid)
        {
            bool         debug        = false;
            BaseResponse baseResponse = new BaseResponse();

            try
            {
                baseResponse = new MembershipLogic().GetMemberById(Cryptography.DeHash(hashed_cusid, true), false);
            }
            catch (Exception ex)
            {
                EventLogger.LogError("MembershipService.GetMemberByCusId",
                                     string.Format("Message: {0} \r\nStackTrace: {1}", ex.Message, ex.StackTrace));
            }
            return(baseResponse);
        }
        public BaseResponse CreateReferral(string enccusid, string membername, string memeberemail, string keycode, string pubcode, string friendname, string emailaddress, bool ccmember)
        {
            BaseResponse baseResponse = new BaseResponse();

            try
            {
                string cusid = Cryptography.DecryptData(enccusid);
                baseResponse = new MembershipLogic().CreateReferral(cusid, membername, memeberemail, keycode, pubcode, friendname, emailaddress, ccmember);
            }
            catch (Exception ex)
            {
                EventLogger.LogError("MembershipService.CreateReferral",
                                     string.Format("Message: {0} \r\nStackTrace: {1}", ex.Message, ex.StackTrace));
            }
            return(baseResponse);
        }
 public void SaveMemberProfile()
 {
     BaseResponse original = new MembershipLogic().GetMemberByMemberId(memberid);
     BaseResponse actual = new MembershipLogic().UpdateMemberProfile(memberid,
         updatedsalutation, updatedfirstname, updatedmiddleinitial, updatedlastname, updatedsuffix,
         updatedprofessionaltitle, updatedemail, updatedoptin, updatedbusinessname, updatedaddress1, updatedaddress2, updatedaddress3,
         updatedcity, updatedstate, updatedpostalcode, updatedcountry,
         updatedphone, updatedfax, updatedaltcity,
         debug);
     BaseResponse updated = new MembershipLogic().GetMemberByMemberId(memberid);
     coreTests.MyTestCleanup();
     if (actual != null && actual.TypedResponse != null && actual.TypedResponse.Success)
     {
         Assert.AreEqual((actual.TypedResponse as UpdateMemberResponse).MemberUpdated, true);
         Assert.AreEqual((original.TypedResponse as GetMemberResponse).MemberData.FirstName ==
                         (updated.TypedResponse as GetMemberResponse).MemberData.FirstName, false);
     }
     else { Assert.AreEqual(1, 0); };
 }
Beispiel #16
0
    protected override bool CheckSecurity()
    {
        if (!base.CheckSecurity())
        {
            return(false);
        }

        if (targetLink.IsPublic)
        {
            return(true);
        }

        if (CurrentUser == null)
        {
            return(false);
        }

        return(!targetLink.MembersOnly || MembershipLogic.IsActiveMember());
    }
Beispiel #17
0
        public void MembershipLogic()
        {
            Mock <IUnitOfWork>           uow  = new Mock <IUnitOfWork>();
            Mock <IMembershipRepository> repo = new Mock <IMembershipRepository>();

            MembershipLogic logic = new MembershipLogic(uow.Object, repo.Object);

            var membership = new Membership();
            var sequence   = new MockSequence();

            repo.InSequence(sequence).Setup(r => r.Create(membership));
            repo.InSequence(sequence).Setup(r => r.Update(membership));
            repo.InSequence(sequence).Setup(r => r.Get(membership.Id));
            repo.InSequence(sequence).Setup(r => r.Delete(membership.Id));
            logic.Create(membership);
            logic.Update(membership);
            logic.Get(membership.Id);
            logic.Delete(membership.Id);
        }
Beispiel #18
0
    private bool isMembershipDirectoryAvailable()
    {
        if (!PortalConfiguration.Current.MembershipDirectoryEnabled)
        {
            return(false);
        }

        if (PortalConfiguration.Current.MembershipDirectoryIsPublic)
        {
            return(true);
        }

        //If the directory is enabled and not restricted to members it's available and no need to check membership status
        if (!PortalConfiguration.Current.MembershipDirectoryForMembersOnly)
        {
            return(true);
        }

        //Directory is for members only
        return(MembershipLogic.IsActiveMember());
    }
Beispiel #19
0
    protected override bool CheckSecurity()
    {
        // MS-2142 - Owners should ALWAYS be able to view postings
        if (targetJobPosting != null && ConciergeAPI.CurrentEntity != null &&
            targetJobPosting.Owner == ConciergeAPI.CurrentEntity.ID)
        {
            return(true);
        }

        switch (PortalConfiguration.Current.JobPostingAccessMode)
        {
        case JobPostingAccess.PublicAccess:
            return(true);

        case JobPostingAccess.AnyRegisteredUser:
            return(ConciergeAPI.CurrentEntity != null);

        case JobPostingAccess.MembersOnly:
            return(MembershipLogic.IsActiveMember());
        }

        return(false);
    }
Beispiel #20
0
    protected override void loadDataFromConcierge(IConciergeAPIService proxy)
    {
        base.loadDataFromConcierge(proxy);

        Search s = new Search("DiscussionContents");

        s.AddOutputColumn("ID");
        s.AddOutputColumn("Name");
        s.AddOutputColumn("ContentType");
        s.AddOutputColumn("DiscussionPost_Count");
        s.AddOutputColumn("LastDiscussionPost");
        s.AddOutputColumn("LastDiscussionPost.Topic");
        s.AddOutputColumn("LastDiscussionPost.Name");
        s.AddOutputColumn("LastDiscussionPost.CreatedDate");
        s.AddOutputColumn("LastDiscussionPost.PostedBy.Name");
        s.AddOutputColumn("DiscussionBoard");
        s.AddOutputColumn("Forum");
        s.AddOutputColumn("DiscussionTopic");

        SearchOperationGroup sogActive = new SearchOperationGroup()
        {
            FieldName = "Forum.IsActive",
            GroupType = SearchOperationGroupType.Or
        };

        sogActive.Criteria.Add(Expr.IsBlank("Forum"));
        sogActive.Criteria.Add(Expr.Equals("Forum.IsActive", 1));

        s.AddCriteria(sogActive);

        if (!MembershipLogic.IsActiveMember())
        {
            SearchOperationGroup sogMembersOnly = new SearchOperationGroup()
            {
                FieldName = "Forum.MembersOnly",
                GroupType = SearchOperationGroupType.Or
            };
            sogMembersOnly.Criteria.Add(Expr.IsBlank("Forum"));
            sogMembersOnly.Criteria.Add(Expr.Equals("Forum.MembersOnly", false));
        }

        if (TargetDiscussionBoard != null)
        {
            s.AddCriteria(Expr.Equals("DiscussionBoard", TargetDiscussionBoard.ID));
        }

        if (targetForum != null)
        {
            s.AddCriteria(Expr.Equals("Forum", targetForum.ID));
        }

        if (targetDiscussionTopic != null)
        {
            s.AddCriteria(Expr.Equals("DiscussionTopic", targetDiscussionTopic.ID));
        }

        if (!string.IsNullOrWhiteSpace(Keywords))
        {
            s.AddCriteria(Expr.Contains("Keywords", Keywords));
        }

        SearchResult sr = proxy.GetSearchResult(s, PageStart, PAGE_SIZE);

        dtSearchResults = sr.Table;

        for (int i = 0; i < dtSearchResults.Columns.Count; i++)
        {
            dtSearchResults.Columns[i].ColumnName = dtSearchResults.Columns[i].ColumnName.Replace(".", "_");
        }

        SetCurrentPageFromResults(sr, hlFirstPage, hlPrevPage, hlNextPage, lNumPages, null, null,
                                  null, lCurrentPage);
    }
Beispiel #21
0
    protected override bool CheckSecurity()
    {
        if (!base.CheckSecurity())
        {
            return(false);
        }

        if (targetForum != null && (!targetForum.IsActive || (targetForum.MembersOnly && !MembershipLogic.IsActiveMember())))
        {
            return(false);
        }

        return(true);
    }
    private DataTable getPortalLinkTable()
    {
        DataTable dt = SessionManager.Get <DataTable>("PortalLinks");

        if (dt != null)
        {
            return(dt);
        }

        Search s = new Search("PortalLink");

        s.AddCriteria(Expr.Equals("IsActive", true));
        s.AddSortColumn("DisplayOrder");
        s.AddSortColumn("Name");
        s.AddOutputColumn("Name");
        s.AddOutputColumn("Type");
        s.AddOutputColumn("Event");
        s.AddOutputColumn("Competition");
        s.AddOutputColumn("Url");
        s.AddOutputColumn("ExpirationDate");
        s.AddOutputColumn("IsPublic");
        s.AddOutputColumn("MembersOnly");

        // Log in the anonymous user
        using (var serviceProxy = ConciergeAPIProxyGenerator.GenerateProxy())
        {
            dt = serviceProxy.GetSearchResult(s, 0, null).Table;

            //Do not logout because that will logout anyone doing impersonation resulting in a session expired error
            //serviceProxy.Logout();

            // remove expired links
            for (int i = dt.Rows.Count - 1; i >= 0; i--)
            {
                DataRow dr = dt.Rows[i];

                // ok, first, is it private?
                bool isPublicLink  = dr["IsPublic"] != DBNull.Value ? (bool)dr["IsPublic"] : false;
                bool isMembersOnly = dr["MembersOnly"] != DBNull.Value ? (bool)dr["MembersOnly"] : false;
                if (ConciergeAPI.CurrentEntity == null)
                {
                    // if its NOT a public link, or it's a Members Only link, then remove it
                    if (!isPublicLink || isMembersOnly)
                    {
                        // remove it
                        dt.Rows.RemoveAt(i);
                        continue;
                    }
                }
                else if (isMembersOnly)
                {
                    if (!MembershipLogic.IsActiveMember()) // not a member
                    {
                        // remove it
                        dt.Rows.RemoveAt(i);
                        continue;
                    }
                }

                if (Convert.IsDBNull(dr["ExpirationDate"])) // good
                {
                    continue;
                }
                DateTime dtExpiration = (DateTime)dr["ExpirationDate"];
                if (dtExpiration < DateTime.UtcNow)
                {
                    dt.Rows.RemoveAt(i); // it's expired
                }
            }
        }

        SessionManager.Set("PortalLinks", dt);

        return(dt);
    }
Beispiel #23
0
    public override void GenerateSearchesToBeRun(List <Search> searchesToRun)
    {
        base.GenerateSearchesToBeRun(searchesToRun);

        //PS-760
        /*Lets get membership organizations already used by this entity*/

        var exclude = new List <string>();
        // MS-5444
        const string renewalRangeColumn   = "MembershipOrganization.NumberOfDaysPriorToExpirationToPromptForRenewal";
        const string expirationDateColumn = "ExpirationDate";

        using (var proxy = ConciergeAPIProxyGenerator.GenerateProxy())
        {
            var s = new Search(msMembership.CLASS_NAME);
            var portalPermissions = new SearchOperationGroup {
                GroupType = SearchOperationGroupType.Or
            };
            portalPermissions.Criteria.Add(Expr.Equals("MembershipOrganization.MembersCanJoinThroughThePortal", true));
            portalPermissions.Criteria.Add(Expr.Equals("MembershipOrganization.MembersCanRenewThroughThePortal", true));
            s.AddCriteria(portalPermissions);
            s.AddOutputColumn("MembershipOrganization");
            // MS-5444
            s.AddOutputColumn(renewalRangeColumn);
            s.AddOutputColumn(expirationDateColumn);
            s.AddOutputColumn("Product.Name");
            s.AddOutputColumn("Type.Name");
            var tGroup = new SearchOperationGroup {
                FieldName = "TerminationDate"
            };
            tGroup.Criteria.Add(Expr.Equals("TerminationDate", null));
            tGroup.Criteria.Add(Expr.IsGreaterThan("TerminationDate", DateTime.Now));
            tGroup.GroupType = SearchOperationGroupType.Or;

            s.Criteria.Add(tGroup);
            s.Criteria.Add(Expr.Equals("ReceivesMemberBenefits", true));
            s.AddCriteria(Expr.Equals("Owner", ConciergeAPI.CurrentEntity.ID));

            var members = proxy.GetSearchResult(s, 0, null);
            if (members.TotalRowCount > 0)
            {
                foreach (DataRow dr in members.Table.Rows)
                {
                    if (dr["MembershipOrganization"] == DBNull.Value)
                    {
                        continue;
                    }

                    var id = Convert.ToString(dr["MembershipOrganization"]);
                    if (string.IsNullOrEmpty(id) || exclude.Contains(id))
                    {
                        continue;
                    }

                    // MS-5444 Exclude current membership organization from renewal list only if member's expiration date is not within a renewal range.
                    var suppressRenew = true;
                    if (dr.Table.Columns.Contains(renewalRangeColumn) && dr[renewalRangeColumn] != DBNull.Value &&
                        dr.Table.Columns.Contains(expirationDateColumn) && dr[expirationDateColumn] != DBNull.Value)
                    {
                        var renewalRange   = Convert.ToInt32(dr[renewalRangeColumn]);
                        var expirationDate = Convert.ToDateTime(dr[expirationDateColumn]);
                        suppressRenew = DateTime.Now.AddDays(renewalRange) < expirationDate;
                    }

                    if (suppressRenew)
                    {
                        exclude.Add(id);
                    }

                    _exitingMembeships.Add(Convert.ToString(dr["ID"]), Convert.ToString(dr["Product.Name"]));

                    _existingMemOrgs.Add(id);
                }
            }
        }

        // now, we need the default membership organization
        var sDefaultMemOrg = new Search {
            Type = msMembershipOrganization.CLASS_NAME, ID = "MembershipOrganization"
        };

        //PS-760

        sDefaultMemOrg.AddCriteria(Expr.Equals("IsActive", true));
        foreach (var id in exclude)
        {
            sDefaultMemOrg.AddCriteria(Expr.DoesNotEqual("ID", id));
        }

        sDefaultMemOrg.AddOutputColumn("Name");
        sDefaultMemOrg.AddOutputColumn(msMembershipOrganization.FIELDS.MembersCanJoinThroughThePortal);
        sDefaultMemOrg.AddOutputColumn(msMembershipOrganization.FIELDS.MembersCanRenewThroughThePortal);
        sDefaultMemOrg.AddOutputColumn(msMembershipOrganization.FIELDS.NumberOfDaysPriorToExpirationToPromptForRenewal);
        searchesToRun.Add(sDefaultMemOrg);



        var terminationGroup = new SearchOperationGroup {
            FieldName = "Membership.TerminationDate"
        };

        terminationGroup.Criteria.Add(Expr.Equals("Membership.TerminationDate", null));
        terminationGroup.Criteria.Add(Expr.IsGreaterThan("Membership.TerminationDate", DateTime.Now));
        terminationGroup.GroupType = SearchOperationGroupType.Or;

        //Chapter Membership
        Search sChapterMembership = new Search {
            Type = msChapterMembership.CLASS_NAME, ID = "ChapterMembership"
        };

        sChapterMembership.AddOutputColumn("Chapter.ID");
        sChapterMembership.AddOutputColumn("Chapter.Name");
        sChapterMembership.AddSortColumn("Chapter.Name");
        sChapterMembership.AddCriteria(Expr.Equals("Membership.Owner.ID", ConciergeAPI.CurrentEntity.ID));
        sChapterMembership.AddCriteria(Expr.Equals("IsCurrent", true));
        sChapterMembership.AddCriteria(terminationGroup);
        searchesToRun.Add(sChapterMembership);


        var sOrganizationalLayerMembership = MembershipLogic.GetSearchForOrganizationalLayerMemberships();

        sOrganizationalLayerMembership.AddCriteria(terminationGroup);
        searchesToRun.Add(sOrganizationalLayerMembership);

        //Section Membership
        Search sSectionMembership = new Search {
            Type = msSectionMembership.CLASS_NAME, ID = "SectionMembership"
        };

        sSectionMembership.AddOutputColumn("Section.ID");
        sSectionMembership.AddOutputColumn("Section.Name");
        sSectionMembership.AddSortColumn("Section.Name");
        sSectionMembership.AddCriteria(Expr.Equals("Membership.Owner.ID", ConciergeAPI.CurrentEntity.ID));
        sSectionMembership.AddCriteria(Expr.Equals("IsCurrent", true));
        sSectionMembership.AddCriteria(terminationGroup);
        sSectionMembership.UniqueResult = true;
        searchesToRun.Add(sSectionMembership);

        //Chapter Leadership
        Search sChapterLeadership = new Search {
            Type = "ChapterLeader", ID = "ChapterLeadership"
        };

        sChapterLeadership.AddOutputColumn("Chapter.ID");
        sChapterLeadership.AddOutputColumn("Chapter.Name");
        sChapterLeadership.AddSortColumn("Chapter.Name");
        sChapterLeadership.AddCriteria(Expr.Equals("Individual.ID", ConciergeAPI.CurrentEntity.ID));
        searchesToRun.Add(sChapterLeadership);

        //Section Leadership
        Search sSectionLeadership = new Search {
            Type = "SectionLeader", ID = "SectionLeadership"
        };

        sSectionLeadership.AddOutputColumn("Section.ID");
        sSectionLeadership.AddOutputColumn("Section.Name");
        sSectionLeadership.AddSortColumn("Section.Name");
        sSectionLeadership.AddCriteria(Expr.Equals("Individual.ID", ConciergeAPI.CurrentEntity.ID));
        searchesToRun.Add(sSectionLeadership);

        //Organizational Layer Leadership
        Search sOrganizationalLayerLeadership = new Search {
            Type = "OrganizationalLayerLeader", ID = "OrganizationalLayerLeadership"
        };

        sOrganizationalLayerLeadership.AddOutputColumn("OrganizationalLayer.ID");
        sOrganizationalLayerLeadership.AddOutputColumn("OrganizationalLayer.Name");
        sOrganizationalLayerLeadership.AddOutputColumn("OrganizationalLayer.Type.Name");
        sOrganizationalLayerLeadership.AddSortColumn("OrganizationalLayer.Type.Name");
        sOrganizationalLayerLeadership.AddSortColumn("OrganizationalLayer.Name");
        sOrganizationalLayerLeadership.AddCriteria(Expr.Equals("Individual.ID", ConciergeAPI.CurrentEntity.ID));
        searchesToRun.Add(sOrganizationalLayerLeadership);
    }
Beispiel #24
0
    public static bool CanViewMembershipDocuments(IConciergeAPIService api, string membershipObjectID, string entityID)
    {
        // checks to see if you can view section/chapter/org layer docs
        var typeName = api.DetermineObjectType(membershipObjectID).ResultValue;

        if (typeName == msOrganizationalLayer.CLASS_NAME) // special logic
        {
            string orgLayerID = membershipObjectID;
            var    results    = api.GetSearchResult(MembershipLogic.GetSearchForOrganizationalLayerMemberships(), 0, null).Table;

            // search all the columns for the id
            foreach (DataRow dr in results.Rows)
            {
                foreach (DataColumn dc in results.Columns)
                {
                    if (Convert.ToString(dr[dc.ColumnName]) == orgLayerID)
                    {
                        return(true);    // great! We're a member
                    }
                }
            }
            return(false);
        }

        var sFlowDown = new Search("MembershipWithFlowDown");
        sFlowDown.AddCriteria(Expr.Equals("Owner", entityID));

        var flowdownMembership = api.GetSearchResult(sFlowDown, 0, 1);

        // is the person a member of the chapter?
        Search s = new Search(typeName + "Membership");
        var sog  = new SearchOperationGroup {
            GroupType = SearchOperationGroupType.Or
        };
        sog.Criteria.Add(Expr.Equals("Membership.Owner", entityID));
        if (flowdownMembership != null && flowdownMembership.TotalRowCount > 0)
        {
            sog.Criteria.Add(Expr.Equals("Membership", flowdownMembership.Table.Rows[0]["ID"]));
        }
        s.AddCriteria(sog);
        s.AddCriteria(Expr.Equals(typeName, membershipObjectID));
        s.AddCriteria(Expr.Equals("IsCurrent", true));
        s.AddOutputColumn("Membership");
        s.AddSortColumn("ListIndex");

        if (api.GetSearchResult(s, 0, 1).TotalRowCount > 0)
        {
            return(true);    // yep
        }
        // ok - what about a leader?
        Search sLeaders = new Search(typeName + "Leader");
        sLeaders.AddCriteria(Expr.Equals(typeName, membershipObjectID));
        sLeaders.AddCriteria(Expr.Equals(msMembershipLeader.FIELDS.Individual, entityID));
        sLeaders.AddOutputColumn(typeName);
        sLeaders.AddSortColumn("ListIndex");

        if (api.GetSearchResult(sLeaders, 0, 1).TotalRowCount > 0)
        {
            return(true);    // they are a leader
        }
        return(false);
    }
    protected override void loadDataFromConcierge(IConciergeAPIService proxy)
    {
        base.loadDataFromConcierge(proxy);

        Search sForum = new Search(msForum.CLASS_NAME);

        sForum.AddOutputColumn("ID");
        sForum.AddOutputColumn("Name");
        sForum.AddOutputColumn("Description");
        sForum.AddOutputColumn("LastDiscussionPost");
        sForum.AddOutputColumn("LastDiscussionPost.Topic");
        sForum.AddOutputColumn("LastDiscussionPost.Name");
        sForum.AddOutputColumn("LastDiscussionPost.CreatedDate");
        sForum.AddOutputColumn("LastDiscussionPost.PostedBy.Name");
        sForum.AddOutputColumn("DiscussionTopic_Count");
        sForum.AddOutputColumn("DiscussionPost_Count");

        sForum.AddCriteria(Expr.Equals("DiscussionBoard", TargetDiscussionBoard.ID));
        sForum.AddCriteria(Expr.Equals("IsActive", true));

        if (!MembershipLogic.IsActiveMember())
        {
            sForum.AddCriteria(Expr.Equals("MembersOnly", false));
        }

        sForum.AddSortColumn("GroupName");
        sForum.AddSortColumn("DisplayOrder");
        sForum.AddSortColumn("Name");

        SearchResult srForums = proxy.GetSearchResult(sForum, PageStart, PAGE_SIZE);

        dtForums = srForums.Table;

        for (int i = 0; i < dtForums.Columns.Count; i++)
        {
            dtForums.Columns[i].ColumnName = dtForums.Columns[i].ColumnName.Replace(".", "_");
        }

        SetCurrentPageFromResults(srForums, hlFirstPage, hlPrevPage, hlNextPage, lNumPages, null, null,
                                  null, lCurrentPage);

        Search sPostsPendingApproval = new Search("DiscussionContents")
        {
            ID = msDiscussionPost.CLASS_NAME
        };

        sPostsPendingApproval.AddOutputColumn("DiscussionPost");
        sPostsPendingApproval.AddOutputColumn("DiscussionPost.Topic");
        sPostsPendingApproval.AddOutputColumn("DiscussionPost.Name");
        sPostsPendingApproval.AddOutputColumn("DiscussionPost.CreatedDate");
        sPostsPendingApproval.AddOutputColumn("DiscussionPost.PostedBy.Name");
        sPostsPendingApproval.AddCriteria(Expr.Equals("DiscussionBoard", TargetDiscussionBoard.ID));
        sPostsPendingApproval.AddCriteria(Expr.Equals("DiscussionPost.Status",
                                                      DiscussionPostStatus.Pending.ToString()));
        sPostsPendingApproval.AddSortColumn("DiscussionPost.CreatedDate", true);

        SearchResult srPostsPendingApproval = proxy.GetSearchResult(sPostsPendingApproval, 0, 1);

        if (srPostsPendingApproval.Table.Rows.Count > 0)
        {
            drLastPostPendingApproval = srPostsPendingApproval.Table.Rows[0];
        }
        numberOfPostsPendingApproval = srPostsPendingApproval.TotalRowCount;
    }
Beispiel #26
0
        public void GetReferredMembers()
        {
            List <string> referred = new List <string>();

            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");
            referred.Add("*****@*****.**");

            MembershipLogic target   = new MembershipLogic();
            List <string>   found    = new List <string>();
            int             notfound = 0;

            foreach (string referral in referred)
            {
                BaseResponse actual = target.GetMemberByUserName(referral);
                if (actual != null && actual.TypedResponse != null && actual.TypedResponse.Success)
                {
                    try
                    {
                        GetMemberResponse res = actual.TypedResponse as GetMemberResponse;
                        if (res.MemberFound)
                        {
                            if (res.MemberData != null &&
                                res.MemberData.Subscriptions != null &&
                                res.MemberData.Subscriptions.Count > 0)
                            {
                                System.Diagnostics.Debug.WriteLine(string.Format("SFG ID {0} Subscription count: {1}", res.MemberData.MemberId, res.MemberData.Subscriptions.Count));
                                found.Add(string.Format("{0}, {1}, {2}", referral, res.MemberData.MemberId, res.MemberData.Subscriptions.Count));
                            }
                            else
                            {
                                notfound++;
                            }
                        }
                        else
                        {
                            found.Add(string.Format("{0}, {1}, {2}", referral, string.Empty, null));
                            notfound++;
                        }
                    }
                    catch
                    {
                        notfound++;
                    }
                }
                else
                {
                    notfound++;
                }
                System.Diagnostics.Debug.WriteLine(string.Format("Found: {0}", found.Count));
                System.Diagnostics.Debug.WriteLine(string.Format("NOT Found: {0}", notfound));
            }
        }