Exemple #1
0
    //MS-4881
    protected DataTable LoadDataFromConcierge(bool currentContacts, int start, int count, out int totalCount)
    {
        var searches = new List <Search>();

        // Relationships
        var sRelationships = new Search("RelationshipsForARecord")
        {
            ID      = msRelationship.CLASS_NAME,
            Context = targetOrganization.ID
        };

        sRelationships.AddOutputColumn("ID");
        sRelationships.AddOutputColumn("RightSide_Individual.LocalID");
        sRelationships.AddOutputColumn("Target_ID");
        sRelationships.AddOutputColumn("Target_Name");
        sRelationships.AddOutputColumn("IsActive");
        sRelationships.AddOutputColumn("RightSide_Individual.EmailAddress");
        sRelationships.AddOutputColumn("RelationshipTypeName");
        sRelationships.AddCriteria(Expr.IsNotBlank("RightSide_Individual.Name"));    // bring individuals over only MS-4426
        sRelationships.AddCriteria(Expr.Equals("IsActive", currentContacts));
        sRelationships.AddSortColumn("Target_Name");
        searches.Add(sRelationships);

        var searchResults   = APIExtensions.GetMultipleSearchResults(searches, start, count);
        var srRelationships = searchResults.Single(x => x.ID == msRelationship.CLASS_NAME);

        totalCount = srRelationships.TotalRowCount;

        return(srRelationships.Table);
    }
Exemple #2
0
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        // Job Posting Locations
        var sLocations = new Search(msJobPostingLocation.CLASS_NAME);

        sLocations.AddOutputColumn("ID");
        sLocations.AddOutputColumn("Name");
        sLocations.AddSortColumn("Name");

        searches.Add(sLocations);

        // Job Posting Categories
        var sCategories = new Search(msJobPostingCategory.CLASS_NAME);

        sCategories.AddOutputColumn("ID");
        sCategories.AddOutputColumn("Name");
        sCategories.AddSortColumn("Name");

        searches.Add(sCategories);

        var results = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        dvLocations  = new DataView(results[0].Table);
        dvCategories = new DataView(results[1].Table);
    }
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        var sInvoices = new Search {
            Type = msInvoice.CLASS_NAME
        };

        sInvoices.AddOutputColumn("ID");
        sInvoices.AddOutputColumn("Name");
        sInvoices.AddOutputColumn("Date");
        sInvoices.AddOutputColumn("BalanceDue");
        sInvoices.AddOutputColumn("BusinessUnit.DoNotAllowPartialPaymentsInPortal");
        sInvoices.AddCriteria(Expr.Equals("BillTo.ID", targetEntity.ID));
        sInvoices.AddCriteria(Expr.IsGreaterThan("BalanceDue", 0));
        sInvoices.AddSortColumn("LocalID");
        searches.Add(sInvoices);

        var sCredits = new Search {
            Type = msCredit.CLASS_NAME
        };

        sCredits.AddOutputColumn("ID");
        sCredits.AddOutputColumn("Name");
        sCredits.AddOutputColumn("Date");
        sCredits.AddOutputColumn("AmountAvailable");
        sCredits.AddCriteria(Expr.Equals(msCredit.FIELDS.Owner, targetEntity.ID));
        sCredits.AddCriteria(Expr.IsGreaterThan("AmountAvailable", 0));
        sCredits.AddSortColumn("LocalID");
        searches.Add(sCredits);

        var sInvoiceItems = new Search {
            Type = msInvoiceLineItem.CLASS_NAME
        };

        sInvoiceItems.AddOutputColumn("Invoice");
        sInvoiceItems.AddOutputColumn("Total");
        sInvoiceItems.AddOutputColumn("Description");
        sInvoiceItems.AddOutputColumn("Product.Name");

        sInvoiceItems.AddCriteria(Expr.Equals("Invoice.BillTo.ID", targetEntity.ID));
        sInvoiceItems.AddCriteria(Expr.IsGreaterThan("Invoice.BalanceDue", 0));
        sInvoiceItems.AddCriteria(Expr.Equals("Optional", true));
        sInvoiceItems.AddSortColumn("Invoice");
        sInvoiceItems.AddSortColumn("InvoiceLineItemID");
        searches.Add(sInvoiceItems);

        var results = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        dvInvoices      = new DataView(results[0].Table);
        dvCredits       = new DataView(results[1].Table);
        dvOptionalItems = new DataView(results[2].Table);
    }
    protected bool hasPermissionsToView(string organizationalLayerId)
    {
        // Organizational Layer Leadership
        var sOrganizationalLayerLeadership = new Search {
            Type = "OrganizationalLayerLeader"
        };

        sOrganizationalLayerLeadership.AddOutputColumn("OrganizationalLayer.ID");
        sOrganizationalLayerLeadership.AddCriteria(Expr.Equals("Individual.ID", ConciergeAPI.CurrentEntity.ID));
        sOrganizationalLayerLeadership.AddCriteria(Expr.Equals("OrganizationalLayer.ID", organizationalLayerId));
        sOrganizationalLayerLeadership.AddSortColumn("OrganizationalLayer.Name");

        var srOrganizationalLayerLeadership = APIExtensions.GetSearchResult(sOrganizationalLayerLeadership, 0, 1);

        if (srOrganizationalLayerLeadership.Table.Rows.Count > 0)
        {
            return(true);
        }

        var searches = new List <Search>();

        // Setup the clause to recursively determine if the user has a membership somewhere nested under the supplied organizational layer
        var organizationalLayerMembershipClause = new SearchOperationGroup {
            GroupType = SearchOperationGroupType.Or
        };

        organizationalLayerMembershipClause.Criteria.Add(Expr.Equals("Chapter.Layer", organizationalLayerId));

        // Add the recursive query for all the parent organizational layers

        var sbOrganizationalLayer = new StringBuilder("Chapter.Layer");

        // Add Organizational Layers
        for (int i = 0; i < PortalConfiguration.OrganizationalLayerTypes.Rows.Count - 1; i++)
        {
            sbOrganizationalLayer.Append(".{0}");
            organizationalLayerMembershipClause.Criteria.Add(Expr.Equals(string.Format(sbOrganizationalLayer.ToString(), "ParentLayer"), organizationalLayerId));
        }

        // Organizational Layer Membership
        var sOrganizationalLayerMembership = new Search(msChapterMembership.CLASS_NAME);

        sOrganizationalLayerMembership.AddOutputColumn("Chapter.ID");
        sOrganizationalLayerMembership.AddCriteria(organizationalLayerMembershipClause);
        sOrganizationalLayerMembership.AddCriteria(Expr.Equals("Membership.Owner.ID", ConciergeAPI.CurrentEntity.ID));
        sOrganizationalLayerMembership.AddSortColumn("Chapter.Name");
        searches.Add(sOrganizationalLayerMembership);

        var srOrganizationalLayerMembership = APIExtensions.GetMultipleSearchResults(searches, 0, 1);

        return(srOrganizationalLayerMembership.Any(searchResult => searchResult.Table.Rows.Count > 0));
    }
