Exemple #1
0
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        var targetObject = APIExtensions.LoadObjectFromAPI(ContextID);

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

        switch (targetObject.ClassType)
        {
        case msDiscussionTopic.CLASS_NAME:
            targetDiscussionTopic = targetObject.ConvertTo <msDiscussionTopic>();
            targetForum           = LoadObjectFromAPI <msForum>(targetDiscussionTopic.Forum);
            TargetDiscussionBoard = LoadObjectFromAPI <msDiscussionBoard>(targetForum.DiscussionBoard);
            break;

        case msForum.CLASS_NAME:
            targetForum           = targetObject.ConvertTo <msForum>();
            TargetDiscussionBoard = LoadObjectFromAPI <msDiscussionBoard>(targetForum.DiscussionBoard);
            break;

        case msDiscussionBoard.CLASS_NAME:
            TargetDiscussionBoard = targetObject.ConvertTo <msDiscussionBoard>();
            break;
        }

        if (targetObject.ParentTypes.Contains(msDiscussionBoard.CLASS_NAME))
        {
            TargetDiscussionBoard = targetObject.ConvertTo <msDiscussionBoard>();
        }
    }
Exemple #2
0
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        if (ContextID == null)
        {
            GoToMissingRecordPage();
        }

        Search s = new Search(msPayment.CLASS_NAME);

        s.AddCriteria(Expr.Equals("ID", ContextID));
        s.AddOutputColumn("LocalID");
        s.AddOutputColumn("Date");
        s.AddOutputColumn("Total");
        s.AddOutputColumn("Owner.Name");
        s.AddOutputColumn("Owner");
        s.AddOutputColumn("AmountRefunded");
        s.AddOutputColumn("BillingAddress");


        var sr = APIExtensions.GetSearchResult(s, 0, 1);

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

        targetPayment = sr.Table.Rows[0];

        if (string.IsNullOrWhiteSpace(LeaderOfId))
        {
            return;
        }

        var leaderOf = APIExtensions.LoadObjectFromAPI(LeaderOfId);

        switch (leaderOf.ClassType)
        {
        case msChapter.CLASS_NAME:
            targetChapter = leaderOf.ConvertTo <msChapter>();
            break;

        case msSection.CLASS_NAME:
            targetSection = leaderOf.ConvertTo <msSection>();
            break;

        case msOrganizationalLayer.CLASS_NAME:
            targetOrganizationalLayer = leaderOf.ConvertTo <msOrganizationalLayer>();
            break;

        default:
            QueueBannerError(string.Format("Invalid leader object type specified '{0}'",
                                           leaderOf.ClassType));
            GoHome();
            return;
        }
    }
    /// <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();

        //Describe a Historical Transaction.  We will need this metadata to bind to the acceptable values for certain fields and for creating a new event
        using (IConciergeAPIService proxy = GetConciegeAPIProxy())
        {
            historicalTransactionClassMetadata = proxy.DescribeObject(msHistoricalTransaction.CLASS_NAME).ResultValue;
            historicalTransactionFieldMetadata = historicalTransactionClassMetadata.GenerateFieldDictionary();
        }

        var contextObject = APIExtensions.LoadObjectFromAPI(ContextID);

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

        switch (contextObject.ClassType)
        {
        case msOrder.CLASS_NAME:
            targetOrder = contextObject.ConvertTo <msOrder>();
            targetHistoricalTransaction =
                msHistoricalTransaction.FromClassMetadata(historicalTransactionClassMetadata);
            targetHistoricalTransaction.Type = HistoricalTransactionType.Payment;
            break;

        case msHistoricalTransaction.CLASS_NAME:
            targetHistoricalTransaction = contextObject.ConvertTo <msHistoricalTransaction>();
            targetOrder = LoadObjectFromAPI <msOrder>(targetHistoricalTransaction.Order);
            break;

        default:
            QueueBannerError(string.Format("Unknown context object type supplied '{0}'.", contextObject.ClassType));
            GoHome();
            return;
        }

        targetEvent = LoadObjectFromAPI <msEvent>(EventId);

        if (targetOrder == null || targetHistoricalTransaction == null || targetEvent == null)
        {
            GoToMissingRecordPage();
            return;
        }

        loadEventOwners();
    }
    /// <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();

        var target = APIExtensions.LoadObjectFromAPI(ContextID);

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

        // If we are starting with a Registration, go to that setup process
        if (target.ClassType == msEventRegistration.CLASS_NAME)
        {
            targetRegistration = target.ConvertTo <msEventRegistration>();
            LoadExistingRegistration();
            return;
        }

        // If this is not a Registration or an Event, then get out of here
        if (target.ClassType != msEvent.CLASS_NAME)
        {
            GoToMissingRecordPage();
            return;
        }

        targetEvent = target.ConvertTo <msEvent>();

        targetOrder           = MultiStepWizards.RegisterForEvent.Order;
        targetRegistrationFee = MultiStepWizards.RegisterForEvent.RegistrationFee;
        MultiStepWizards.RegisterForEvent.IsSessionSwap = false;

        if (targetOrder == null || string.IsNullOrWhiteSpace(targetOrder.BillTo) || string.IsNullOrWhiteSpace(targetOrder.ShipTo) || targetRegistrationFee == null)
        {
            GoTo(string.Format("~/events/Register_SelectFee.aspx?contextID={0}", targetEvent.ID));
            return;
        }

        registrantId = targetOrder.BillTo;
        if (string.IsNullOrEmpty(registrantId))
        {
            GoToMissingRecordPage();
            return;
        }

        loadEventOwners();
    }
