Beispiel #1
0
        /// <summary>
        /// Duplicates DojoTestListJournalEntry object into a database; may or may not be the same database
        /// as the parent object.
        /// </summary>
        /// <returns> A new DojoTestListJournalEntry object reflecting the replicated DojoTestListJournalEntry object.</returns>
        public DojoTestListJournalEntry Duplicate()
        {
            DojoTestListJournalEntry clonedDojoTestListJournalEntry = this.Clone();

            // Insert must be called after children are replicated!
            clonedDojoTestListJournalEntry.iD       = DojoTestListJournalEntryManager._insert(clonedDojoTestListJournalEntry);
            clonedDojoTestListJournalEntry.isSynced = true;
            return(clonedDojoTestListJournalEntry);
        }
Beispiel #2
0
        /// <summary>
        /// Ensures that the object's fields and children are
        /// pre-loaded before any updates or reads.
        /// </summary>
        public void EnsurePreLoad()
        {
            if (!isPlaceHolder)
            {
                return;
            }

            DojoTestListJournalEntryManager._fill(this);
            isPlaceHolder = false;
        }
        /// <summary>
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void RenderContent(HtmlTextWriter output)
        {
            DojoTestListJournalEntryManager    m = new DojoTestListJournalEntryManager();
            DojoTestListJournalEntryCollection dojoTestListJournalEntryCollection = m.GetCollection(string.Empty, string.Empty, null);

            // Render Header Row
            this.headerLockEnabled = true;
            RenderRow(this.HeaderRowCssClass, "Entry");

            bool   rowflag = false;
            string rowCssClass;

            //
            // Render Records
            //
            foreach (DojoTestListJournalEntry dojoTestListJournalEntry in dojoTestListJournalEntryCollection)
            {
                if (rowflag)
                {
                    rowCssClass = defaultRowCssClass;
                }
                else
                {
                    rowCssClass = alternateRowCssClass;
                }
                rowflag = !rowflag;
                output.WriteBeginTag("tr");
                output.WriteAttribute("i", dojoTestListJournalEntry.ID.ToString());
                output.WriteLine(HtmlTextWriter.TagRightChar);
                output.Indent++;
                output.WriteBeginTag("td");
                output.WriteAttribute("class", rowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write(dojoTestListJournalEntry.Member.PrivateContact.ConstructName("L,FMi"));
                output.WriteEndTag("td");
                output.Indent--;
                output.WriteEndTag("tr");
                output.WriteLine();
            }
        }
Beispiel #4
0
        /// <summary>
        /// Saves the DojoTestListJournalEntry object state to the database.
        /// </summary>
        public int Save()
        {
            if (isSynced)
            {
                return(iD);
            }

            if (iD == -1)
            {
                throw (new Exception("Invalid record; cannot be saved."));
            }
            if (iD == 0)
            {
                iD = DojoTestListJournalEntryManager._insert(this);
            }
            else
            {
                DojoTestListJournalEntryManager._update(this);
            }
            isSynced = iD != -1;
            return(iD);
        }
Beispiel #5
0
 /// <summary>
 /// Overwrites and existing DojoTestListJournalEntry object in the database.
 /// </summary>
 public void Overwrite(int id)
 {
     iD = id;
     DojoTestListJournalEntryManager._update(this);
     isSynced = true;
 }
Beispiel #6
0
 public void Delete()
 {
     DojoTestListJournalEntryManager._delete(this.iD);
     this.iD  = 0;
     isSynced = false;
 }
Beispiel #7
0
 public DojoTestListJournalEntry(int id)
 {
     this.iD  = id;
     isSynced = DojoTestListJournalEntryManager._fill(this);
 }
Beispiel #8
0
        public TestCandidateCollection BuildTestList(DojoTestList list)
        {
            DojoTestListJournalEntryManager    journal;
            DojoTestListJournalEntryCollection entries;
            DojoTestListJournalEntry           entry;
            DojoTestListJournalEntry           lastEntry;
            DojoTestListJournalEntryType       type;
            TestCandidate           candidate;
            TestCandidateCollection candidates;

            journal =
                new DojoTestListJournalEntryManager();

            // Get journal entries by testlist and be sure to sort by
            // member and create date. This will allow processing members
            // without nested loops.
            entries =
                journal.GetCollection("TestListID=" + list.ID.ToString(),
                                      "RankID, " +
                                      "LastName, " +
                                      "FirstName, " +
                                      "MemberID, " +
                                      "Member.CreateDate ASC",
                                      DojoTestListJournalEntryFlags.Member,
                                      DojoTestListJournalEntryFlags.MemberPrivateContact);

            if (entries.Count > 0)
            {
                candidates = new TestCandidateCollection();
                candidate  = new TestCandidate(entries[0].Member);
                lastEntry  = entries[0];
                type       = lastEntry.EntryType;

                for (int i = 0; i < entries.Count; i++)
                {
                    entry = entries[i];

                    // If the new entry's member does not match the
                    // last member, then check to see if the last
                    // member was left in the add state. If so, add
                    // the member to the candidates list.
                    // The candidate's last type becomes the status
                    if (candidate.Member.ID != entry.Member.ID)
                    {
                        candidate.LastEntry = lastEntry;
                        candidates.Add(candidate);
                        candidate = new TestCandidate(entry.Member);
                    }

                    lastEntry = entry;
                    type      = entry.EntryType;

                    // Enable memberAdd flag if the entry
                    // was added.
                    if (entry.EntryType.Eligible)
                    {
                        candidate.IsRemoved = false;
                        candidate.Eligibility.Add(entry);
                    }

                    // Disable memberAdd flag if the entry
                    // was removed.
                    if (entry.EntryType.Ineligible)
                    {
                        candidate.IsRemoved = true;
                        candidate.Eligibility.Add(entry);
                    }

                    if (entry.EntryType.CertificateRequest |
                        entry.EntryType.CertificatePending |
                        entry.EntryType.CertificateReceived)
                    {
                        candidate.Certification.Add(entry);
                    }
                }

                // Process Last Entry
                candidate.LastEntry = lastEntry;
                candidates.Add(candidate);
            }
            else
            {
                candidates = null;
            }

            return(candidates);
        }