Exemple #5
0
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        // Registration Fees
        var sRegistrationFees = new Search(msRegistrationFee.CLASS_NAME)
        {
            ID = "RegistrationFees"
        };

        sRegistrationFees.AddOutputColumn("ID");
        sRegistrationFees.AddOutputColumn("Name");
        sRegistrationFees.AddCriteria(Expr.Equals("Event", targetEventRegistration.Event));
        sRegistrationFees.AddSortColumn("Name");

        searches.Add(sRegistrationFees);

        // Registration Categories
        var sRegistrationCategories = new Search(msRegistrationCategory.CLASS_NAME)
        {
            ID = "RegistrationCategories"
        };

        sRegistrationCategories.AddOutputColumn("ID");
        sRegistrationCategories.AddOutputColumn("Name");
        sRegistrationCategories.AddCriteria(Expr.Equals("Event", targetEventRegistration.Event));
        sRegistrationCategories.AddSortColumn("Name");

        searches.Add(sRegistrationCategories);

        // Registration Classes
        var sRegistrationClasses = new Search(msRegistrationClass.CLASS_NAME)
        {
            ID = "RegistrationClasses"
        };

        sRegistrationClasses.AddOutputColumn("ID");
        sRegistrationClasses.AddOutputColumn("Name");
        sRegistrationClasses.AddCriteria(Expr.Equals("Event", targetEventRegistration.Event));
        sRegistrationClasses.AddSortColumn("Name");

        searches.Add(sRegistrationClasses);

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        dvRegistrationFees       = new DataView(searchResults.Single(x => x.ID == "RegistrationFees").Table);
        dvRegistrationCategories = new DataView(searchResults.Single(x => x.ID == "RegistrationCategories").Table);
        dvRegistrationClasses    = new DataView(searchResults.Single(x => x.ID == "RegistrationClasses").Table);
    }
    protected void loadDataFromConcierge()
    {
        var searches = new List<Search>();

        // Search for confirmation emails
        var sConfirmationEmails = new Search(msEmailTemplateContainer.CLASS_NAME);
        sConfirmationEmails.AddOutputColumn("ID");
        sConfirmationEmails.AddOutputColumn("Name");
        sConfirmationEmails.AddCriteria(Expr.Equals("ApplicableType", "OrderLineItem"));
        sConfirmationEmails.AddSortColumn("Name");

        searches.Add(sConfirmationEmails);

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);
        dvConfirmationEmails = new DataView(searchResults[0].Table);
    }
Exemple #7
0
    protected override void InitializePage()
    {
        base.InitializePage();

        var sPaymentItems = generatePaymentItemsSearch();

        var searchesToRun = new List <Search> {
            sPaymentItems
        };
        var searchResults = APIExtensions.GetMultipleSearchResults(searchesToRun, 0, null);

        gvPaymentItems.DataSource = searchResults[0].Table;
        gvPaymentItems.DataBind();

        PageTitleExtenstion.Text = GetSearchResult(targetPayment, "LocalID", null);
    }
Exemple #8
0
    protected void loadDataFromConcierge(IConciergeAPIService serviceProxy)
    {
        targetEvent = serviceProxy.LoadObjectFromAPI <msEvent>(ContextID);
        loadEventOwners(serviceProxy);

        var searches = new List <Search>();

        // Event information links related to current event
        var sEventLinks = new Search {
            Type = msEventInformationLink.CLASS_NAME
        };

        sEventLinks.AddOutputColumn("ID");
        sEventLinks.AddOutputColumn("Name");
        sEventLinks.AddCriteria(Expr.Equals("IsActive", 1));
        sEventLinks.AddCriteria(Expr.Equals("Event.ID", ContextID));
        sEventLinks.AddSortColumn("DisplayOrder");
        searches.Add(sEventLinks);

        //If we're logged in search for event registrations for the current entity
        if (ConciergeAPI.CurrentEntity != null)
        {
            Search sRegistrations = new Search {
                Type = msEventRegistration.CLASS_NAME, ID = "Registrations"
            };
            sRegistrations.AddOutputColumn("ID");
            sRegistrations.AddOutputColumn("Name");
            sRegistrations.AddOutputColumn("Fee.Name");
            sRegistrations.AddOutputColumn("Fee.IsGuestRegistration");
            sRegistrations.AddOutputColumn("CreatedDate");
            sRegistrations.AddCriteria(Expr.Equals("Owner.ID", ConciergeAPI.CurrentEntity.ID));
            sRegistrations.AddCriteria(Expr.Equals("Event.ID", ContextID));
            sRegistrations.AddCriteria(Expr.IsBlank(msRegistrationBase.FIELDS.CancellationDate));
            searches.Add(sRegistrations);
        }

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        dvEventLinks = new DataView(searchResults[0].Table);

        if (searchResults.Exists(x => x.ID == "Registrations"))
        {
            dvRegistrations = new DataView(searchResults.Single(x => x.ID == "Registrations").Table);
        }
    }
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        // Get all the chapters for the chapter & member counts
        // Setup the clause to recursively find chapters that are somewhere nested under the current organizational layer
        var organizationalLayerChapterClause = new SearchOperationGroup {
            GroupType = SearchOperationGroupType.Or
        };

        organizationalLayerChapterClause.Criteria.Add(Expr.Equals("Layer", ContextID));

        // Add the recursive query for all the parent organizational layers
        var sbChapter = new StringBuilder("Layer");

        // Add Organizational Layers
        for (int i = 0; i < PortalConfiguration.OrganizationalLayerTypes.Rows.Count - 1; i++)
        {
            sbChapter.Append(".{0}");
            organizationalLayerChapterClause.Criteria.Add(Expr.Equals(string.Format(sbChapter.ToString(), "ParentLayer"), ContextID));
        }

        var sChapters = new Search(msChapter.CLASS_NAME)
        {
            ID = msChapter.CLASS_NAME
        };

        sChapters.AddOutputColumn("ID");
        sChapters.AddOutputColumn("Name");
        sChapters.AddOutputColumn("LinkedOrganization._Preferred_Address");
        sChapters.AddCriteria(organizationalLayerChapterClause);
        sChapters.AddSortColumn("Name");
        searches.Add(sChapters);

        var sLeaders = GetOrganizationalLayerLeaderSearch(targetOrganizationalLayer.ID);

        searches.Add(sLeaders);

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        dvChapters = new DataView(searchResults.Single(x => x.ID == msChapter.CLASS_NAME).Table);

        leader = ConvertLeaderSearchResult(searchResults.Single(x => x.ID == "OrganizationalLayerLeader"));
    }
    /// <summary>
    /// Executes all querys required for the current page against the Concierge API in a multi-search fashion to improve performance
    /// </summary>
    private void loadDataFromConcierge()
    {
        var searchesToRun = new List <Search>();

        //Committee terms related to target committee
        var sCommitteeTerm = new Search {
            Type = msCommitteeTerm.CLASS_NAME
        };

        sCommitteeTerm.AddOutputColumn("ID");
        sCommitteeTerm.AddOutputColumn("Name");
        sCommitteeTerm.AddCriteria(Expr.Equals("Committee.ID", ContextID));
        sCommitteeTerm.AddSortColumn("Name", true);
        searchesToRun.Add(sCommitteeTerm);

        //Committee Memberships related to target committee
        var sCommitteeMembership = new Search {
            Type = msCommitteeMembership.CLASS_NAME
        };

        sCommitteeMembership.AddOutputColumn("Member.ID");
        sCommitteeMembership.AddOutputColumn("Member.Name");
        sCommitteeMembership.AddOutputColumn("Position.Name");
        sCommitteeMembership.AddOutputColumn("EffectiveStartDate");
        sCommitteeMembership.AddOutputColumn("EffectiveEndDate");
        sCommitteeMembership.AddOutputColumn("IsCurrent");
        sCommitteeMembership.AddOutputColumn("Term.ID");
        sCommitteeMembership.AddCriteria(Expr.Equals("Committee.ID", ContextID));

        ////sCommitteeMembership.AddSortColumn("Position.DisplayOrder");
        ////sCommitteeMembership.AddSortColumn("Position.Name");
        sCommitteeMembership.AddSortColumn("Member.Name");

        searchesToRun.Add(sCommitteeMembership);

        var results = APIExtensions.GetMultipleSearchResults(searchesToRun, 0, null);

        // now, assign the search results
        dvCommitteeTerms   = new DataView(results[0].Table);
        dvCommitteeMembers = new DataView(results[1].Table);
    }
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        // Search for registration classes - these are not described as pick list entries
        var sRegistrationClasses = new Search(msRegistrationClass.CLASS_NAME);

        sRegistrationClasses.AddOutputColumn("ID");
        sRegistrationClasses.AddOutputColumn("Name");
        sRegistrationClasses.AddCriteria(Expr.Equals("Event", targetEvent.ID));
        sRegistrationClasses.AddSortColumn("Name");

        searches.Add(sRegistrationClasses);

        // Search for registration categories - these are not described as pick list entries
        var sRegistrationCategories = new Search(msRegistrationCategory.CLASS_NAME);

        sRegistrationCategories.AddOutputColumn("ID");
        sRegistrationCategories.AddOutputColumn("Name");
        sRegistrationCategories.AddCriteria(Expr.Equals("Event", targetEvent.ID));
        sRegistrationCategories.AddSortColumn("Name");

        searches.Add(sRegistrationCategories);

        // Search for confirmation emails
        var sConfirmationEmails = new Search(msEmailTemplateContainer.CLASS_NAME);

        sConfirmationEmails.AddOutputColumn("ID");
        sConfirmationEmails.AddOutputColumn("Name");
        sConfirmationEmails.AddCriteria(Expr.Equals("Context", targetEvent.ID));
        sConfirmationEmails.AddSortColumn("Name");

        searches.Add(sConfirmationEmails);

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        dvRegistrationClasses    = new DataView(searchResults[0].Table);
        dvRegistrationCategories = new DataView(searchResults[1].Table);
        dvConfirmationEmails     = new DataView(searchResults[2].Table);
    }
