protected void btOk_Click(object sender, EventArgs e)
        {
            DojoMembership dojoMembership = new DojoMembership(dojoMembershipID);

            dojoMembership.Delete();

            dojoMembershipID = 0;

            OnDeleted(EventArgs.Empty);
        }
Esempio n. 2
0
 private void addMembership(DojoMembership membership)
 {
     if (membership != null)
     {
         // TODO : CONVERT UTC TO LOCAL TIME FOR DOJO
         addRow(membershipsTable,
                membership.MembershipTemplate.Name,
                membership.StartDate.ToShortDateString(),
                membership.EndDate.ToShortDateString());
     }
 }
 protected override void OnPreRender(EventArgs e)
 {
     if (dojoMembershipID != 0)
     {
         dojoMembership = new DojoMembership(dojoMembershipID);
         text           = "Delete - " + dojoMembership.ToString();
     }
     else
     {
         text = "Delete ";
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Checks a membership for past due status.
        /// </summary>
        /// <param name="membership">Membership to check.</param>
        /// <returns>Returns true if the membership is past due, otherwise false.</returns>
        private bool pastDueCheck(DojoMembership membership)
        {
            // Past due on balance remaining and past due.
            if (membership.InvoiceLine != null)
            {
                if (membership.InvoiceLine.Invoice.BalanceRemaining > 0 &
                    membership.InvoiceLine.Invoice.DueDate <= DateTime.Now)
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 5
0
        private void addTemplate(
            DojoMember member,
            DojoMembershipTemplate template,
            MembershipBuilder builder)
        {
            // Get Prior
            DojoMembership prior = getPrior(member, template);

            // If the prior membership has not yet ended and the prior membership's
            // end date preceeds the template's pre-purchase date, skip this template.
            if (prior != null)
            {
                if (prior.EndDate >= builder.BuildTime)
                {
                    if (prior.EndDate >= builder.BuildTime.Subtract(template.PrePurchaseTime))
                    {
                        return;
                    }
                }
            }

            // Since this membership is either a new, renewal or pre-purchased renewal,
            // add it to the membership list.
            DojoMembership membership = new DojoMembership();

            membership.Member               = member;
            membership.MembershipTemplate   = template;
            membership.PriorMembership      = prior;
            membership.Organization         = template.Organization;
            membership.OrganizationMemberID =
                prior != null ? prior.OrganizationMemberID : string.Empty;
            calcMembership(membership, builder);
            // calcMembership takes care of this!
            // membership.EndDate = calcDate(membership.startDate,
            //     template.MembershipEnd);
            // membership.Fee = template.Fee;

            memberships.Add(membership);

            totalFee += membership.Fee;
        }
Esempio n. 6
0
        protected void addTemplate(Panel container, DojoMembership membership)
        {
            EvenMoreCornersDialog d = new EvenMoreCornersDialog();

            d.CssClass = membershipTemplateCssClass;
            d.Mode     = membershipTemplateMode;
            d.Header.Add(new LiteralControl("<h2>" +
                                            membership.MembershipTemplate.Name +
                                            (membership.PriorMembership == null ? " " + Localization.Strings.StartupMembershipSuffix : "") +
                                            (membership.IsProRated ? " " + Localization.Strings.ProrateMembershipSuffix : "") +
                                            "</h2>"));
            if (membership.Member.ID != member.ID)
            {
                d.Header.Add(new LiteralControl("<h3>" + membership.Member.PrivateContact.FullName + "</h3>"));
            }
            d.Header.Add(new LiteralControl("<p>" + string.Format(
                                                Localization.Strings.MembershipTemplates_DateFormat,
                                                membership.StartDate,
                                                membership.EndDate) + "</p>"));
            d.Body.Add(new LiteralControl("<p>" + membership.Fee.ToString("c") + "</p>"));
            container.Controls.Add(d);
        }
Esempio n. 7
0
        /// <summary>
        /// Tests to see if the existing membership can be matched to the template.
        /// </summary>
        /// <param name="membership"></param>
        /// <param name="template"></param>
        /// <returns></returns>
        private bool priorMatch(DojoMembership membership, DojoMembershipTemplate template)
        {
            if (membership != null)
            {
                // If the membership's root template is the same as the one provided, then
                // this counts as a prior membership.
                if (membership.MembershipTemplate.RootTemplate != null)
                {
                    if (membership.MembershipTemplate.RootTemplate.ID == template.ID)
                    {
                        return(true);
                    }
                }

                // If the membership's template is the same as the template provided, then
                // this counts as a match.
                if (membership.MembershipTemplate.ID == template.ID)
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 8
0
        /// <summary>
        /// Checks a membership for active status.
        /// </summary>
        /// <param name="membership">Dojo membership to check.</param>
        /// <returns>Returns true if the membership is active, otherwise false.</returns>
        private bool activityCheck(DojoMembership membership)
        {
            // Activate on active membership that is paid.
            // Activate on active membership that is unpaid and not yet due.
            // Activate on active membership that is noninvoiced.
            if (membership.StartDate <= DateTime.Now &
                membership.EndDate >= DateTime.Now)
            {
                if (membership.InvoiceLine != null)
                {
                    if (membership.InvoiceLine.Invoice.BalanceRemaining == 0 |
                        membership.InvoiceLine.Invoice.DueDate > DateTime.Now)
                    {
                        return(true);
                    }
                }
                else
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 9
0
        /// <summary>
        /// Calculates a fee and end date for a membership based on the
        /// provided membership's start date. This will take into account the
        /// ProRate settings on the membership's parent template. ProRate
        /// settings can use either the day, the month or the month/day
        /// combination. This will NOT ProRate memberships that do not have
        /// a prior membership.
        ///
        /// This will add the startup fees for each member at the end.
        /// </summary>
        /// <param name="membership">The membership to calculate.</param>
        private void calcMembership(DojoMembership membership, MembershipBuilder builder)
        {
            DateTime               now      = builder.BuildTime;
            DojoMember             member   = membership.member;
            DojoMembershipTemplate template = membership.MembershipTemplate;

            if (membership.priorMembership == null)
            {
                membership.StartDate =
                    calcDate(now, template.MembershipStart);
            }
            else
            {
                membership.StartDate = DateManipulator.FirstOfNextDay(
                    membership.PriorMembership.EndDate);
            }

            membership.EndDate =
                calcDate(membership.StartDate,
                         template.MembershipEnd);
            membership.Fee = template.Fee;

            if (membership.PriorMembership == null)
            {
                // PRO RATE A ==================================
                if (template.ProRateMonthA > 0 &&
                    template.ProRateMonthA <= now.Month)
                {
                    if (template.ProRateDayA > 0)
                    {
                        if (template.ProRateDayA <= now.Day)
                        {
                            membership.EndDate =
                                calcDate(membership.StartDate,
                                         template.ProRateEndA);
                            membership.Fee =
                                template.ProRateFeeA;
                            membership.IsProRated = true;
                        }
                    }
                    else
                    {
                        membership.EndDate =
                            calcDate(membership.StartDate,
                                     template.ProRateEndA);
                        membership.Fee =
                            template.ProRateFeeA;
                        membership.IsProRated = true;
                    }

                    // PRO RATE B ==================================
                    if (template.ProRateMonthB > 0 &&
                        template.ProRateMonthB <= now.Month)
                    {
                        if (template.ProRateDayB > 0)
                        {
                            if (template.ProRateDayB <= now.Day)
                            {
                                membership.EndDate =
                                    calcDate(membership.StartDate,
                                             template.ProRateEndB);
                                membership.Fee =
                                    template.ProRateFeeB;
                                membership.IsProRated = true;
                            }
                        }
                        else
                        {
                            membership.EndDate =
                                calcDate(membership.StartDate,
                                         template.ProRateEndB);
                            membership.Fee =
                                template.ProRateFeeB;
                            membership.IsProRated = true;
                        }

                        // PRO RATE C ==================================
                        if (template.ProRateMonthC > 0 &&
                            template.ProRateMonthC <= now.Month)
                        {
                            if (template.ProRateDayC > 0)
                            {
                                if (template.ProRateDayC <= now.Day)
                                {
                                    membership.EndDate =
                                        calcDate(membership.StartDate,
                                                 template.ProRateEndC);
                                    membership.Fee =
                                        template.ProRateFeeC;
                                    membership.IsProRated = true;
                                }
                            }
                            else
                            {
                                membership.EndDate =
                                    calcDate(membership.StartDate,
                                             template.ProRateEndC);
                                membership.Fee =
                                    template.ProRateFeeC;
                                membership.IsProRated = true;
                            }
                        }
                        else if (template.ProRateDayC > 0 &&
                                 template.ProRateDayC <= now.Day)
                        {
                            membership.EndDate =
                                calcDate(membership.StartDate,
                                         template.ProRateEndC);
                            membership.Fee =
                                template.ProRateFeeC;
                            membership.IsProRated = true;
                        }
                    }
                    else if (template.ProRateDayB > 0 &&
                             template.ProRateDayB <= now.Day)
                    {
                        membership.EndDate =
                            calcDate(membership.StartDate,
                                     template.ProRateEndB);
                        membership.Fee =
                            template.ProRateFeeB;
                        membership.IsProRated = true;
                    }
                }
                else if (template.ProRateDayA > 0 &&
                         template.ProRateDayA <= now.Day)
                {
                    membership.EndDate =
                        calcDate(membership.StartDate,
                                 template.ProRateEndA);
                    membership.Fee =
                        template.ProRateFeeA;
                    membership.IsProRated = true;
                }
            }

            if (membership.PriorMembership == null)
            {
                membership.Fee += template.StartupFee;
            }
        }
Esempio n. 10
0
        private void applyMembership(DojoMembership membership)
        {
            DojoMember       parentMember;
            DojoOrganization primaryOrganization;

            // Don't update a new membership which has not yet begun.
            if (membership.StartDate > DateTime.Now.ToUniversalTime() |
                membership.EndDate < DateTime.Now.ToUniversalTime())
            {
                return;
            }

            parentMember = membership.Member;

            // Keep a stack of the memberships that need to be saved
            DojoMembershipCollection oldMemberships = parentMember.CollateMemberships();

            if (parentMember.Membership1 != null &&
                parentMember.Membership1.MembershipTemplate.ID == membership.MembershipTemplate.ID)
            {
                parentMember.Membership1 = membership;
            }
            else if (parentMember.Membership2 != null &&
                     parentMember.Membership2.MembershipTemplate.ID == membership.MembershipTemplate.ID)
            {
                parentMember.Membership2 = membership;
            }
            else if (parentMember.Membership3 != null &&
                     parentMember.Membership3.MembershipTemplate.ID == membership.MembershipTemplate.ID)
            {
                parentMember.Membership3 = membership;
            }
            else if (parentMember.Membership4 != null &&
                     parentMember.Membership4.MembershipTemplate.ID == membership.MembershipTemplate.ID)
            {
                parentMember.Membership4 = membership;
            }
            else if (parentMember.Membership5 != null &&
                     parentMember.Membership5.MembershipTemplate.ID == membership.MembershipTemplate.ID)
            {
                parentMember.Membership5 = membership;
            }
            else
            {
                if (parentMember.Membership1 == null)
                {
                    parentMember.Membership1 = membership;
                }
                else if (parentMember.Membership2 == null)
                {
                    parentMember.Membership2 = membership;
                }
                else if (parentMember.Membership3 == null)
                {
                    parentMember.Membership3 = membership;
                }
                else if (parentMember.Membership4 == null)
                {
                    parentMember.Membership4 = membership;
                }
                else if (parentMember.Membership5 == null)
                {
                    parentMember.Membership5 = membership;
                }
                else
                {
                    // WHOAH! THEY ARE ALL FULL!
                    // TODO: WHAT DO I DO NOW?
                }
            }

            // Now that the memberships are updated, flag the member
            // with the appropriate state.
            primaryOrganization = TessenFactory.PrimaryOrganization();
            if (primaryOrganization != null)
            {
                if (membership.StartDate < DateTime.Now.ToUniversalTime() &&
                    membership.EndDate > DateTime.Now.ToUniversalTime())
                {
                    parentMember.IsPrimaryOrgActive = true;
                }
            }
        }
Esempio n. 11
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoMemberID == 0)
            {
                obj = new DojoMember();
            }
            else
            {
                obj = new DojoMember(dojoMemberID);
            }

            obj.MemberSince        = deMemberSince.Date;
            obj.IsPrimaryOrgActive = cbIsPrimaryOrgActive.Checked;
            obj.IsParentOrgActive  = cbIsParentOrgActive.Checked;
            obj.LastMembershipScan = DateTime.Parse(tbLastMembershipScan.Text);
            obj.AttendanceMessage  = tbAttendanceMessage.Text;
            obj.HasWaiver          = cbHasWaiver.Checked;
            obj.IsPromotable       = cbIsPromotable.Checked;
            obj.IsInstructor       = cbIsInstructor.Checked;
            obj.RankDate           = deRankDate.Date;
            obj.IsPastDue          = cbIsPastDue.Checked;

            if (msMemberType.SelectedItem != null && msMemberType.SelectedItem.Value != "Null")
            {
                obj.MemberType = DojoMemberType.NewPlaceHolder(
                    int.Parse(msMemberType.SelectedItem.Value));
            }
            else
            {
                obj.MemberType = null;
            }

            if (msPublicContact.SelectedItem != null && msPublicContact.SelectedItem.Value != "Null")
            {
                obj.PublicContact = GreyFoxContact.NewPlaceHolder("kitTessen_Members_PublicContacts",
                                                                  int.Parse(msPublicContact.SelectedItem.Value));
            }
            else
            {
                obj.PublicContact = null;
            }

            if (msParentMember.SelectedItem != null && msParentMember.SelectedItem.Value != "Null")
            {
                obj.ParentMember = DojoMember.NewPlaceHolder(
                    int.Parse(msParentMember.SelectedItem.Value));
            }
            else
            {
                obj.ParentMember = null;
            }

            if (msPrimaryOrgMembership.SelectedItem != null && msPrimaryOrgMembership.SelectedItem.Value != "Null")
            {
                obj.PrimaryOrgMembership = DojoMembership.NewPlaceHolder(
                    int.Parse(msPrimaryOrgMembership.SelectedItem.Value));
            }
            else
            {
                obj.PrimaryOrgMembership = null;
            }

            if (msParentOrgMembership.SelectedItem != null && msParentOrgMembership.SelectedItem.Value != "Null")
            {
                obj.ParentOrgMembership = DojoMembership.NewPlaceHolder(
                    int.Parse(msParentOrgMembership.SelectedItem.Value));
            }
            else
            {
                obj.ParentOrgMembership = null;
            }

            if (msInstructor1.SelectedItem != null && msInstructor1.SelectedItem.Value != "Null")
            {
                obj.Instructor1 = DojoMember.NewPlaceHolder(
                    int.Parse(msInstructor1.SelectedItem.Value));
            }
            else
            {
                obj.Instructor1 = null;
            }

            if (msInstructor2.SelectedItem != null && msInstructor2.SelectedItem.Value != "Null")
            {
                obj.Instructor2 = DojoMember.NewPlaceHolder(
                    int.Parse(msInstructor2.SelectedItem.Value));
            }
            else
            {
                obj.Instructor2 = null;
            }

            if (msInstructor3.SelectedItem != null && msInstructor3.SelectedItem.Value != "Null")
            {
                obj.Instructor3 = DojoMember.NewPlaceHolder(
                    int.Parse(msInstructor3.SelectedItem.Value));
            }
            else
            {
                obj.Instructor3 = null;
            }

            if (msPromotionFlags.IsChanged)
            {
                obj.PromotionFlags = new DojoPromotionFlagCollection();
                foreach (ListItem i in msPromotionFlags.Items)
                {
                    if (i.Selected)
                    {
                        obj.PromotionFlags.Add(DojoPromotionFlag.NewPlaceHolder(int.Parse(i.Value)));
                    }
                }
            }

            if (msRank.SelectedItem != null && msRank.SelectedItem.Value != "Null")
            {
                obj.Rank = DojoRank.NewPlaceHolder(
                    int.Parse(msRank.SelectedItem.Value));
            }
            else
            {
                obj.Rank = null;
            }

            if (msCustomer.SelectedItem != null && msCustomer.SelectedItem.Value != "Null")
            {
                obj.Customer = RHCustomer.NewPlaceHolder(
                    int.Parse(msCustomer.SelectedItem.Value));
            }
            else
            {
                obj.Customer = null;
            }

            if (editOnAdd)
            {
                dojoMemberID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                deMemberSince.Date           = DateTime.Now;
                cbIsPrimaryOrgActive.Checked = false;
                cbIsParentOrgActive.Checked  = false;
                tbLastMembershipScan.Text    = DateTime.Now.ToString();
                tbAttendanceMessage.Text     = string.Empty;
                cbHasWaiver.Checked          = false;
                cbIsPromotable.Checked       = false;
                cbIsInstructor.Checked       = false;
                deRankDate.Date                      = DateTime.Now;
                cbIsPastDue.Checked                  = false;
                msMemberType.SelectedIndex           = 0;
                msPublicContact.SelectedIndex        = 0;
                msParentMember.SelectedIndex         = 0;
                msPrimaryOrgMembership.SelectedIndex = 0;
                msParentOrgMembership.SelectedIndex  = 0;
                msInstructor1.SelectedIndex          = 0;
                msInstructor2.SelectedIndex          = 0;
                msInstructor3.SelectedIndex          = 0;
                msRank.SelectedIndex                 = 0;
                msCustomer.SelectedIndex             = 0;
            }

            OnUpdated(EventArgs.Empty);
        }
Esempio n. 12
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (loadFlag)
            {
                if (dojoMembershipID > 0)
                {
                    obj             = new DojoMembership(dojoMembershipID);
                    headerText.Text = "Edit  - " + obj.ToString();
                }
                else if (dojoMembershipID <= 0)
                {
                    obj             = new DojoMembership();
                    headerText.Text = "Add ";
                }

                // Bind General Data
                if (obj.Member != null)
                {
                    comboMember.Text = obj.Member.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboMember.Items)
                    {
                        if (item.Value == obj.Member.ID.ToString())
                        {
                            comboMember.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboMember.Text         = string.Empty;
                    comboMember.SelectedItem = null;
                }
                deStartDate.Date = obj.StartDate;
                deEndDate.Date   = obj.EndDate;
                if (obj.Organization != null)
                {
                    comboOrganization.Text = obj.Organization.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboOrganization.Items)
                    {
                        if (item.Value == obj.Organization.ID.ToString())
                        {
                            comboOrganization.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboOrganization.Text         = string.Empty;
                    comboOrganization.SelectedItem = null;
                }
                tbOrganizationMemberID.Text = obj.OrganizationMemberID;
                if (obj.Parent != null)
                {
                    foreach (ListItem item in ddParent.Items)
                    {
                        item.Selected = obj.Parent.ID.ToString() == item.Value;
                    }
                }
                else if (ddParent.Items.Count > 0)
                {
                    ddParent.SelectedIndex = 0;
                }

                if (obj.MemberTypeTemplate != null)
                {
                    comboMemberTypeTemplate.Text = obj.MemberTypeTemplate.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboMemberTypeTemplate.Items)
                    {
                        if (item.Value == obj.MemberTypeTemplate.ID.ToString())
                        {
                            comboMemberTypeTemplate.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboMemberTypeTemplate.Text         = string.Empty;
                    comboMemberTypeTemplate.SelectedItem = null;
                }
                if (obj.MembershipTemplate != null)
                {
                    comboMembershipTemplate.Text = obj.MembershipTemplate.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboMembershipTemplate.Items)
                    {
                        if (item.Value == obj.MembershipTemplate.ID.ToString())
                        {
                            comboMembershipTemplate.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboMembershipTemplate.Text         = string.Empty;
                    comboMembershipTemplate.SelectedItem = null;
                }
                ltSessionID.Text       = obj.SessionID.ToString();
                tbFee.Text             = obj.Fee.ToString();
                ltPriorMembership.Text = obj.PriorMembership != null?
                                         obj.PriorMembership.ToString() : Localization.Strings.StartupMembership;

                tbPaymentAmount.Text = obj.PaymentAmount.ToString();
                cbIsProRated.Checked = obj.IsProRated;

                // Bind Rappahanock Data
                if (obj.InvoiceLine != null)
                {
                    foreach (ListItem item in ddInvoiceLine.Items)
                    {
                        item.Selected = obj.InvoiceLine.ID.ToString() == item.Value;
                    }
                }
                else if (ddInvoiceLine.Items.Count > 0)
                {
                    ddInvoiceLine.SelectedIndex = 0;
                }

                tabstrip.SelectedTab    = tabstrip.Tabs[0];
                multipage.SelectedIndex = 0;
            }
        }
Esempio n. 13
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoMembershipID == 0)
            {
                obj = new DojoMembership();
            }
            else
            {
                obj = new DojoMembership(dojoMembershipID);
            }

            if (comboMember.SelectedItem != null)
            {
                obj.Member = DojoMember.NewPlaceHolder(int.Parse(comboMember.SelectedValue));
            }
            else
            {
                obj.Member = null;
            }
            obj.StartDate = deStartDate.Date;
            obj.EndDate   = deEndDate.Date;
            if (comboOrganization.SelectedItem != null)
            {
                obj.Organization = DojoOrganization.NewPlaceHolder(int.Parse(comboOrganization.SelectedValue));
            }
            else
            {
                obj.Organization = null;
            }
            obj.OrganizationMemberID = tbOrganizationMemberID.Text;
            if (ddParent.SelectedItem != null && ddParent.SelectedValue != "null")
            {
                obj.Parent = DojoMembership.NewPlaceHolder(int.Parse(ddParent.SelectedValue));
            }
            else
            {
                obj.Parent = null;
            }
            if (comboMemberTypeTemplate.SelectedItem != null)
            {
                obj.MemberTypeTemplate = DojoMemberTypeTemplate.NewPlaceHolder(int.Parse(comboMemberTypeTemplate.SelectedValue));
            }
            else
            {
                obj.MemberTypeTemplate = null;
            }
            if (comboMembershipTemplate.SelectedItem != null)
            {
                obj.MembershipTemplate = DojoMembershipTemplate.NewPlaceHolder(int.Parse(comboMembershipTemplate.SelectedValue));
            }
            else
            {
                obj.MembershipTemplate = null;
            }
            obj.Fee           = decimal.Parse(tbFee.Text);
            obj.PaymentAmount = decimal.Parse(tbPaymentAmount.Text);
            obj.IsProRated    = cbIsProRated.Checked;
            if (ddInvoiceLine.SelectedItem != null && ddInvoiceLine.SelectedValue != "null")
            {
                obj.InvoiceLine = RHInvoiceLine.NewPlaceHolder(int.Parse(ddInvoiceLine.SelectedValue));
            }
            else
            {
                obj.InvoiceLine = null;
            }
            if (editOnAdd)
            {
                dojoMembershipID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                DojoMembership newObj = new DojoMembership();
                if (newObj.Member != null)
                {
                    comboMember.Text = newObj.Member.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboMember.Items)
                    {
                        if (item.Value == newObj.Member.ID.ToString())
                        {
                            comboMember.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboMember.Text         = string.Empty;
                    comboMember.SelectedItem = null;
                }
                deStartDate.Date = newObj.StartDate;
                deEndDate.Date   = newObj.EndDate;
                if (newObj.Organization != null)
                {
                    comboOrganization.Text = newObj.Organization.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboOrganization.Items)
                    {
                        if (item.Value == newObj.Organization.ID.ToString())
                        {
                            comboOrganization.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboOrganization.Text         = string.Empty;
                    comboOrganization.SelectedItem = null;
                }
                tbOrganizationMemberID.Text = newObj.OrganizationMemberID;
                if (newObj.Parent != null)
                {
                    foreach (ListItem item in ddParent.Items)
                    {
                        item.Selected = newObj.Parent.ID.ToString() == item.Value;
                    }
                }
                else if (ddParent.Items.Count > 0)
                {
                    ddParent.SelectedIndex = 0;
                }

                if (newObj.MemberTypeTemplate != null)
                {
                    comboMemberTypeTemplate.Text = newObj.MemberTypeTemplate.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboMemberTypeTemplate.Items)
                    {
                        if (item.Value == newObj.MemberTypeTemplate.ID.ToString())
                        {
                            comboMemberTypeTemplate.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboMemberTypeTemplate.Text         = string.Empty;
                    comboMemberTypeTemplate.SelectedItem = null;
                }
                if (newObj.MembershipTemplate != null)
                {
                    comboMembershipTemplate.Text = newObj.MembershipTemplate.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboMembershipTemplate.Items)
                    {
                        if (item.Value == newObj.MembershipTemplate.ID.ToString())
                        {
                            comboMembershipTemplate.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboMembershipTemplate.Text         = string.Empty;
                    comboMembershipTemplate.SelectedItem = null;
                }
                ltSessionID.Text       = newObj.SessionID.ToString();
                tbFee.Text             = newObj.Fee.ToString();
                ltPriorMembership.Text = newObj.PriorMembership != null?
                                         newObj.PriorMembership.ToString() : Localization.Strings.StartupMembership;

                tbPaymentAmount.Text = newObj.PaymentAmount.ToString();
                cbIsProRated.Checked = newObj.IsProRated;
                if (newObj.InvoiceLine != null)
                {
                    foreach (ListItem item in ddInvoiceLine.Items)
                    {
                        item.Selected = newObj.InvoiceLine.ID.ToString() == item.Value;
                    }
                }
                else if (ddInvoiceLine.Items.Count > 0)
                {
                    ddInvoiceLine.SelectedIndex = 0;
                }
            }

            OnUpdated(EventArgs.Empty);
        }
Esempio n. 14
0
        protected override void OnPreRender(EventArgs e)
        {
            if (dojoMembershipID != 0)
            {
                dojoMembership = new DojoMembership(dojoMembershipID);

                #region Bind Default Folder

                //
                // Set Field Entries
                //

                ltStartDate.Text            = dojoMembership.StartDate.ToString();
                ltEndDate.Text              = dojoMembership.EndDate.ToString();
                ltOrganizationMemberID.Text = dojoMembership.OrganizationMemberID.ToString();

                //
                // Set Children Selections
                //

                // Member

                if (dojoMembership.Member != null)
                {
                    ltMember.Text = dojoMembership.Member.ToString();
                }
                else
                {
                    ltMember.Text = string.Empty;
                }

                // MemberType

                if (dojoMembership.MemberType != null)
                {
                    ltMemberType.Text = dojoMembership.MemberType.ToString();
                }
                else
                {
                    ltMemberType.Text = string.Empty;
                }

                // Organization

                if (dojoMembership.Organization != null)
                {
                    ltOrganization.Text = dojoMembership.Organization.ToString();
                }
                else
                {
                    ltOrganization.Text = string.Empty;
                }

                // ParentMembership

                if (dojoMembership.ParentMembership != null)
                {
                    ltParentMembership.Text = dojoMembership.ParentMembership.ToString();
                }
                else
                {
                    ltParentMembership.Text = string.Empty;
                }

                // SourceTemplate

                if (dojoMembership.SourceTemplate != null)
                {
                    ltSourceTemplate.Text = dojoMembership.SourceTemplate.ToString();
                }
                else
                {
                    ltSourceTemplate.Text = string.Empty;
                }


                #endregion

                #region Bind _system Folder

                //
                // Set Field Entries
                //


                //
                // Set Children Selections
                //


                #endregion

                #region Bind Rappahanock Folder

                //
                // Set Field Entries
                //


                //
                // Set Children Selections
                //

                // InvoiceLine

                if (dojoMembership.InvoiceLine != null)
                {
                    ltInvoiceLine.Text = dojoMembership.InvoiceLine.ToString();
                }
                else
                {
                    ltInvoiceLine.Text = string.Empty;
                }


                #endregion

                text = "View  - " + dojoMembership.ToString();
            }
        }
Esempio n. 15
0
        protected override void OnPreRender(EventArgs e)
        {
            if (loadFlag)
            {
                if (dojoMembershipID > 0)
                {
                    obj  = new DojoMembership(dojoMembershipID);
                    text = "Edit  - " + obj.ToString();
                }
                else if (dojoMembershipID <= 0)
                {
                    obj  = new DojoMembership();
                    text = "Add ";
                }

                //
                // Set Field Entries
                //
                deStartDate.Date            = obj.StartDate;
                deEndDate.Date              = obj.EndDate;
                tbOrganizationMemberID.Text = obj.OrganizationMemberID;

                //
                // Set Children Selections
                //
                if (obj.Member != null)
                {
                    foreach (ListItem item in msMember.Items)
                    {
                        item.Selected = obj.Member.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msMember.SelectedIndex = 0;
                }

                if (obj.MemberType != null)
                {
                    foreach (ListItem item in msMemberType.Items)
                    {
                        item.Selected = obj.MemberType.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msMemberType.SelectedIndex = 0;
                }

                if (obj.Organization != null)
                {
                    foreach (ListItem item in msOrganization.Items)
                    {
                        item.Selected = obj.Organization.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msOrganization.SelectedIndex = 0;
                }

                if (obj.ParentMembership != null)
                {
                    foreach (ListItem item in msParentMembership.Items)
                    {
                        item.Selected = obj.ParentMembership.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msParentMembership.SelectedIndex = 0;
                }

                if (obj.SourceTemplate != null)
                {
                    foreach (ListItem item in msSourceTemplate.Items)
                    {
                        item.Selected = obj.SourceTemplate.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msSourceTemplate.SelectedIndex = 0;
                }

                if (obj.InvoiceLine != null)
                {
                    foreach (ListItem item in msInvoiceLine.Items)
                    {
                        item.Selected = obj.InvoiceLine.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msInvoiceLine.SelectedIndex = 0;
                }
            }
        }
Esempio n. 16
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoMembershipID == 0)
            {
                obj = new DojoMembership();
            }
            else
            {
                obj = new DojoMembership(dojoMembershipID);
            }

            obj.StartDate            = deStartDate.Date;
            obj.EndDate              = deEndDate.Date;
            obj.OrganizationMemberID = tbOrganizationMemberID.Text;

            if (msMember.SelectedItem != null && msMember.SelectedItem.Value != "Null")
            {
                obj.Member = DojoMember.NewPlaceHolder(
                    int.Parse(msMember.SelectedItem.Value));
            }
            else
            {
                obj.Member = null;
            }

            if (msMemberType.SelectedItem != null && msMemberType.SelectedItem.Value != "Null")
            {
                obj.MemberType = DojoMemberType.NewPlaceHolder(
                    int.Parse(msMemberType.SelectedItem.Value));
            }
            else
            {
                obj.MemberType = null;
            }

            if (msOrganization.SelectedItem != null && msOrganization.SelectedItem.Value != "Null")
            {
                obj.Organization = DojoOrganization.NewPlaceHolder(
                    int.Parse(msOrganization.SelectedItem.Value));
            }
            else
            {
                obj.Organization = null;
            }

            if (msParentMembership.SelectedItem != null && msParentMembership.SelectedItem.Value != "Null")
            {
                obj.ParentMembership = DojoMembership.NewPlaceHolder(
                    int.Parse(msParentMembership.SelectedItem.Value));
            }
            else
            {
                obj.ParentMembership = null;
            }

            if (msSourceTemplate.SelectedItem != null && msSourceTemplate.SelectedItem.Value != "Null")
            {
                obj.SourceTemplate = DojoMembershipTemplate.NewPlaceHolder(
                    int.Parse(msSourceTemplate.SelectedItem.Value));
            }
            else
            {
                obj.SourceTemplate = null;
            }

            if (msInvoiceLine.SelectedItem != null && msInvoiceLine.SelectedItem.Value != "Null")
            {
                obj.InvoiceLine = RHInvoiceLine.NewPlaceHolder(
                    int.Parse(msInvoiceLine.SelectedItem.Value));
            }
            else
            {
                obj.InvoiceLine = null;
            }

            if (editOnAdd)
            {
                dojoMembershipID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                deStartDate.Date                 = DateTime.Now;
                deEndDate.Date                   = DateTime.Now;
                tbOrganizationMemberID.Text      = string.Empty;
                msMember.SelectedIndex           = 0;
                msMemberType.SelectedIndex       = 0;
                msOrganization.SelectedIndex     = 0;
                msParentMembership.SelectedIndex = 0;
                msSourceTemplate.SelectedIndex   = 0;
                msInvoiceLine.SelectedIndex      = 0;
            }

            OnUpdated(EventArgs.Empty);
        }