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); }
protected void ok_Click(object sender, EventArgs e) { if (dojoMembershipTemplateID == 0) { obj = new DojoMembershipTemplate(); } else { obj = new DojoMembershipTemplate(dojoMembershipTemplateID); } obj.Name = tbName.Text; obj.Description = tbDescription.Text; obj.Duration = TimeSpan.Parse(tbDuration.Text); obj.Fee = decimal.Parse(tbFee.Text); obj.AutoRenewalEnabled = cbAutoRenewalEnabled.Checked; obj.AutoPayEnabled = cbAutoPayEnabled.Checked; if (msParentTemplate.SelectedItem != null && msParentTemplate.SelectedItem.Value != "Null") { obj.ParentTemplate = DojoMembershipTemplate.NewPlaceHolder( int.Parse(msParentTemplate.SelectedItem.Value)); } else { obj.ParentTemplate = null; } if (msMemberType1.SelectedItem != null && msMemberType1.SelectedItem.Value != "Null") { obj.MemberType1 = DojoMemberType.NewPlaceHolder( int.Parse(msMemberType1.SelectedItem.Value)); } else { obj.MemberType1 = null; } if (msMemberType2.SelectedItem != null && msMemberType2.SelectedItem.Value != "Null") { obj.MemberType2 = DojoMemberType.NewPlaceHolder( int.Parse(msMemberType2.SelectedItem.Value)); } else { obj.MemberType2 = null; } if (msMemberType3.SelectedItem != null && msMemberType3.SelectedItem.Value != "Null") { obj.MemberType3 = DojoMemberType.NewPlaceHolder( int.Parse(msMemberType3.SelectedItem.Value)); } else { obj.MemberType3 = null; } if (msMemberType4.SelectedItem != null && msMemberType4.SelectedItem.Value != "Null") { obj.MemberType4 = DojoMemberType.NewPlaceHolder( int.Parse(msMemberType4.SelectedItem.Value)); } else { obj.MemberType4 = null; } if (msMemberType5.SelectedItem != null && msMemberType5.SelectedItem.Value != "Null") { obj.MemberType5 = DojoMemberType.NewPlaceHolder( int.Parse(msMemberType5.SelectedItem.Value)); } else { obj.MemberType5 = null; } if (msMemberType6.SelectedItem != null && msMemberType6.SelectedItem.Value != "Null") { obj.MemberType6 = DojoMemberType.NewPlaceHolder( int.Parse(msMemberType6.SelectedItem.Value)); } else { obj.MemberType6 = null; } if (msMemberType7.SelectedItem != null && msMemberType7.SelectedItem.Value != "Null") { obj.MemberType7 = DojoMemberType.NewPlaceHolder( int.Parse(msMemberType7.SelectedItem.Value)); } else { obj.MemberType7 = null; } if (msMemberType8.SelectedItem != null && msMemberType8.SelectedItem.Value != "Null") { obj.MemberType8 = DojoMemberType.NewPlaceHolder( int.Parse(msMemberType8.SelectedItem.Value)); } else { obj.MemberType8 = null; } if (msItem.SelectedItem != null && msItem.SelectedItem.Value != "Null") { obj.Item = RHItem.NewPlaceHolder( int.Parse(msItem.SelectedItem.Value)); } else { obj.Item = null; } if (editOnAdd) { dojoMembershipTemplateID = obj.Save(); } else { obj.Save(); } if (resetOnAdd) { tbName.Text = string.Empty; tbDescription.Text = string.Empty; tbDuration.Text = string.Empty; tbFee.Text = string.Empty; cbAutoRenewalEnabled.Checked = false; cbAutoPayEnabled.Checked = false; msParentTemplate.SelectedIndex = 0; msMemberType1.SelectedIndex = 0; msMemberType2.SelectedIndex = 0; msMemberType3.SelectedIndex = 0; msMemberType4.SelectedIndex = 0; msMemberType5.SelectedIndex = 0; msMemberType6.SelectedIndex = 0; msMemberType7.SelectedIndex = 0; msMemberType8.SelectedIndex = 0; msItem.SelectedIndex = 0; } OnUpdated(EventArgs.Empty); }
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); }