Exemple #12
0
    protected override void InitializePage()
    {
        base.InitializePage();

        var sOrderItems         = generateOrderItemsSearch();
        var sInvoices           = generateInvoicesSearch();
        var sPayments           = generatePaymentsSearch();
        var sInstallmentsSearch = generateInstallmentsSearch();

        var searchesToRun = new List <Search> {
            sOrderItems, sInvoices, sPayments, sInstallmentsSearch
        };
        var searchResults = APIExtensions.GetMultipleSearchResults(searchesToRun, 0, null);

        gvOrderItems.DataSource = searchResults[0].Table;
        gvOrderItems.DataBind();

        gvInvoices.DataSource = searchResults[1].Table;
        gvInvoices.DataBind();

        gvPayments.DataSource = searchResults[2].Table;
        gvPayments.DataBind();

        //if (searchResults[3].TotalRowCount > 0)
        //{
        //    pnlInstallments.Visible = true;
        //    gvInstallments.DataSource = searchResults[3].Table;
        //    gvInstallments.DataBind();

        //    if ( (string) targetOrder["BillingSchedule.Status"] == "Completed")
        //        btnUpdateCreditCardInfo.Visible = false;
        //}

        if (string.IsNullOrWhiteSpace(GetSearchResult(targetOrder, "CustomerNotes")))
        {
            divNotes.Visible = false;
        }

        PageTitleExtenstion.Text = GetSearchResult(targetOrder, "LocalID", null);
    }
    /// <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();

        // Have to get the actual MemberSuiteObject for the custom fields
        targetAbstract = LoadObjectFromAPI <msAbstract>(ContextID);

        if (targetAbstract == null)
        {
            GoToMissingRecordPage();
            return;
        }


        var s = new Search(msAbstract.CLASS_NAME);

        s.AddCriteria(Expr.Equals("ID", ContextID));
        s.AddOutputColumn("Event.Name");
        s.AddOutputColumn("Status.Name");

        var s2 = new Search("AbstractSessionTrack");

        s2.AddCriteria(Expr.Equals("Abstract", ContextID));
        s2.AddOutputColumn("SessionTrack.Name");
        s2.AddSortColumn("SessionTrack.Name");

        var results = APIExtensions.GetMultipleSearchResults(new List <Search> {
            s, s2
        }, 0, 1);

        if (results[0].TotalRowCount == 0)
        {
            GoToMissingRecordPage();
        }

        targetAbstractRow = results[0].Table.Rows[0];

        targetTracks = results[1].Table;
    }
Exemple #14
0
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        // Load Registration Fees
        var sFees = new Search(msRegistrationFee.CLASS_NAME);

        sFees.AddOutputColumn("ID");
        sFees.AddOutputColumn("DisplayOrder");
        sFees.AddOutputColumn("Code");
        sFees.AddOutputColumn("Name");
        sFees.AddOutputColumn("Price");
        sFees.AddOutputColumn("IsActive");
        sFees.AddCriteria(Expr.Equals("Event", targetEvent.ID));
        sFees.AddSortColumn("DisplayOrder");
        sFees.AddSortColumn("Name");
        sFees.AddSortColumn("Code");

        searches.Add(sFees);

        // Load Registration Questions
        var sQuestions = new Search(msCustomField.CLASS_NAME);

        sQuestions.AddOutputColumn("ID");
        sQuestions.AddOutputColumn("DisplayOrder");
        sQuestions.AddOutputColumn("Label");
        sQuestions.AddOutputColumn("DataType");
        sQuestions.AddOutputColumn("DisplayType");
        sQuestions.AddOutputColumn("IsRequired");
        sQuestions.AddCriteria(Expr.Equals("Event", targetEvent.ID));
        sQuestions.AddSortColumn("DisplayOrder");
        sQuestions.AddSortColumn("Label");

        searches.Add(sQuestions);

        // Load Discounts/Promo Codes
        var sPromoCodes = new Search(msEventDiscountCode.CLASS_NAME);

        sPromoCodes.AddOutputColumn("ID");
        sPromoCodes.AddOutputColumn("Name");
        sPromoCodes.AddOutputColumn("Code");
        sPromoCodes.AddOutputColumn("IsActive");
        sPromoCodes.AddOutputColumn("ValidUntil");
        sPromoCodes.AddCriteria(Expr.Equals("Event", targetEvent.ID));
        sPromoCodes.AddSortColumn("Name");
        sPromoCodes.AddSortColumn("Code");


        searches.Add(sPromoCodes);

        // Load Supplemental Information Links
        var sInformationLinks = new Search(msEventInformationLink.CLASS_NAME);

        sInformationLinks.AddOutputColumn("ID");
        sInformationLinks.AddOutputColumn("DisplayOrder");
        sInformationLinks.AddOutputColumn("Name");
        sInformationLinks.AddOutputColumn("Code");
        sInformationLinks.AddOutputColumn("IsActive");
        sInformationLinks.AddCriteria(Expr.Equals("Event", targetEvent.ID));
        sInformationLinks.AddSortColumn("DisplayOrder");
        sInformationLinks.AddSortColumn("Name");
        sInformationLinks.AddSortColumn("Code");

        searches.Add(sInformationLinks);

        // Load Waived Registration Lists
        var sWaivedRegistrationLists = new Search(msWaivedRegistrationList.CLASS_NAME);

        sWaivedRegistrationLists.AddOutputColumn("ID");
        sWaivedRegistrationLists.AddOutputColumn("Name");
        sWaivedRegistrationLists.AddOutputColumn("MemberCount");
        sWaivedRegistrationLists.AddOutputColumn("RegisteredMemberCount");
        sWaivedRegistrationLists.AddOutputColumn("IsActive");
        sWaivedRegistrationLists.AddCriteria(Expr.Equals("Event", targetEvent.ID));
        sWaivedRegistrationLists.AddSortColumn("Name");

        searches.Add(sWaivedRegistrationLists);

        // Load Confirmation Emails
        var sConfirmationEmails = new Search(msEmailTemplateContainer.CLASS_NAME);

        sConfirmationEmails.AddOutputColumn("ID");
        sConfirmationEmails.AddOutputColumn("Name");
        sConfirmationEmails.AddOutputColumn("ApplicableType");
        sConfirmationEmails.AddCriteria(Expr.Equals("Context", targetEvent.ID));
        sConfirmationEmails.AddSortColumn("Name");

        searches.Add(sConfirmationEmails);

        // Load Event Merchandise
        var sEventMerchandise = new Search(msEventMerchandise.CLASS_NAME);

        sEventMerchandise.AddOutputColumn("ID");
        sEventMerchandise.AddOutputColumn("Code");
        sEventMerchandise.AddOutputColumn("Name");
        sEventMerchandise.AddOutputColumn("Price");
        sEventMerchandise.AddCriteria(Expr.Equals("Event", targetEvent.ID));
        sEventMerchandise.AddSortColumn("Name");

        searches.Add(sEventMerchandise);

        // Load External Merchant Accounts
        var sExternalMerchantAccounts = new Search(msMerchantAccount.CLASS_NAME);

        sExternalMerchantAccounts.AddOutputColumn("ID");
        sExternalMerchantAccounts.AddOutputColumn("Name");
        sExternalMerchantAccounts.AddCriteria(Expr.Equals("IsExternalAccount", true));
        sExternalMerchantAccounts.AddSortColumn("Name");

        searches.Add(sExternalMerchantAccounts);

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        dvRegistrationFees         = new DataView(searchResults[0].Table);
        dvRegistrationQuestions    = new DataView(searchResults[1].Table);
        dvPromoCodes               = new DataView(searchResults[2].Table);
        dvInformationLinks         = new DataView(searchResults[3].Table);
        dvWaivedRegistrationLists  = new DataView(searchResults[4].Table);
        dvConfirmationEmails       = new DataView(searchResults[5].Table);
        dvEventMerchandise         = new DataView(searchResults[6].Table);
        dvExternalMerchantAccounts = new DataView(searchResults[7].Table);
    }
