Example #1
0
        public DojoTestList Generate(DojoTest test)
        {
            DojoMemberCollection     eligibles;
            DojoTestList             list;
            DojoTestListJournalEntry entry;

            eligibles = GetEligibleMembers(test);

            // Create List
            list                       = new DojoTestList();
            list.Editor                = null;
            list.EditorComments        = "";
            list.Status                = _draftStatus;
            list.Test                  = test;
            list.Candidates            = eligibles;
            list.CandidatesCompileDate = list.CreateDate;
            list.Save();

            // Create Journal Items
            foreach (DojoMember member in eligibles)
            {
                entry = new DojoTestListJournalEntry();

                if (member.TestEligibilityHoursBalance.TotalHours > 0)
                {
                    entry.Comment = "Eligible for " + member.Rank.PromotionRank.Name + " on " +
                                    member.TestEligibilityDate.ToShortDateString() + " with an additional " +
                                    member.TestEligibilityHoursBalance.TotalHours.ToString("f") + " hours training.";
                }
                else
                {
                    entry.Comment = "Newly eligible for " + member.Rank.PromotionRank.Name + " on " +
                                    member.TestEligibilityDate.ToShortDateString() + ".";
                }
                entry.Editor    = null;
                entry.EntryType = _journalTypeAdd;
                entry.Member    = member;
                entry.Promotion = null;
                entry.TestList  = list;

                entry.Save();
            }

            test.ActiveTestList = list;
            test.Save();

            return(list);
        }
Example #2
0
        public void CompileTestList(DojoTestList list)
        {
            TestCandidateCollection buildResults;
            DojoMemberCollection    compile;
            TestCandidate           candidate;

            buildResults = BuildTestList(list);
            compile      = new DojoMemberCollection(buildResults.Count);

            for (int i = 0; i < buildResults.Count; i++)
            {
                candidate = buildResults[i];

                if (!candidate.IsRemoved)
                {
                    compile.Add(candidate.Member);
                }
            }

            list.Candidates            = compile;
            list.CandidatesCompileDate = DateTime.Now;
            list.Save();
        }
Example #3
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoTestListID == 0)
            {
                obj = new DojoTestList();
            }
            else
            {
                obj = new DojoTestList(dojoTestListID);
            }

            obj.EditorComments = tbEditorComments.Text;
            obj.Field1         = cbField1.Checked;

            if (msTest.SelectedItem != null && msTest.SelectedItem.Value != "Null")
            {
                obj.Test = DojoTest.NewPlaceHolder(
                    int.Parse(msTest.SelectedItem.Value));
            }
            else
            {
                obj.Test = null;
            }

            if (msStatus.SelectedItem != null && msStatus.SelectedItem.Value != "Null")
            {
                obj.Status = DojoTestListStatus.NewPlaceHolder(
                    int.Parse(msStatus.SelectedItem.Value));
            }
            else
            {
                obj.Status = null;
            }

            if (msEditor.SelectedItem != null && msEditor.SelectedItem.Value != "Null")
            {
                obj.Editor = DojoMember.NewPlaceHolder(
                    int.Parse(msEditor.SelectedItem.Value));
            }
            else
            {
                obj.Editor = null;
            }

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

            if (resetOnAdd)
            {
                tbEditorComments.Text  = string.Empty;
                cbField1.Checked       = false;
                msTest.SelectedIndex   = 0;
                msStatus.SelectedIndex = 0;
                msEditor.SelectedIndex = 0;
            }

            OnUpdated(EventArgs.Empty);
        }