Exemplo n.º 1
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);
        }
Exemplo n.º 2
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());
    }
Exemplo n.º 3
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());
    }
Exemplo n.º 4
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);
    }
    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;
    }
Exemplo n.º 6
0
    protected override bool CheckSecurity()
    {
        if (!base.CheckSecurity())
        {
            return(false);
        }

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

        return(true);
    }
Exemplo n.º 7
0
    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);
    }
Exemplo n.º 8
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);
    }