Exemple #5
0
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        var targetObject = APIExtensions.LoadObjectFromAPI(ContextID);

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

        switch (targetObject.ClassType)
        {
        case msDiscussionTopic.CLASS_NAME:
            targetDiscussionTopic = targetObject.ConvertTo <msDiscussionTopic>();
            targetForum           = LoadObjectFromAPI <msForum>(targetDiscussionTopic.Forum);
            targetDiscussionPost  = CreateNewObject <msDiscussionPost>();
            break;

        case msDiscussionPost.CLASS_NAME:
            targetDiscussionPost  = targetObject.ConvertTo <msDiscussionPost>();
            targetDiscussionTopic = LoadObjectFromAPI <msDiscussionTopic>(targetDiscussionPost.Topic);
            targetForum           = LoadObjectFromAPI <msForum>(targetDiscussionTopic.Forum);
            editMode = true;
            break;

        default:
            QueueBannerError("Unexpected context type: " + targetObject.ClassType);
            GoHome();
            break;
        }

        if (targetForum == null || targetDiscussionTopic == null)
        {
            GoToMissingRecordPage();
            return;
        }

        TargetDiscussionBoard = LoadObjectFromAPI <msDiscussionBoard>(targetForum.DiscussionBoard);

        if (!string.IsNullOrWhiteSpace(ReplyToId))
        {
            replyToPost = LoadObjectFromAPI <msDiscussionPost>(ReplyToId);
        }

        loadSubscription();
    }
Exemple #6
0
    /// <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();

        //Describe an Event Discount Code.  We will need this metadata to bind to the acceptable values for certain fields and for creating a new Discount / Promo Code
        using (IConciergeAPIService proxy = GetConciegeAPIProxy())
        {
            emailTemplateContainerClassMetadata = proxy.DescribeObject(msEmailTemplateContainer.CLASS_NAME).ResultValue;
            emailTemplateContainerFieldMetadata = emailTemplateContainerClassMetadata.GenerateFieldDictionary();
        }

        var contextObject = APIExtensions.LoadObjectFromAPI(ContextID);

        if (contextObject.ClassType == msEvent.CLASS_NAME)
        {
            targetEvent = contextObject.ConvertTo <msEvent>();
            targetEmailTemplateContainer          = msEmailTemplateContainer.FromClassMetadata(emailTemplateContainerClassMetadata);
            targetEmailTemplateContainer.Template = new EmailTemplate {
                SearchType = "EventRegistration"
            };
            lblTitleAction.Text = "Create";
        }
        else
        {
            targetEmailTemplateContainer = contextObject.ConvertTo <msEmailTemplateContainer>();
            targetEvent = LoadObjectFromAPI <msEvent>(targetEmailTemplateContainer.Context);
            if (targetEmailTemplateContainer.Template == null)
            {
                targetEmailTemplateContainer.Template = new EmailTemplate {
                    SearchType = "EventRegistration"
                }
            }
            ;
            lblTitleAction.Text = "Edit";
        }

        if (targetEvent == null || targetEmailTemplateContainer == null)
        {
            GoToMissingRecordPage();
            return;
        }

        targetEmailTemplateContainer.Context = targetEmailTemplateContainer.Template.SearchContext = targetEvent.ID;

        loadEventOwners();
    }
