Beispiel #1
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);
        }
Beispiel #2
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoSeminarRegistrationID == 0)
            {
                obj = new DojoSeminarRegistration();
            }
            else
            {
                obj = new DojoSeminarRegistration(dojoSeminarRegistrationID);
            }

            obj.Status           = byte.Parse(tbStatus.Text);
            obj.RegistrationDate = deRegistrationDate.Date;
            obj.ClassUnits       = int.Parse(tbClassUnits.Text);
            obj.TotalFee         = decimal.Parse(tbTotalFee.Text);
            obj.PaymentDate      = dePaymentDate.Date;
            obj.PaymentReference = tbPaymentReference.Text;
            obj.PaymentAmount    = decimal.Parse(tbPaymentAmount.Text);

            if (msContact.SelectedItem != null && msContact.SelectedItem.Value != "Null")
            {
                obj.Contact = GreyFoxContact.NewPlaceHolder("kitTessen_SeminarRegistrations_Contacts",
                                                            int.Parse(msContact.SelectedItem.Value));
            }
            else
            {
                obj.Contact = null;
            }

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

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

            if (msSalesOrderLine.SelectedItem != null && msSalesOrderLine.SelectedItem.Value != "Null")
            {
                obj.SalesOrderLine = RHSalesOrderLine.NewPlaceHolder(
                    int.Parse(msSalesOrderLine.SelectedItem.Value));
            }
            else
            {
                obj.SalesOrderLine = null;
            }

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

            if (resetOnAdd)
            {
                tbStatus.Text                  = string.Empty;
                deRegistrationDate.Date        = DateTime.Now;
                tbClassUnits.Text              = string.Empty;
                tbTotalFee.Text                = string.Empty;
                dePaymentDate.Date             = DateTime.Now;
                tbPaymentReference.Text        = string.Empty;
                tbPaymentAmount.Text           = string.Empty;
                msContact.SelectedIndex        = 0;
                msCustomer.SelectedIndex       = 0;
                msInvoiceLine.SelectedIndex    = 0;
                msSalesOrderLine.SelectedIndex = 0;
            }

            OnUpdated(EventArgs.Empty);
        }
 /// <summary>
 /// Deep copies the current DojoSeminarRegistration to another instance of DojoSeminarRegistration.
 /// </summary>
 /// <param name="DojoSeminarRegistration">The DojoSeminarRegistration to copy to.</param>
 /// <param name="isolation">Placeholders are used to isolate the DojoSeminarRegistration from its children.</param>
 public void CopyTo(DojoSeminarRegistration dojoSeminarRegistration, bool isolation)
 {
     dojoSeminarRegistration.iD            = iD;
     dojoSeminarRegistration.isPlaceHolder = isPlaceHolder;
     dojoSeminarRegistration.isSynced      = isSynced;
     dojoSeminarRegistration.status        = status;
     if (parentSeminar != null)
     {
         if (isolation)
         {
             dojoSeminarRegistration.parentSeminar = parentSeminar.NewPlaceHolder();
         }
         else
         {
             dojoSeminarRegistration.parentSeminar = parentSeminar.Copy(false);
         }
     }
     dojoSeminarRegistration.registrationDate = registrationDate;
     dojoSeminarRegistration.classUnits       = classUnits;
     dojoSeminarRegistration.sessionID        = sessionID;
     dojoSeminarRegistration.seminarFee       = seminarFee;
     dojoSeminarRegistration.totalFee         = totalFee;
     dojoSeminarRegistration.paymentDate      = paymentDate;
     dojoSeminarRegistration.paymentReference = paymentReference;
     dojoSeminarRegistration.paymentAmount    = paymentAmount;
     if (contact != null)
     {
         if (isolation)
         {
             dojoSeminarRegistration.contact = contact.NewPlaceHolder();
         }
         else
         {
             dojoSeminarRegistration.contact = contact.Copy(false);
         }
     }
     if (invoiceLine != null)
     {
         if (isolation)
         {
             dojoSeminarRegistration.invoiceLine = invoiceLine.NewPlaceHolder();
         }
         else
         {
             dojoSeminarRegistration.invoiceLine = invoiceLine.Copy(false);
         }
     }
     if (salesOrderLine != null)
     {
         if (isolation)
         {
             dojoSeminarRegistration.salesOrderLine = salesOrderLine.NewPlaceHolder();
         }
         else
         {
             dojoSeminarRegistration.salesOrderLine = salesOrderLine.Copy(false);
         }
     }
     if (customer != null)
     {
         if (isolation)
         {
             dojoSeminarRegistration.customer = customer.NewPlaceHolder();
         }
         else
         {
             dojoSeminarRegistration.customer = customer.Copy(false);
         }
     }
 }