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 (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); }
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); }