コード例 #1
0
        /// <summary>
        /// Makes a deep copy of the current DojoSeminarRegistration.
        /// </summary>
        /// <returns> A new DojoSeminarRegistration object reflecting the cloned DojoSeminarRegistration object.</returns>
        /// <param name="isolation">Placeholders are used to isolate the DojoSeminarRegistration from its children.</param>
        public DojoSeminarRegistration Copy(bool isolation)
        {
            DojoSeminarRegistration dojoSeminarRegistration = new DojoSeminarRegistration();

            CopyTo(dojoSeminarRegistration, isolation);
            return(dojoSeminarRegistration);
        }
コード例 #2
0
        public static DojoSeminarRegistration NewPlaceHolder(int iD)
        {
            DojoSeminarRegistration dojoSeminarRegistration = new DojoSeminarRegistration();

            dojoSeminarRegistration.iD            = iD;
            dojoSeminarRegistration.isPlaceHolder = true;
            dojoSeminarRegistration.isSynced      = true;
            return(dojoSeminarRegistration);
        }
コード例 #3
0
        /// <summary>
        /// Duplicates DojoSeminarRegistration object into a database; may or may not be the same database
        /// as the parent object.
        /// </summary>
        /// <returns> A new DojoSeminarRegistration object reflecting the replicated DojoSeminarRegistration object.</returns>
        public DojoSeminarRegistration Duplicate()
        {
            DojoSeminarRegistration clonedDojoSeminarRegistration = this.Clone();

            // Insert must be called after children are replicated!
            clonedDojoSeminarRegistration.iD       = DojoSeminarRegistrationManager._insert(clonedDojoSeminarRegistration);
            clonedDojoSeminarRegistration.isSynced = true;
            return(clonedDojoSeminarRegistration);
        }
コード例 #4
0
        public void Remove(DojoSeminarRegistration value)
        {
            OnCollectionChanged(EventArgs.Empty);
            int index = IndexOf(value);

            if (index == -1)
            {
                throw(new Exception("DojoSeminarRegistration not found in collection."));
            }
            RemoveAt(index);
        }
コード例 #5
0
        //--- Begin Custom Code ---

        public static void ClearOptions(DojoSeminarRegistration registration)
        {
            StringBuilder s = new StringBuilder();

            s.Append(registration.ID);
            s.Append(';');

            Database  database  = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = database.GetSqlStringCommand("DELETE FROM kitTessen_SeminarRegistrationOptions WHERE ParentRegistrationID=" +
                                                               registration.ID.ToString());

            database.ExecuteNonQuery(dbCommand);
        }
コード例 #6
0
 public int IndexOf(DojoSeminarRegistration value)
 {
     lock (this)
     {
         for (int x = 0; x < count; x++)
         {
             if (DojoSeminarRegistrationArray[x].Equals(value))
             {
                 return(x);
             }
         }
         return(-1);
     }
 }
コード例 #7
0
        /// <summary>
        /// Fills the {0} from a OleIDataReader.
        /// </summary>
        public static void FillFromReader(DojoSeminarRegistrationOption dojoSeminarRegistrationOption, IDataReader r, int idOffset, int dataOffset)
        {
            dojoSeminarRegistrationOption.iD            = r.GetInt32(idOffset);
            dojoSeminarRegistrationOption.isSynced      = true;
            dojoSeminarRegistrationOption.isPlaceHolder = false;

            dojoSeminarRegistrationOption.quantity    = r.GetDecimal(0 + dataOffset);
            dojoSeminarRegistrationOption.totalFee    = r.GetDecimal(1 + dataOffset);
            dojoSeminarRegistrationOption.costPerItem = r.GetDecimal(2 + dataOffset);
            if (!r.IsDBNull(3 + dataOffset) && r.GetInt32(3 + dataOffset) > 0)
            {
                dojoSeminarRegistrationOption.parentOption = DojoSeminarOption.NewPlaceHolder(r.GetInt32(3 + dataOffset));
            }
            if (!r.IsDBNull(4 + dataOffset) && r.GetInt32(4 + dataOffset) > 0)
            {
                dojoSeminarRegistrationOption.parentRegistration = DojoSeminarRegistration.NewPlaceHolder(r.GetInt32(4 + dataOffset));
            }
        }
コード例 #8
0
 public int Add(DojoSeminarRegistration value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         // Resize the array if the count is greater than the length
         // of the array.
         if (count > DojoSeminarRegistrationArray.GetUpperBound(0) + 1)
         {
             DojoSeminarRegistration[] tempDojoSeminarRegistrationArray = new DojoSeminarRegistration[count * 2];
             Array.Copy(DojoSeminarRegistrationArray, tempDojoSeminarRegistrationArray, count - 1);
             DojoSeminarRegistrationArray = tempDojoSeminarRegistrationArray;
         }
         DojoSeminarRegistrationArray[count - 1] = value;
     }
     return(count - 1);
 }