Exemple #15
0
    protected void loadDataFromConcierge(IConciergeAPIService proxy)
    {
        var searches = new List <Search>();

        var sMerchandise = new Search(msMerchandise.CLASS_NAME)
        {
            ID = msMerchandise.CLASS_NAME
        };

        sMerchandise.AddOutputColumn("ID");
        sMerchandise.AddOutputColumn("Name");
        sMerchandise.AddOutputColumn("Image");
        sMerchandise.AddOutputColumn("Description");
        sMerchandise.AddOutputColumn("ShortDescription");
        sMerchandise.AddOutputColumn("Price");
        sMerchandise.AddOutputColumn("MemberPrice");
        sMerchandise.AddOutputColumn("DisplayPriceAs");
        sMerchandise.AddOutputColumn("IsActive");
        sMerchandise.AddCriteria(Expr.Equals("ID", ContextID));

        searches.Add(sMerchandise);

        // Category Search
        var sCategories = new Search {
            Type = msProductCategory.CLASS_NAME, ID = msProductCategory.CLASS_NAME
        };

        sCategories.AddOutputColumn("ID");
        sCategories.AddOutputColumn("Name");
        sCategories.AddCriteria(Expr.Equals("ProductType", "Merchandise"));
        sCategories.AddCriteria(Expr.Equals("IsActive", true));
        sCategories.AddSortColumn("Name");

        searches.Add(sCategories);

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        if (searchResults == null || searchResults.Count < 2 || searchResults[0] == null || searchResults[0].Table == null || searchResults[0].Table.Rows.Count != 1)
        {
            GoToMissingRecordPage();
            return;
        }

        //Add a quantity column so that this row can be added properly to the recently added items list if Add to Cart is used
        SearchResult srMerchandise = searchResults.Single(x => x.ID == msMerchandise.CLASS_NAME);

        srMerchandise.Table.Columns.Add("Quantity", typeof(int));
        srMerchandise.Table.Columns.Add("PriceForCurrentEntity", typeof(decimal));
        targetMerchandise = srMerchandise.Table.Rows[0];

        SearchResult srCategories = searchResults.Single(x => x.ID == msProductCategory.CLASS_NAME);

        dtCategories            = srCategories.Table;
        dtCategories.PrimaryKey = new[] { dtCategories.Columns["ID"] };


        if (!string.IsNullOrWhiteSpace(CategoryID))
        {
            targetCategory = srCategories.Table.Rows.Find(CategoryID);
        }


        preProcessOrder(proxy);

        //Describe the products for this entity to see if they're different
        //if (CurrentEntity == null || srMerchandise.Table.Rows.Count == 0) return;
        // MS-4786. We still need to describer products even the entity is null.
        if (srMerchandise.Table.Rows.Count == 0)
        {
            return;
        }

        describedProduct = proxy.DescribeProducts(CurrentEntity == null ? string.Empty : CurrentEntity.ID, new List <string>()
        {
            targetMerchandise["ID"].ToString()
        }).ResultValue[0];
    }
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        // Search for the section to get aggregate information
        var sSection = new Search {
            Type = msSection.CLASS_NAME, ID = msSection.CLASS_NAME
        };

        sSection.AddOutputColumn("ActiveMemberCount");
        sSection.AddOutputColumn("TotalMemberCount");
        sSection.AddOutputColumn("LocalID");
        sSection.AddOutputColumn("Name");
        sSection.AddOutputColumn("Description");
        sSection.AddCriteria(Expr.Equals("ID", ContextID));
        searches.Add(sSection);

        // Search for related committees
        var sSectionCommittees = new Search {
            Type = msCommittee.CLASS_NAME, ID = msCommittee.CLASS_NAME
        };

        sSectionCommittees.AddOutputColumn("ID");
        sSectionCommittees.AddOutputColumn("Name");
        sSectionCommittees.AddOutputColumn("CurrentMemberCount");
        sSectionCommittees.AddCriteria(Expr.Equals("Section.ID", ContextID));
        sSectionCommittees.AddCriteria(Expr.Equals("ShowInPortal", true));

        searches.Add(sSectionCommittees);

        // Search for related events
        var sSectionEvents = new Search {
            Type = msEvent.CLASS_NAME, ID = msEvent.CLASS_NAME
        };

        sSectionEvents.AddOutputColumn("ID");
        sSectionEvents.AddOutputColumn("Name");
        sSectionEvents.AddOutputColumn("StartDate");
        sSectionEvents.AddOutputColumn("EndDate");
        sSectionEvents.AddCriteria(Expr.Equals("Section.ID", targetSection.ID));
        sSectionEvents.AddCriteria(Expr.Equals("VisibleInPortal", true));
        sSectionEvents.AddSortColumn("StartDate");
        sSectionEvents.AddSortColumn("EndDate");
        sSectionEvents.AddSortColumn("Name");
        searches.Add(sSectionEvents);

        var sLeader = GetSectionLeaderSearch(targetSection.ID);

        searches.Add(sLeader);

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        var srSection = searchResults.Single(x => x.ID == msSection.CLASS_NAME);

        if (srSection.TotalRowCount == 0)
        {
            GoToMissingRecordPage();
        }

        drTargetSection     = srSection.Table.Rows[0];
        dvSectionCommittees = new DataView(searchResults.Single(x => x.ID == msCommittee.CLASS_NAME).Table);
        dvSectionEvents     = new DataView(searchResults.Single(x => x.ID == msEvent.CLASS_NAME).Table);

        var srLeader = searchResults.Single(x => x.ID == "SectionLeader");

        if (srLeader != null)
        {
            leader = ConvertLeaderSearchResult(srLeader);
        }
    }
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        // Search for the order
        var sOrder = new Search {
            Type = msOrder.CLASS_NAME
        };

        sOrder.AddOutputColumn("BalanceDue");
        sOrder.AddCriteria(Expr.Equals("ID", targetRegistration.Order));
        sOrder.AddSortColumn("ID");
        searches.Add(sOrder);

        // Search for payments
        var sPayments = new Search {
            Type = msPaymentLineItem.CLASS_NAME
        };

        sPayments.AddOutputColumn("Payment.ID");
        sPayments.AddOutputColumn("Payment.Name");
        sPayments.AddOutputColumn("Payment.Date");
        sPayments.AddOutputColumn(msPaymentLineItem.FIELDS.Total);
        sPayments.AddCriteria(Expr.IsNotBlank("Invoice.Order"));   // MSIV-252
        sPayments.AddCriteria(Expr.Equals("Invoice.Order", targetRegistration.Order));
        sPayments.AddSortColumn("Payment.ID");
        sPayments.AddSortColumn("Payment.Date");
        searches.Add(sPayments);

        // Search for Historical Transactions

        var sHistoricalTransactions = new Search(msHistoricalTransaction.CLASS_NAME);

        sHistoricalTransactions.AddOutputColumn("ID");
        sHistoricalTransactions.AddOutputColumn("Name");
        sHistoricalTransactions.AddOutputColumn("Date");
        sHistoricalTransactions.AddOutputColumn("Type");
        sHistoricalTransactions.AddOutputColumn("Total");
        sHistoricalTransactions.AddCriteria(Expr.IsNotBlank("Order"));   // MSIV-252
        sHistoricalTransactions.AddCriteria(Expr.Equals("Order", targetRegistration.Order));
        sHistoricalTransactions.AddSortColumn("Date");
        searches.Add(sHistoricalTransactions);

        //Search for the order
        var sSessions = new Search {
            Type = msSessionRegistration.CLASS_NAME
        };

        sSessions.AddOutputColumn("Event");
        sSessions.AddOutputColumn("Event.Name");
        sSessions.AddOutputColumn("Event.StartDate");
        sSessions.AddOutputColumn("Event.TimeSlot.Name");
        sSessions.AddOutputColumn("Event.TimeSlot.StartTime");
        sSessions.AddCriteria(Expr.Equals("ParentRegistration", targetRegistration.ID));
        sSessions.AddSortColumn("Event.StartDate");
        sSessions.AddSortColumn("Event.TimeSlot.StartTime");
        searches.Add(sSessions);

        List <SearchResult> searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        if (searchResults[0].Table.Rows.Count > 0)
        {
            drOrder = searchResults[0].Table.Rows[0];
        }

        dvPayments = new DataView(searchResults[1].Table);
        dvHistoricalTransactions = new DataView(searchResults[2].Table);
        dvSessions = new DataView(searchResults[3].Table);
    }
