Пример #1
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);
        }
Пример #2
0
 /// <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);
         }
     }
 }