/// <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();
    }
 protected void unbindAndSave()
 {
     unbindEventDiscountCode();
     targetEventInformationLink = SaveObject(targetEventInformationLink).ConvertTo <msEventInformationLink>();
 }
Esempio n. 3
0
 protected void loadDataFromConcierge(IConciergeAPIService serviceProxy)
 {
     targetEvent = serviceProxy.LoadObjectFromAPI <msEvent>(ContextID);
     targetEventInformationLink = serviceProxy.LoadObjectFromAPI <msEventInformationLink>(EventInformationLinkID);
 }