Exemple #18
0
    protected void loadDataFromConcierge()
    {
        // Load either all team members or the current team member based on the portal settings
        var sTeamMembers = new Search("JudgingTeamMember");

        sTeamMembers.AddOutputColumn("Member");
        sTeamMembers.AddOutputColumn("Member.Name");
        sTeamMembers.AddCriteria(Expr.Equals("Team", JudgingTeamId));
        if (targetCompetition.OtherJudgeScoreVisibilityMode == JudgeScoreVisibilityMode.Never)
        {
            sTeamMembers.AddCriteria(Expr.Equals("Member", ConciergeAPI.CurrentEntity.ID));
        }
        sTeamMembers.AddSortColumn("Member.Name");

        dtTeamMembers = APIExtensions.GetSearchResult(sTeamMembers, 0, null).Table;


        // Set up a multi-search
        var searches = new List <Search>();

        // Load all score cards along with the total
        var sScoreCards = new Search {
            Type = msScoreCard.CLASS_NAME, Context = targetCompetitionEntry.ID
        };

        sScoreCards.AddOutputColumn("Judge");
        sScoreCards.AddOutputColumn("Judge.Name");
        sScoreCards.AddOutputColumn("TotalScore");
        sScoreCards.AddOutputColumn("Comments");
        sScoreCards.AddCriteria(Expr.Equals("Round", targetJudgingRound.ID));
        sScoreCards.AddCriteria(Expr.Equals("Entry", targetCompetitionEntry.ID));
        sScoreCards.AddCriteria(CreateJudgingTeamCriteria("Judge"));
        searches.Add(sScoreCards);

        // Load all score cards for all team members
        var sScoreCardScores = new Search(msScoreCardScore.CLASS_NAME);

        sScoreCardScores.AddOutputColumn("Score");
        sScoreCardScores.AddOutputColumn("Criterion.Name");
        sScoreCardScores.AddOutputColumn("ScoreCard.Judge");
        sScoreCardScores.AddOutputColumn("ScoreCard.Judge.Name");
        sScoreCardScores.AddCriteria(Expr.Equals("ScoreCard.Entry", targetCompetitionEntry.ID));
        sScoreCardScores.AddCriteria(Expr.Equals("ScoreCard.Round", JudgingRoundId));
        sScoreCardScores.AddCriteria(CreateJudgingTeamCriteria("ScoreCard.Judge"));
        sScoreCardScores.AddSortColumn("ScoreCard.Judge.Name");
        searches.Add(sScoreCardScores);


        // Load the competition entry summary information
        var sCompetitionEntry = new Search(msCompetitionEntry.CLASS_NAME);

        sCompetitionEntry.AddOutputColumn("JudgingRoundCombinedScore");
        sCompetitionEntry.AddOutputColumn("JudgingRoundAvgScore");
        sCompetitionEntry.AddOutputColumn("JudgingRoundScoreSpread");
        sCompetitionEntry.AddCriteria(Expr.Equals("ID", targetCompetitionEntry.ID));
        searches.Add(sCompetitionEntry);

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        //Handle the search results
        dtScoreCards            = searchResults[0].Table;
        dtScoreCards.PrimaryKey = new[] { dtScoreCards.Columns["Judge"] };
        dtScoreCardScores       = searchResults[1].Table;
        drCompetitionEntry      = searchResults[2].Table.Rows[0];
    }