Exemple #7
0
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();
        targetForm = LoadObjectFromAPI <msCustomObjectPortalForm>(ContextID);
        if (targetForm == null)
        {
            GoToMissingRecordPage();
        }

        string entityID = null;

        if (ConciergeAPI.CurrentEntity != null)
        {
            entityID = ConciergeAPI.CurrentEntity.ID;
        }

        using (var api = GetServiceAPIProxy())
            targetFormManifest = api.DescribePortalForm(targetForm.ID, entityID).ResultValue;

        // MS-5922 - only check this on initial load so that it will not fail on completion of creation of last allowed instance
        if (!IsPostBack)
        {
            if (!targetFormManifest.CanCreate)
            {
                GoTo("/AccessDenied.aspx");
            }
        }

        if (ConciergeAPI.CurrentEntity == null && !targetForm.AllowAnonymousSubmissions)  // we need them to go through registration
        {
            GoTo("~/profile/CreateAccount_BasicInfo.aspx?t=PortalForm&formID=" + targetForm.ID);
            return;
        }

        // ok, so we allow anonymous submissions here
        // MS-5360
        if (string.IsNullOrWhiteSpace(CurrentFormID.Value))
        {
            targetInstance          = MetadataLogic.CreateNewObject(targetFormManifest.UnderlyingObjectName);
            targetInstance["Owner"] = entityID;
        }
        else
        {
            targetInstance = APIExtensions.LoadObjectFromAPI(CurrentFormID.Value);
        }
    }
Exemple #8
0
    /// <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();

        //Describe an Event Discount Code.  We will need this metadata to bind to the acceptable values for certain fields and for creating a new Discount / Promo Code
        using (IConciergeAPIService proxy = GetConciegeAPIProxy())
        {
            customFieldClassMetadata = proxy.DescribeObject(msCustomField.CLASS_NAME).ResultValue;
            customFieldFieldMetadata = customFieldClassMetadata.GenerateFieldDictionary();
        }

        var contextObject = APIExtensions.LoadObjectFromAPI(ContextID);

        if (contextObject.ClassType == msEvent.CLASS_NAME)
        {
            targetEvent       = contextObject.ConvertTo <msEvent>();
            targetCustomField = msCustomField.FromClassMetadata(customFieldClassMetadata);
            targetCustomField.FieldDefinition = new FieldMetadata();
            lblTitleAction.Text = "Create";
            isInEditMode        = false;
        }
        else
        {
            targetCustomField = contextObject.ConvertTo <msCustomField>();
            targetEvent       = LoadObjectFromAPI <msEvent>(targetCustomField.Event);
            if (targetCustomField.FieldDefinition == null)
            {
                targetCustomField.FieldDefinition = new FieldMetadata();
            }
            lblTitleAction.Text = "Edit";
            isInEditMode        = true;
        }

        if (targetEvent == null || targetCustomField == null)
        {
            GoToMissingRecordPage();
            return;
        }

        targetCustomField.Event          = targetEvent.ID;
        targetCustomField.ApplicableType = "DEMOGRAPHIC";
        targetCustomField.Type           = CustomFieldType.EventRegistration;

        loadEventOwners();
    }
