protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        targetObject = LoadObjectFromAPI <msAssociationDomainObject>(ContextID);
        if (targetObject == null)
        {
            GoToMissingRecordPage();
        }

        using (var api = GetServiceAPIProxy())
            switch (targetObject.ClassType)
            {
            case msGift.CLASS_NAME:
                BillingInfoWidget.AllowableMethods =
                    api.DetermineAllowableGiftPaymentMethods(targetObject).ResultValue;
                break;

            default:
                throw new NotSupportedException("Unable to update a record of type " + targetObject.ClassType);
            }

        hfOrderBillToId.Value = targetObject.SafeGetValue <string>(msGift.FIELDS.Donor);

        dvPriorityData.InnerHtml = GetPriorityPaymentsConfig(hfOrderBillToId.Value);
    }
    protected override void InitializeTargetObject()
    {
        base.InitializeTargetObject();

        targetObject = LoadObjectFromAPI <msAssociationDomainObject>(ContextID);


        // determine allowed payments
        PortalPaymentMethods methods;

        using (var api = GetServiceAPIProxy())
            switch (targetObject.ClassType)
            {
            case msMembership.CLASS_NAME:
                msOrder targetOrder = new msOrder();
                targetOrder.BillTo    = targetOrder.ShipTo = targetObject.SafeGetValue <string>("Owner");
                targetOrder.LineItems = new List <msOrderLineItem>();
                targetOrder.LineItems.Add(new msOrderLineItem
                {
                    Product = targetObject.SafeGetValue <string>(msMembership.FIELDS.Product)
                });

                methods = api.DetermineAllowableOrderPaymentMethods(targetOrder).ResultValue;

                break;

            case msSubscription.CLASS_NAME:
                msOrder targetOrder2 = new msOrder();
                targetOrder2.BillTo    = targetOrder2.ShipTo = targetObject.SafeGetValue <string>("Owner");
                targetOrder2.LineItems = new List <msOrderLineItem>();
                targetOrder2.LineItems.Add(new msOrderLineItem
                {
                    Product = targetObject.SafeGetValue <string>(msSubscription.FIELDS.Fee)
                });

                methods = api.DetermineAllowableOrderPaymentMethods(targetOrder2).ResultValue;

                break;

            case msGift.CLASS_NAME:
                methods = api.DetermineAllowableGiftPaymentMethods(targetObject).ResultValue;
                break;

            default:
                throw new NotSupportedException("Cannot deal with class type " + targetObject.ClassType);
            }
        // some payments NEVER make sense in this context
        methods.AllowBillMeLater           = false;
        BillingInfoWidget.AllowableMethods = methods;

        hfOrderBillToId.Value = ConciergeAPI.CurrentEntity.ID;

        dvPriorityData.InnerHtml = GetPriorityPaymentsConfig(hfOrderBillToId.Value);
    }