Exemple #19
0
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        // Search for the chapter to get aggregate information
        var sChapter = new Search {
            Type = msChapter.CLASS_NAME, ID = msChapter.CLASS_NAME
        };

        sChapter.AddOutputColumn("ActiveMemberCount");
        sChapter.AddOutputColumn("TotalMemberCount");
        sChapter.AddOutputColumn("LocalID");
        sChapter.AddOutputColumn("Name");
        sChapter.AddOutputColumn("Description");
        sChapter.AddOutputColumn("Layer");
        sChapter.AddOutputColumn("Layer.Name");
        sChapter.AddOutputColumn("Layer.Type.Name");
        sChapter.AddCriteria(Expr.Equals("ID", ContextID));
        searches.Add(sChapter);

        // Search for related committees
        var sChapterCommittees = new Search {
            Type = msCommittee.CLASS_NAME, ID = msCommittee.CLASS_NAME
        };

        sChapterCommittees.AddOutputColumn("ID");
        sChapterCommittees.AddOutputColumn("Name");
        sChapterCommittees.AddOutputColumn("CurrentMemberCount");
        sChapterCommittees.AddCriteria(Expr.Equals("Chapter.ID", ContextID));
        sChapterCommittees.AddCriteria(Expr.Equals("ShowInPortal", true));
        searches.Add(sChapterCommittees);

        // Search for related events
        var sChapterEvents = new Search {
            Type = msEvent.CLASS_NAME, ID = msEvent.CLASS_NAME
        };

        sChapterEvents.AddOutputColumn("ID");
        sChapterEvents.AddOutputColumn("Name");
        sChapterEvents.AddOutputColumn("StartDate");
        sChapterEvents.AddOutputColumn("EndDate");
        sChapterEvents.AddCriteria(Expr.Equals("Chapter.ID", targetChapter.ID));
        sChapterEvents.AddCriteria(Expr.Equals("VisibleInPortal", true));
        sChapterEvents.AddSortColumn("StartDate");
        sChapterEvents.AddSortColumn("EndDate");
        sChapterEvents.AddSortColumn("Name");
        searches.Add(sChapterEvents);

        //Search for the linked organization
        if (!string.IsNullOrWhiteSpace(targetChapter.LinkedOrganization))
        {
            var sLinkedOrganizaition = new Search(msOrganization.CLASS_NAME)
            {
                ID = msOrganization.CLASS_NAME
            };
            sLinkedOrganizaition.AddOutputColumn("ID");
            sLinkedOrganizaition.AddOutputColumn("Name");
            sLinkedOrganizaition.AddOutputColumn("Invoices_OpenInvoiceBalance");
            sLinkedOrganizaition.AddOutputColumn("_Preferred_Address_Line1");
            sLinkedOrganizaition.AddOutputColumn("_Preferred_Address_Line2");
            sLinkedOrganizaition.AddOutputColumn("_Preferred_Address_City");
            sLinkedOrganizaition.AddOutputColumn("_Preferred_Address_State");
            sLinkedOrganizaition.AddOutputColumn("_Preferred_Address_PostalCode");
            sLinkedOrganizaition.AddCriteria(Expr.Equals("ID", targetChapter.LinkedOrganization));
            searches.Add(sLinkedOrganizaition);
        }

        var sLeader = GetChapterLeaderSearch(targetChapter.ID);

        searches.Add(sLeader);

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        if (searchResults.Single(x => x.ID == msChapter.CLASS_NAME).TotalRowCount == 0)
        {
            GoToMissingRecordPage();
        }

        drTargetChapter     = searchResults.Single(x => x.ID == msChapter.CLASS_NAME).Table.Rows[0];
        dvChapterCommittees = new DataView(searchResults.Single(x => x.ID == msCommittee.CLASS_NAME).Table);
        dvChapterEvents     = new DataView(searchResults.Single(x => x.ID == msEvent.CLASS_NAME).Table);

        var srLinkedOrganization = searchResults.FirstOrDefault(x => x.ID == msOrganization.CLASS_NAME);

        if (srLinkedOrganization != null)
        {
            drLinkedOrganization = srLinkedOrganization.Table.Rows[0];
        }

        var srLeader = searchResults.Single(x => x.ID == "ChapterLeader");

        if (srLeader != null)
        {
            leader = ConvertLeaderSearchResult(srLeader);
        }
    }
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        // Search for the organizational layer to get aggregate information
        var sOrganizationalLayer = new Search
        {
            Type = msOrganizationalLayer.CLASS_NAME,
            ID   = targetOrganizationalLayer.ID
        };

        sOrganizationalLayer.AddOutputColumn("LocalID");
        sOrganizationalLayer.AddOutputColumn("Name");
        sOrganizationalLayer.AddOutputColumn("Description");
        sOrganizationalLayer.AddOutputColumn("ParentLayer");
        sOrganizationalLayer.AddOutputColumn("ParentLayer.Name");
        sOrganizationalLayer.AddOutputColumn("ParentLayer.Type.Name");
        sOrganizationalLayer.AddCriteria(Expr.Equals("ID", ContextID));
        searches.Add(sOrganizationalLayer);

        // Search for related committees
        var sOrganizationalLayerCommittees = new Search {
            Type = msCommittee.CLASS_NAME, ID = msCommittee.CLASS_NAME
        };

        sOrganizationalLayerCommittees.AddOutputColumn("ID");
        sOrganizationalLayerCommittees.AddOutputColumn("Name");
        sOrganizationalLayerCommittees.AddOutputColumn("CurrentMemberCount");
        sOrganizationalLayerCommittees.AddCriteria(Expr.Equals("OrganizationalLayer.ID", ContextID));
        sOrganizationalLayerCommittees.AddCriteria(Expr.Equals("ShowInPortal", true));
        searches.Add(sOrganizationalLayerCommittees);

        // Search for related events
        var sOrganizationalLayerEvents = new Search {
            Type = msEvent.CLASS_NAME, ID = msEvent.CLASS_NAME
        };

        sOrganizationalLayerEvents.AddOutputColumn("ID");
        sOrganizationalLayerEvents.AddOutputColumn("Name");
        sOrganizationalLayerEvents.AddOutputColumn("StartDate");
        sOrganizationalLayerEvents.AddOutputColumn("EndDate");
        sOrganizationalLayerEvents.AddCriteria(Expr.Equals("OrganizationalLayer.ID", targetOrganizationalLayer.ID));
        sOrganizationalLayerEvents.AddCriteria(Expr.Equals("VisibleInPortal", true));
        sOrganizationalLayerEvents.AddSortColumn("StartDate");
        sOrganizationalLayerEvents.AddSortColumn("EndDate");
        sOrganizationalLayerEvents.AddSortColumn("Name");
        searches.Add(sOrganizationalLayerEvents);

        // Get all the chapters for the chapter & member counts
        // Setup the clause to recursively find chapters that are somewhere nested under the current organizational layer
        var organizationalLayerChapterClause = new SearchOperationGroup {
            GroupType = SearchOperationGroupType.Or
        };

        organizationalLayerChapterClause.Criteria.Add(Expr.Equals("Layer", ContextID));

        // Add the recursive query for all the parent organizational layers
        var sbChapter = new StringBuilder("Layer");

        // Add Organizational Layers
        for (int i = 0; i < PortalConfiguration.OrganizationalLayerTypes.Rows.Count - 1; i++)
        {
            sbChapter.Append(".{0}");
            organizationalLayerChapterClause.Criteria.Add(Expr.Equals(string.Format(sbChapter.ToString(), "ParentLayer"), ContextID));
        }

        var sChapters = new Search(msChapter.CLASS_NAME)
        {
            ID = msChapter.CLASS_NAME
        };

        sChapters.AddOutputColumn("ID");
        sChapters.AddOutputColumn("Name");
        sChapters.AddOutputColumn("ActiveMemberCount");
        sChapters.AddOutputColumn("TotalMemberCount");
        sChapters.AddCriteria(organizationalLayerChapterClause);
        sChapters.AddSortColumn("Name");
        searches.Add(sChapters);

        // Search for child layers
        var sOrganizationalLayers = new Search(msOrganizationalLayer.CLASS_NAME)
        {
            ID = msOrganizationalLayer.CLASS_NAME
        };

        sOrganizationalLayers.AddOutputColumn("ID");
        sOrganizationalLayers.AddOutputColumn("Name");
        sOrganizationalLayers.AddOutputColumn("Type");
        sOrganizationalLayers.AddOutputColumn("Type.Name");
        sOrganizationalLayers.AddCriteria(Expr.Equals("ParentLayer", ContextID));
        sOrganizationalLayers.AddSortColumn("Type.ParentType.Name");
        sOrganizationalLayers.AddSortColumn("Name");
        searches.Add(sOrganizationalLayers);

        // Search for leaders (by searching it will include inherited leaders not included in the targetOrganizationalLayer.Leaders property)
        var sLeaders = GetOrganizationalLayerLeaderSearch(targetOrganizationalLayer.ID);

        searches.Add(sLeaders);

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        var targetOrganizationalLayerSearchResult = searchResults.Single(x => x.ID == targetOrganizationalLayer.ID);

        if (targetOrganizationalLayerSearchResult.TotalRowCount == 0)
        {
            GoToMissingRecordPage();
        }
        drTargetOrganizationalLayer = targetOrganizationalLayerSearchResult.Table.Rows[0];

        dvOrganizationalLayerCommittees = new DataView(searchResults.Single(x => x.ID == msCommittee.CLASS_NAME).Table);
        dvOrganizationalLayerEvents     = new DataView(searchResults.Single(x => x.ID == msEvent.CLASS_NAME).Table);

        // Determine chapter counts
        var chapterSearchResult = searchResults.Single(x => x.ID == msChapter.CLASS_NAME);

        chapterCount = chapterSearchResult.Table.Rows.Count;

        // Determine member counts
        foreach (DataRow chapterRow in chapterSearchResult.Table.Rows)
        {
            activeMemberCount += !chapterRow.Table.Columns.Contains("ActiveMemberCount") || chapterRow["ActiveMemberCount"] == DBNull.Value ? 0 : (int)chapterRow["ActiveMemberCount"];
            memberCount       += !chapterRow.Table.Columns.Contains("TotalMemberCount") || chapterRow["TotalMemberCount"] == DBNull.Value ? 0 : (int)chapterRow["TotalMemberCount"];
        }

        childOrganizationalLayers = new Dictionary <string, List <DataRow> >();
        foreach (DataRow drOrganizationalLayer in searchResults.Single(x => x.ID == msOrganizationalLayer.CLASS_NAME).Table.Rows)
        {
            string typeName = (string)drOrganizationalLayer["Type.Name"];

            if (!childOrganizationalLayers.ContainsKey(typeName))
            {
                childOrganizationalLayers.Add(typeName, new List <DataRow>());
            }

            childOrganizationalLayers[typeName].Add(drOrganizationalLayer);
        }

        leader = ConvertLeaderSearchResult(searchResults.Single(x => x.ID == "OrganizationalLayerLeader"));
    }