コード例 #9
0
        /// <summary>
        /// Clones DojoSeminarRegistration object and clones child objects with cloning or replication.
        /// as the parent object.
        /// </summary>
        /// <returns> A new DojoSeminarRegistration object reflecting the replicated DojoSeminarRegistration object.</returns>
        public DojoSeminarRegistration Clone()
        {
            DojoSeminarRegistration clonedDojoSeminarRegistration = new DojoSeminarRegistration();

            clonedDojoSeminarRegistration.iD               = iD;
            clonedDojoSeminarRegistration.isSynced         = isSynced;
            clonedDojoSeminarRegistration.status           = status;
            clonedDojoSeminarRegistration.registrationDate = registrationDate;
            clonedDojoSeminarRegistration.classUnits       = classUnits;
            clonedDojoSeminarRegistration.sessionID        = sessionID;
            clonedDojoSeminarRegistration.seminarFee       = seminarFee;
            clonedDojoSeminarRegistration.totalFee         = totalFee;
            clonedDojoSeminarRegistration.paymentDate      = paymentDate;
            clonedDojoSeminarRegistration.paymentReference = paymentReference;
            clonedDojoSeminarRegistration.paymentAmount    = paymentAmount;


            if (parentSeminar != null)
            {
                clonedDojoSeminarRegistration.parentSeminar = parentSeminar;
            }

            if (contact != null)
            {
                clonedDojoSeminarRegistration.contact = contact;
            }

            if (invoiceLine != null)
            {
                clonedDojoSeminarRegistration.invoiceLine = invoiceLine;
            }

            if (salesOrderLine != null)
            {
                clonedDojoSeminarRegistration.salesOrderLine = salesOrderLine;
            }

            if (customer != null)
            {
                clonedDojoSeminarRegistration.customer = customer;
            }

            return(clonedDojoSeminarRegistration);
        }
コード例 #10
0
 public void Insert(int index, DojoSeminarRegistration value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         // Resize the array if the count is greater than the length
         // of the array.
         if (count > DojoSeminarRegistrationArray.GetUpperBound(0) + 1)
         {
             DojoSeminarRegistration[] tempDojoSeminarRegistrationArray = new DojoSeminarRegistration[count * 2];
             Array.Copy(DojoSeminarRegistrationArray, tempDojoSeminarRegistrationArray, count - 1);
             DojoSeminarRegistrationArray = tempDojoSeminarRegistrationArray;
         }
         for (int x = index + 1; x == count - 2; x++)
         {
             DojoSeminarRegistrationArray[x] = DojoSeminarRegistrationArray[x - 1];
         }
         DojoSeminarRegistrationArray[index] = value;
     }
 }
コード例 #11
0
 public bool Contains(DojoSeminarRegistration value)
 {
     return(IndexOf(value) != -1);
 }
コード例 #12
0
ファイル: DojoSeminar.cs プロジェクト: rahodges/Tessen
        public DojoSeminarRegistration NewRegistration(DateTime registrationDate,
                                                       GreyFoxContact contact,
                                                       int classUnits, DojoSeminarRegistrationOptionCollection options)
        {
            DojoSeminarRegistration r = new DojoSeminarRegistration();

            r.isSynced      = false;
            r.isPlaceHolder = false;
            r.contact       = contact;
            r.classUnits    = classUnits;

            //
            // Calculate base registration calcSeminarFee and detect full registrations.
            //
            switch (ClassUnitType)
            {
            case DojoSeminarClassUnitType.Day:
                TimeSpan span = endDate.Subtract(startDate);
                if (classUnits == span.Days)
                {
                    r.totalFee = fullRegistrationFee;
                }
                else
                {
                    r.totalFee = baseRegistrationFee + (classUnitFee * classUnits);
                }
                break;

            case DojoSeminarClassUnitType.Class:
                if (classUnits == ClassCount)
                {
                    r.totalFee = fullRegistrationFee;
                }
                else
                {
                    r.totalFee = baseRegistrationFee + (classUnitFee * classUnits);
                }
                break;

            case DojoSeminarClassUnitType.None:
                if (classUnits == ClassCount)
                {
                    r.totalFee = fullRegistrationFee;
                }
                else
                {
                    r.totalFee = baseRegistrationFee + (classUnitFee * classUnits);
                }
                break;
            }

            //
            // Add up lineOption fees and set lineOption parent seminar.
            //
            for (int x = 0; x <= options.Count; x++)
            {
                options[x].parentRegistration = r;
                r.totalFee += options[x].totalFee;
            }

            return(r);
        }
コード例 #13
0
 /// <summary>
 /// Compares the object's ID to another object's ID.
 /// </summary>
 public int CompareTo(DojoSeminarRegistration dojoSeminarRegistration)
 {
     return(this.iD - dojoSeminarRegistration.iD);
 }
コード例 #14
0
        /// <summary>
        /// Compares the object's ID to another object's ID.
        /// </summary>
        int IComparable.CompareTo(object obj)
        {
            DojoSeminarRegistration dojoSeminarRegistration = (DojoSeminarRegistration)obj;

            return(this.iD - dojoSeminarRegistration.iD);
        }
コード例 #15
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);
         }
     }
 }
コード例 #16
0
 /// <summary>
 /// Deep copies the current DojoSeminarRegistration to another instance of DojoSeminarRegistration.
 /// This method does not provide isolated copies; use overriden method for this feature.
 /// </summary>
 /// <param name="DojoSeminarRegistration">The DojoSeminarRegistration to copy to.</param>
 public void CopyTo(DojoSeminarRegistration dojoSeminarRegistration)
 {
     CopyTo(dojoSeminarRegistration, false);
 }