Exemple #9
0
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        var targetObject = APIExtensions.LoadObjectFromAPI(ContextID);

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

        switch (targetObject.ClassType)
        {
        case msForum.CLASS_NAME:
            targetForum           = targetObject.ConvertTo <msForum>();
            targetDiscussionTopic = CreateNewObject <msDiscussionTopic>();
            break;

        case msDiscussionTopic.CLASS_NAME:
            targetDiscussionTopic = targetObject.ConvertTo <msDiscussionTopic>();
            targetForum           = LoadObjectFromAPI <msForum>(targetDiscussionTopic.Forum);
            editMode = true;
            break;

        default:
            QueueBannerError("Unexpected context type: " + targetObject.ClassType);
            GoHome();
            break;
        }

        if (targetForum == null || targetDiscussionTopic == null)
        {
            GoToMissingRecordPage();
            return;
        }

        TargetDiscussionBoard = LoadObjectFromAPI <msDiscussionBoard>(targetForum.DiscussionBoard);

        //You can never edit the initial post from this page - that is done by editing the post directly
        targetDiscussionPost = CreateNewObject <msDiscussionPost>();
    }
Exemple #10
0
    /// <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();

        targetRelationship = LoadObjectFromAPI <msRelationship>(ContextID);
        if (targetRelationship == null)
        {
            GoToMissingRecordPage();
            return;
        }

        targetRelationshipType = LoadObjectFromAPI <msRelationshipType>(targetRelationship.Type);
        if (targetRelationshipType == null)
        {
            GoToMissingRecordPage();
            return;
        }

        leftSide  = APIExtensions.LoadObjectFromAPI(targetRelationship.LeftSide);
        rightSide = APIExtensions.LoadObjectFromAPI(targetRelationship.RightSide);
    }
Exemple #11
0
    /// <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();

        targetEntity = string.IsNullOrWhiteSpace(ContextID) ? ConciergeAPI.CurrentEntity : LoadObjectFromAPI <msEntity>(ContextID);

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

        if (string.IsNullOrWhiteSpace(LeaderOfId))
        {
            return;
        }

        var leaderOf = APIExtensions.LoadObjectFromAPI(LeaderOfId);

        switch (leaderOf.ClassType)
        {
        case msChapter.CLASS_NAME:
            targetChapter = leaderOf.ConvertTo <msChapter>();
            break;

        case msSection.CLASS_NAME:
            targetSection = leaderOf.ConvertTo <msSection>();
            break;

        case msOrganizationalLayer.CLASS_NAME:
            targetOrganizationalLayer = leaderOf.ConvertTo <msOrganizationalLayer>();
            break;

        default:
            QueueBannerError(string.Format("Invalid leader object type specified '{0}'",
                                           leaderOf.ClassType));
            GoHome();
            return;
        }
    }
Exemple #12
0
    /// <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();


        var contextObject = APIExtensions.LoadObjectFromAPI(ContextID);

        switch (contextObject.ClassType)
        {
        case msEvent.CLASS_NAME:
            targetEvent    = LoadObjectFromAPI <msEvent>(ContextID);
            targetAbstract = new msAbstract
            {
                Owner = ConciergeAPI.CurrentEntity.ID,
                Event = targetEvent.ID
            };
            break;

        case msAbstract.CLASS_NAME:
            targetAbstract = LoadObjectFromAPI <msAbstract>(ContextID);
            if (targetAbstract == null)
            {
                GoToMissingRecordPage();
                return;
            }
            targetEvent = LoadObjectFromAPI <msEvent>(targetAbstract.Event);
            break;

        default:
            QueueBannerError("Invalid context supplied.");
            GoHome();
            return;
        }

        if (targetEvent == null)
        {
            GoToMissingRecordPage();
            return;
        }
    }
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        var targetObject = APIExtensions.LoadObjectFromAPI(ContextID);

        if (targetObject != null && targetObject.ParentTypes.Contains(msDiscussionBoard.CLASS_NAME))
        {
            TargetDiscussionBoard = targetObject.ConvertTo <msDiscussionBoard>();
        }
        else
        {
            using (IConciergeAPIService proxy = GetConciegeAPIProxy())
            {
                TargetDiscussionBoard = proxy.GetDiscussionBoard(ContextID).ResultValue.ConvertTo <msDiscussionBoard>();
            }
        }

        if (TargetDiscussionBoard == null)
        {
            GoToMissingRecordPage();
            return;
        }
    }