Exemple #21
0
    private void _runSearch()
    {
        var sMembership = new Search {
            Type = msMembership.CLASS_NAME, ID = msMembership.CLASS_NAME
        };

        sMembership.AddCriteria(Expr.Equals("ID", ContextID));

        // output columns
        sMembership.AddOutputColumn("LocalID");
        sMembership.AddOutputColumn("Owner.LocalID");
        sMembership.AddOutputColumn("Owner.Name");
        sMembership.AddOutputColumn("JoinDate");
        sMembership.AddOutputColumn("ExpirationDate");
        sMembership.AddOutputColumn("RenewalDate");
        sMembership.AddOutputColumn("Approved");
        sMembership.AddOutputColumn("Status.Name");
        sMembership.AddOutputColumn("Type.Name");
        sMembership.AddOutputColumn("Product.Name");
        sMembership.AddOutputColumn("TerminationDate");
        sMembership.AddOutputColumn("SavedPaymentMethod.Name");

        sMembership.AddOutputColumn("TerminationReason.Name");
        sMembership.AddOutputColumn("ReceivesMemberBenefits");
        sMembership.AddOutputColumn("MembershipDirectoryOptOut");

        var sChapters = new Search {
            Type = msChapterMembership.CLASS_NAME, ID = msChapterMembership.CLASS_NAME
        };

        sChapters.AddCriteria(Expr.Equals("Membership", ContextID));
        sChapters.AddOutputColumn("Chapter");
        sChapters.AddOutputColumn("Chapter.Name");
        sChapters.AddOutputColumn("JoinDate");
        sChapters.AddOutputColumn("ExpirationDate");
        sChapters.AddSortColumn("ExpirationDate", true);
        sChapters.AddSortColumn("JoinDate", true);

        var sSections = new Search {
            Type = msSectionMembership.CLASS_NAME, ID = msSectionMembership.CLASS_NAME
        };

        sSections.AddCriteria(Expr.Equals("Membership", ContextID));
        sSections.AddOutputColumn("Section.Name");
        sSections.AddOutputColumn("JoinDate");
        sSections.AddOutputColumn("ExpirationDate");
        sSections.AddSortColumn("ExpirationDate", true);
        sSections.AddSortColumn("JoinDate", true);

        var sAuditLogs = new Search {
            Type = msAuditLog.CLASS_NAME, ID = msAuditLog.CLASS_NAME
        };

        sAuditLogs.AddCriteria(Expr.Equals(msAuditLog.FIELDS.AffectedRecord_ID, ContextID));
        sAuditLogs.AddCriteria(Expr.IsOneOfTheFollowing(msAuditLog.FIELDS.Type, new List <string> {
            "Renewal", "Drop"
        }));
        sAuditLogs.AddOutputColumn("Type_Name");
        sAuditLogs.AddOutputColumn("Actor.Name");
        sAuditLogs.AddOutputColumn("CreatedDate");
        sAuditLogs.AddSortColumn("CreatedDate", true);

        var sAddOns = new Search("MembershipAddOn");

        sAddOns.ID = "AddOns";
        sAddOns.AddCriteria(Expr.Equals("Membership", ContextID));
        sAddOns.AddOutputColumn("Merchandise.Name");
        sAddOns.AddOutputColumn("Quantity");
        sAddOns.AddOutputColumn("Price");
        sAddOns.AddOutputColumn("Renewable");
        sAddOns.AddSortColumn("ListIndex");

        var searchesToRun = new List <Search> {
            sMembership, sChapters, sSections, sAuditLogs, sAddOns
        };

        var searchResults = APIExtensions.GetMultipleSearchResults(searchesToRun, 0, null);

        drMembership = searchResults[0].Table.Rows[0];

        dvChapterMembership = new DataView(searchResults.Single(x => x.ID == msChapterMembership.CLASS_NAME).Table);
        dvSectionMembership = new DataView(searchResults.Single(x => x.ID == msSectionMembership.CLASS_NAME).Table);
        dvAuditLogs         = new DataView(searchResults.Single(x => x.ID == msAuditLog.CLASS_NAME).Table);
        dvAddOns            = new DataView(searchResults.Single(x => x.ID == "AddOns").Table);

        // bind chapters
        if (dvChapterMembership.Count > 0)
        {
            tdChapters.Visible    = true;
            gvChapters.DataSource = dvChapterMembership;
            gvChapters.DataBind();
        }

        // bind sections
        if (dvSectionMembership.Count > 0)
        {
            tdSections.Visible    = true;
            gvSections.DataSource = dvSectionMembership;
            gvSections.DataBind();
        }

        // bind history
        if (dvAuditLogs.Count > 0)
        {
            divHistory.Visible   = true;
            gvHistory.DataSource = dvAuditLogs;
            gvHistory.DataBind();
        }

        if (dvAddOns.Count > 0)
        {
            divAddOns.Visible   = true;
            gvAddOns.DataSource = dvAddOns;
            gvAddOns.DataBind();
        }

        CustomFieldSet1.DataBind();
    }
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        // Competition Entry with expanded reference fields
        var sCompetitionEntry = new Search(msCompetitionEntry.CLASS_NAME)
        {
            ID = msCompetitionEntry.CLASS_NAME
        };

        sCompetitionEntry.AddOutputColumn("ID");
        sCompetitionEntry.AddOutputColumn("Name");
        sCompetitionEntry.AddOutputColumn("LocalID");
        sCompetitionEntry.AddOutputColumn("DateSubmitted");
        sCompetitionEntry.AddOutputColumn("Entrant.Name");
        sCompetitionEntry.AddOutputColumn("Individual.PrimaryOrganization.Name");
        sCompetitionEntry.AddOutputColumn("Individual.PrimaryOrganization._Preferred_Address_City");
        sCompetitionEntry.AddOutputColumn("Individual.PrimaryOrganization._Preferred_Address_State");
        sCompetitionEntry.AddCriteria(Expr.Equals("ID", targetCompetitionEntry.ID));
        sCompetitionEntry.AddSortColumn("ID");

        searches.Add(sCompetitionEntry);

        // Scores
        var sScoreCards = new Search(msScoreCard.CLASS_NAME)
        {
            ID = msScoreCard.CLASS_NAME
        };

        sScoreCards.AddOutputColumn("ID");
        sScoreCards.AddOutputColumn("Entry.ID");
        sScoreCards.AddOutputColumn("TotalScore");
        sScoreCards.AddCriteria(Expr.Equals("Entry.ID", targetCompetitionEntry.ID));
        sScoreCards.AddSortColumn("ID");

        searches.Add(sScoreCards);

        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        var srCompetitionEntries = searchResults.Single(x => x.ID == msCompetitionEntry.CLASS_NAME);

        if (srCompetitionEntries.Table != null && srCompetitionEntries.Table.Rows.Count > 0)
        {
            drCompetitionEntry = srCompetitionEntries.Table.Rows[0];
        }

        // Calculate average and total scores
        totalScore = averageScore = 0;

        var srScoreCards = searchResults.Single(x => x.ID == msScoreCard.CLASS_NAME);

        if (srScoreCards.Table != null)
        {
            foreach (DataRow drScoreCard in srScoreCards.Table.Rows)
            {
                totalScore += (decimal)drScoreCard["TotalScore"];
            }

            if (srScoreCards.Table.Rows.Count > 0)
            {
                averageScore = totalScore / srScoreCards.Table.Rows.Count;
            }
        }
    }
