Exemple #1
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();
        targetMembership = LoadObjectFromAPI <msMembership>(ContextID);

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

        owner = LoadObjectFromAPI <msEntity>(targetMembership.Owner);
        if (owner == null)
        {
            GoToMissingRecordPage();
            return;
        }

        _runSearch();

        string info = GetMembershipField("SavedPaymentMethod.Name");

        if (info != null)
        {
            lblPaymentInfo.Text = info;
        }

        // only show termination if terminated
        trTermination.Visible = drMembership["TerminationDate"] != DBNull.Value;

        loadLeaders();
    }
 protected override void InitializeTargetObject()
 {
     base.InitializeTargetObject();
     targetMembership = LoadObjectFromAPI <msMembership>(ContextID);
     if (targetMembership == null)
     {
         GoToMissingRecordPage();
     }
 }
    /// <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();

        if (Complete)
        {
            ClearAndRedirect();
        }

        targetMembership = MultiStepWizards.RenewMembership.Membership;
        targetEntity     = MultiStepWizards.RenewMembership.Entity;

        if (targetMembership == null || targetMembership.MembershipOrganization == null || targetEntity == null) // session expired, go back home
        {
            GoHome();
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!IsValid)
        {
            return;
        }
        selectedMembershipTypeID = Request.Form["MembershipType"];
        if (selectedMembershipTypeID == null)
        {
            return;
        }

        string selectedMembershipTypeName = null;
        string selectedMembershipFeeName  = null;

        // let's go through every repeater item and figure out the membership type and product
        foreach (RepeaterItem ri in rptMembershipTypes.Items)
        {
            HiddenField hfMembershipType = (HiddenField)ri.FindControl("hfMembershipType");

            if (hfMembershipType.Value != selectedMembershipTypeID)   // this isn't the one
            {
                continue;
            }

            // ok, this is the one
            var             lblMembershipType = (Label)ri.FindControl("lblMembershipType");
            RadioButtonList rblSubCategory    = (RadioButtonList)ri.FindControl("rblSubCategory");

            // this shouldn't happen, since we tested for blank items
            // when we rendered the membership type, and we didn't render any membership type
            // with no products - but defensive programming
            if (rblSubCategory.Items.Count == 0)
            {
                return;
            }

            // harvest the type name/fee name/fee id info
            selectedMembershipTypeName = lblMembershipType.Text;

            if (rblSubCategory.SelectedItem == null)
            {
                rblSubCategory.SelectedIndex = 0;                                       // use the first
            }
            selectedMembershipFeeName = rblSubCategory.SelectedItem.Text;
            selectedMembershipFeeID   = rblSubCategory.SelectedItem.Value;

            // ok, let's create the membership we use for the session
            msMembership mem = MultiStepWizards.RenewMembership.Membership;

            if (mem == null)    // no previous membership
            {
                mem = new msMembership();
                MultiStepWizards.RenewMembership.Membership = mem;
            }
            mem.Type                   = selectedMembershipTypeID;
            mem.Product                = selectedMembershipFeeID;
            mem["Type_Name"]           = selectedMembershipTypeName;
            mem["Product_Name"]        = selectedMembershipFeeName;
            mem.MembershipOrganization = drMembershipOrganization["ID"].ToString();

            // now, force this object to be stored in memory
            // by default, we'll store the ID, and not the entire object
            mem.SystemTimestamp = null;
            MultiStepWizards.RenewMembership.Membership = mem;

            MultiStepWizards.RenewMembership.Entity = targetEntity;

            // go to the next step
            GoTo("PurchaseMembership2.aspx");
        }
    }