Exemple #14
0
    public static void CheckToSeeIfMultipleIdentitiesAreAccessible()
    {
        // now - are there alternate accessible entities?
        var entities = ConciergeAPI.AccessibleEntities;

        if (entities == null || entities.Count == 0) // well, what entity do we login as?
        {
            return;
        }

        // automatically insert the current entity
        if (!entities.Exists(x => x.ID == ConciergeAPI.CurrentEntity.ID))
        {
            entities.Insert(0, new LoginResult.AccessibleEntity
            {
                ID   = ConciergeAPI.CurrentEntity.ID,
                Name = ConciergeAPI.CurrentEntity.Name,
                Type = ConciergeAPI.CurrentEntity.ClassType
            });

            ConciergeAPI.AccessibleEntities = entities;
            // remember, the session is out of proc, so we need to restore it
        }

        msPortalUser currentUser = ConciergeAPI.CurrentUser;

        if (currentUser.LastLoggedInAs != null && entities.Exists(x => x.ID == currentUser.LastLoggedInAs))
        {
            // use this one
            ConciergeAPI.CurrentEntity = APIExtensions.LoadObjectFromAPI <msEntity>(currentUser.LastLoggedInAs);
            return;
        }

        // we have multiple identiites
        HttpContext.Current.Response.Redirect("/MultipleEntitiesDetected.aspx?redirectURL=" + HttpContext.Current.Request.QueryString["redirectURL"]);
    }
    /// <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();

        //Describe an Event Information Link.  We will need this metadata to bind to the acceptable values for certain fields and for creating a new Information link
        using (IConciergeAPIService proxy = GetConciegeAPIProxy())
        {
            eventInformationLinkClassMetadata = proxy.DescribeObject(msEventInformationLink.CLASS_NAME).ResultValue;
            eventInformationLinkFieldMetadata = eventInformationLinkClassMetadata.GenerateFieldDictionary();
        }

        var contextObject = APIExtensions.LoadObjectFromAPI(ContextID);

        if (contextObject.ClassType == msEvent.CLASS_NAME)
        {
            targetEvent = contextObject.ConvertTo <msEvent>();
            targetEventInformationLink = msEventInformationLink.FromClassMetadata(eventInformationLinkClassMetadata);
            lblTitleAction.Text        = "Create";
        }
        else
        {
            targetEventInformationLink = contextObject.ConvertTo <msEventInformationLink>();
            targetEvent         = LoadObjectFromAPI <msEvent>(targetEventInformationLink.Event);
            lblTitleAction.Text = "Edit";
        }

        if (targetEvent == null || targetEventInformationLink == null)
        {
            GoToMissingRecordPage();
            return;
        }

        targetEventInformationLink.Event = targetEvent.ID;

        loadEventOwners();
    }