Exemple #23
0
    private List <SearchResult> runAllNecessarySearches()
    {
        var searchesToRun = new List <Search>();

        // first, the main search
        var sMain = new Search {
            Type = CurrentEntity.ClassType, ID = "Main"
        };

        sMain.AddCriteria(Expr.Equals("ID", CurrentEntity.ID));

        // check for failed deferred billing schedules
        var sBillingSchedule = new Search(msBillingSchedule.CLASS_NAME)
        {
            ID = "BillingSchedules"
        };

        sBillingSchedule.AddCriteria(Expr.Equals("Order.BillTo", CurrentEntity.ID));
        sBillingSchedule.AddCriteria(Expr.Equals(msBillingSchedule.FIELDS.Status, "Suspended"));
        searchesToRun.Add(sBillingSchedule);

        // always prepare the main widget
        prepareWidget(sMain, searchesToRun, ucMyProfile1);

        //Accounting Widget
        if (IsModuleActive("Financial"))
        {
            prepareWidget(sMain, searchesToRun, ucMyAccount);
        }
        else
        {
            ucMyAccount.Visible = false;
        }

        //Membership Widget
        if (IsModuleActive("Membership"))
        {
            prepareWidget(sMain, searchesToRun, ucMembership);
        }
        else
        {
            ucMembership.Visible = false;
        }

        //Committees Widget
        if (IsModuleActive("Committees"))
        {
            prepareWidget(sMain, searchesToRun, ucCommittees);
        }
        else
        {
            ucCommittees.Visible = false;
        }

        if (IsModuleActive("Events"))
        {
            prepareWidget(sMain, searchesToRun, ucEvents);
        }
        else
        {
            ucEvents.Visible = false;
        }

        if (IsModuleActive("Fundraising"))
        {
            prepareWidget(sMain, searchesToRun, ucFundraising);
        }
        else
        {
            ucFundraising.Visible = false;
        }

        if (IsModuleActive("Certifications"))
        {
            prepareWidget(sMain, searchesToRun, ucCEU);
        }
        else
        {
            ucCEU.Visible = false;
        }

        if (IsModuleActive("Awards"))
        {
            prepareWidget(sMain, searchesToRun, ucCompetitions);
        }
        else
        {
            ucCompetitions.Visible = false;
        }

        if (IsModuleActive("CareerCenter"))
        {
            prepareWidget(sMain, searchesToRun, ucCareerCenter);
        }
        else
        {
            ucCareerCenter.Visible = false;
        }

        if (IsModuleActive("Subscriptions"))
        {
            prepareWidget(sMain, searchesToRun, ucSubscriptions);
        }
        else
        {
            ucSubscriptions.Visible = false;
        }

        if (IsModuleActive("Discussions"))
        {
            prepareWidget(sMain, searchesToRun, ucDiscussions);
        }
        else
        {
            ucDiscussions.Visible = false;
        }


        searchesToRun.Add(sMain);

        addCustomSearches(searchesToRun);

        return(APIExtensions.GetMultipleSearchResults(searchesToRun, 0, null));
    }
    protected void loadDataFromConcierge()
    {
        var searches = new List <Search>();

        // Get all judging rounds related to the competition
        var sJudgingRounds = new Search(msJudgingRound.CLASS_NAME)
        {
            ID = msJudgingRound.CLASS_NAME
        };

        sJudgingRounds.AddOutputColumn("ID");
        sJudgingRounds.AddOutputColumn("Name");
        sJudgingRounds.AddOutputColumn("JudgingBegins");
        sJudgingRounds.AddOutputColumn("JudgingEnds");
        sJudgingRounds.AddCriteria(Expr.Equals("Competition.ID", targetCompetition.ID));
        sJudgingRounds.AddSortColumn("RoundNumber");
        searches.Add(sJudgingRounds);

        // Get the judging buckets related to this team and sort by name
        var sJudgingBuckets = new Search(msJudgingBucket.CLASS_NAME)
        {
            ID = msJudgingBucket.CLASS_NAME
        };

        sJudgingBuckets.AddOutputColumn("Name");
        var sJudgingBucketIdClause = new SearchOperationGroup {
            GroupType = SearchOperationGroupType.Or
        };

        foreach (var bucketId in targetJudgingTeam.Buckets)
        {
            sJudgingBucketIdClause.Criteria.Add(Expr.Equals("ID", bucketId));
        }
        sJudgingBuckets.AddCriteria(sJudgingBucketIdClause);
        sJudgingBuckets.AddSortColumn("Name");
        searches.Add(sJudgingBuckets);

        // Get the all the competition enties related to any of the buckets related to this team (we will filter based on bucket / round with data views later)
        var sCompetitionEntries = new Search(msCompetitionEntry.CLASS_NAME)
        {
            ID = msCompetitionEntry.CLASS_NAME
        };

        sCompetitionEntries.AddOutputColumn("ID");
        sCompetitionEntries.AddOutputColumn("Name");
        sCompetitionEntries.AddOutputColumn("JudgingBucket.ID");
        sCompetitionEntries.AddOutputColumn("JudgingRound.ID");
        sCompetitionEntries.AddOutputColumn("LocalID");
        sCompetitionEntries.AddOutputColumn("Entrant.Name");
        sCompetitionEntries.AddOutputColumn("Individual.PrimaryOrganization.Name");
        sCompetitionEntries.AddOutputColumn("Individual.PrimaryOrganization._Preferred_Address_City");
        sCompetitionEntries.AddOutputColumn("Individual.PrimaryOrganization._Preferred_Address_State");
        sJudgingBucketIdClause = new SearchOperationGroup {
            GroupType = SearchOperationGroupType.Or
        };
        foreach (var bucketId in targetJudgingTeam.Buckets)
        {
            sJudgingBucketIdClause.Criteria.Add(Expr.Equals("JudgingBucket.ID", bucketId));
        }
        sCompetitionEntries.AddCriteria(sJudgingBucketIdClause);
        searches.Add(sCompetitionEntries);

        // Get the score cards for the current user related to competition entries related to any of the buckets related to this team (we will filter based on bucket / round with data views later)
        var sScoreCards = new Search(msScoreCard.CLASS_NAME)
        {
            ID = msScoreCard.CLASS_NAME
        };

        sScoreCards.AddOutputColumn("ID");
        sScoreCards.AddOutputColumn("Round.ID");
        sScoreCards.AddOutputColumn("Entry.ID");
        sScoreCards.AddOutputColumn("TotalScore");
        sScoreCards.AddCriteria(Expr.Equals("Judge.ID", ConciergeAPI.CurrentEntity.ID));
        sJudgingBucketIdClause = new SearchOperationGroup {
            GroupType = SearchOperationGroupType.Or
        };
        foreach (var bucketId in targetJudgingTeam.Buckets)
        {
            sJudgingBucketIdClause.Criteria.Add(Expr.Equals("Entry.JudgingBucket.ID", bucketId));
        }
        sScoreCards.AddCriteria(sJudgingBucketIdClause);
        searches.Add(sScoreCards);

        // Execute the searches as a multi-search
        var searchResults = APIExtensions.GetMultipleSearchResults(searches, 0, null);

        // Handle the judging round results
        dtJudgingRounds            = searchResults.Single(x => x.ID == msJudgingRound.CLASS_NAME).Table;
        dtJudgingRounds.PrimaryKey = new[] { dtJudgingRounds.Columns["ID"] };

        // Handle the bucket results
        dvJudgingBuckets = new DataView(searchResults.Single(x => x.ID == msJudgingBucket.CLASS_NAME).Table);

        // Handle the competition entry results
        dtCompetitionEntries = searchResults.Single(x => x.ID == msCompetitionEntry.CLASS_NAME).Table;

        dtCompetitionEntries.Columns.Add("TeamID");
        foreach (DataRow dr in dtCompetitionEntries.Rows)
        {
            dr["TeamID"] = targetJudgingTeam.ID;    // set this up
        }
        DataColumn dcScore    = dtCompetitionEntries.Columns.Add("Score", typeof(decimal));
        DataColumn dcHasScore = dtCompetitionEntries.Columns.Add("HasScore", typeof(bool));

        dtScoreCards            = searchResults.Single(x => x.ID == msScoreCard.CLASS_NAME).Table;
        dtScoreCards.PrimaryKey = new[] { dtScoreCards.Columns["Entry.ID"], dtScoreCards.Columns["Round.ID"] };

        foreach (DataRow dataRow in dtCompetitionEntries.Rows)
        {
            DataRow drScoreCard = dtScoreCards.Rows.Find(new [] { dataRow["ID"], dataRow["JudgingRound.ID"] });
            bool    hasScore    = drScoreCard != null && drScoreCard["TotalScore"] != DBNull.Value;
            dataRow[dcHasScore] = hasScore;
            dataRow[dcScore]    = hasScore ? drScoreCard["TotalScore"] : 0;
        }
    }