Exemple #16
0
    /// <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();

        var contextObject = APIExtensions.LoadObjectFromAPI(ContextID);

        switch (contextObject.ClassType)
        {
        case "CompetitionEntry":
            targetCompetitionEntry = contextObject.ConvertTo <msCompetitionEntry>();
            targetCompetition      = LoadObjectFromAPI <msCompetition>(targetCompetitionEntry.Competition);
            targetCompetitionInfo  = targetCompetition.GetCompetitionEntryInformation();
            MultiStepWizards.EnterCompetition.EntryFee = LoadObjectFromAPI <msCompetitionEntryFee>(targetCompetitionEntry.EntryFee);
            break;

        case "Competition":
            targetCompetition      = contextObject.ConvertTo <msCompetition>();
            targetCompetitionInfo  = targetCompetition.GetCompetitionEntryInformation();
            targetCompetitionEntry = new msCompetitionEntry
            {
                Competition = targetCompetition.ID,
                Entrant     = ConciergeAPI.CurrentEntity.ID,
                Status      = targetCompetitionInfo.PendingPaymentStatusId
            };

            // If the fee is null make sure it is allowed to be. If a session expires in the middle of the form, the user will be
            // redirected here without the proper Fee in session state.
            if (MultiStepWizards.EnterCompetition.EntryFee == null &&
                targetCompetitionInfo.CompetitionEntryFees.Count > 0)
            {
                if (targetCompetitionInfo.CompetitionEntryFees.Count > 1)
                {
                    Response.Redirect("~/competitions/ApplyToCompetition.aspx?contextID=" + ContextID);
                }

                MultiStepWizards.EnterCompetition.EntryFee = LoadObjectFromAPI <msCompetitionEntryFee>(targetCompetitionInfo.CompetitionEntryFees[0].ProductID);
            }

            break;

        default:
            QueueBannerError("Unknown context object supplied.");
            GoHome();
            return;
        }

        if (targetCompetition == null || targetCompetitionEntry == null || targetCompetitionInfo == null)
        {
            GoToMissingRecordPage();
            return;
        }

        using (IConciergeAPIService proxy = GetConciegeAPIProxy())
        {
            var s = new Search(msCustomField.CLASS_NAME);
            s.AddCriteria(Expr.Equals(msCustomField.FIELDS.Competition, targetCompetition.ID));

            targetCompetitionQuestions =
                proxy.GetObjectsBySearch(s, null, 0, null).
                ResultValue.Objects.ConvertTo <msCustomField>();

            // sort the competition questions - MS-2648
            targetCompetitionQuestions.Sort((x, y) => x.DisplayOrder.CompareTo(y.DisplayOrder));
        }
    }
Exemple #17
0
 // Leaving here to prevent mass updates to pages calling this
 protected T LoadObjectFromAPI <T>(string id) where T : msAggregate
 {
     return(APIExtensions.LoadObjectFromAPI <T>(id));
 }
Exemple #18
0
    /// <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();

        //Describe an event.  We will need this metadata to bind to the acceptable values for certain fields and for creating a new event
        using (IConciergeAPIService proxy = GetConciegeAPIProxy())
        {
            eventClassMetadata = proxy.DescribeObject(msEvent.CLASS_NAME).ResultValue;
            eventFieldMetadata = eventClassMetadata.GenerateFieldDictionary();
        }

        targetEvent = msEvent.FromClassMetadata(eventClassMetadata);

        if (!string.IsNullOrWhiteSpace(ContextID))
        {
            //Load the context object and determine the owner from the class type
            var contextobject = APIExtensions.LoadObjectFromAPI(ContextID);
            if (contextobject == null)
            {
                GoToMissingRecordPage();
                return;
            }


            switch (contextobject.ClassType)
            {
            case msChapter.CLASS_NAME:
                targetChapter       = contextobject.ConvertTo <msChapter>();
                targetEvent.Chapter = ContextID;
                break;

            case msSection.CLASS_NAME:
                targetSection       = contextobject.ConvertTo <msSection>();
                targetEvent.Section = ContextID;
                break;

            case msOrganizationalLayer.CLASS_NAME:
                targetOrganizationalLayer       = contextobject.ConvertTo <msOrganizationalLayer>();
                targetEvent.OrganizationalLayer = ContextID;
                break;

            case msEvent.CLASS_NAME:
                targetEvent  = LoadObjectFromAPI <msEvent>(ContextID);
                IsInEditMode = true;
                if (targetEvent == null)
                {
                    GoToMissingRecordPage();
                    return;
                }
                break;

            default:
                QueueBannerError(string.Format("Invalid context object type specified '{0}'",
                                               contextobject.ClassType));
                GoHome();
                return;
            }
        }

        if (!string.IsNullOrWhiteSpace(targetEvent.Chapter))
        {
            targetChapter = LoadObjectFromAPI <msChapter>(targetEvent.Chapter);
        }

        if (!string.IsNullOrWhiteSpace(targetEvent.Section))
        {
            targetSection = LoadObjectFromAPI <msSection>(targetEvent.Section);
        }

        if (!string.IsNullOrWhiteSpace(targetEvent.OrganizationalLayer))
        {
            targetOrganizationalLayer = LoadObjectFromAPI <msOrganizationalLayer>(targetEvent.OrganizationalLayer);
        }
    }