protected void btOk_Click(object sender, EventArgs e)
        {
            DojoTestList dojoTestList = new DojoTestList(dojoTestListID);

            dojoTestList.Delete();

            dojoTestListID = 0;

            OnDeleted(EventArgs.Empty);
        }
 protected override void OnPreRender(EventArgs e)
 {
     if (dojoTestListID != 0)
     {
         dojoTestList = new DojoTestList(dojoTestListID);
         text         = "Delete - " + dojoTestList.ToString();
     }
     else
     {
         text = "Delete ";
     }
     EnsureWindowScripts();
 }
Example #3
0
        public void RemoveMember(DojoTestList list, DojoMember member)
        {
            DojoTestListJournalEntry entry;

            entry = new DojoTestListJournalEntry();

            entry.Comment   = "Removed member.";
            entry.Editor    = null;
            entry.EntryType = _journalTypeRemove;
            entry.Member    = member;
            entry.Promotion = null;
            entry.TestList  = list;

            entry.Save();
        }
Example #4
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 #5
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 #6
0
        protected override void OnPreRender(EventArgs e)
        {
            if (loadFlag)
            {
                if (dojoTestListID > 0)
                {
                    obj  = new DojoTestList(dojoTestListID);
                    text = "Edit  - " + obj.ToString();
                }
                else if (dojoTestListID <= 0)
                {
                    obj  = new DojoTestList();
                    text = "Add ";
                }

                //
                // Set Field Entries
                //
                ltCreateDate.Text            = obj.CreateDate.ToString();
                ltModifyDate.Text            = obj.ModifyDate.ToString();
                tbEditorComments.Text        = obj.EditorComments;
                cbField1.Checked             = obj.Field1;
                ltCandidatesCompileDate.Text = obj.CandidatesCompileDate.ToString();

                //
                // Set Children Selections
                //
                if (obj.Test != null)
                {
                    foreach (ListItem item in msTest.Items)
                    {
                        item.Selected = obj.Test.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msTest.SelectedIndex = 0;
                }

                if (obj.Status != null)
                {
                    foreach (ListItem item in msStatus.Items)
                    {
                        item.Selected = obj.Status.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msStatus.SelectedIndex = 0;
                }

                if (obj.Editor != null)
                {
                    foreach (ListItem item in msEditor.Items)
                    {
                        item.Selected = obj.Editor.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msEditor.SelectedIndex = 0;
                }
            }
        }
Example #7
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);
        }
Example #8
0
        protected override void OnPreRender(EventArgs e)
        {
            if (dojoTestListID != 0)
            {
                dojoTestList = new DojoTestList(dojoTestListID);

                #region Bind _system Folder

                //
                // Set Field Entries
                //

                ltCreateDate.Text = dojoTestList.CreateDate.ToString();
                ltModifyDate.Text = dojoTestList.ModifyDate.ToString();

                //
                // Set Children Selections
                //


                #endregion

                #region Bind General Folder

                //
                // Set Field Entries
                //

                ltEditorComments.Text = dojoTestList.EditorComments.ToString();

                //
                // Set Children Selections
                //

                // Test

                if (dojoTestList.Test != null)
                {
                    ltTest.Text = dojoTestList.Test.ToString();
                }
                else
                {
                    ltTest.Text = string.Empty;
                }

                // Status

                if (dojoTestList.Status != null)
                {
                    ltStatus.Text = dojoTestList.Status.ToString();
                }
                else
                {
                    ltStatus.Text = string.Empty;
                }

                // Editor

                if (dojoTestList.Editor != null)
                {
                    ltEditor.Text = dojoTestList.Editor.ToString();
                }
                else
                {
                    ltEditor.Text = string.Empty;
                }


                #endregion

                text = "View  - " + dojoTestList.ToString();
            }
        }
Example #9
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoTestListJournalEntryID == 0)
            {
                obj = new DojoTestListJournalEntry();
            }
            else
            {
                obj = new DojoTestListJournalEntry(dojoTestListJournalEntryID);
            }

            obj.Comment = tbComment.Text;

            if (msTestList.SelectedItem != null && msTestList.SelectedItem.Value != "Null")
            {
                obj.TestList = DojoTestList.NewPlaceHolder(
                    int.Parse(msTestList.SelectedItem.Value));
            }
            else
            {
                obj.TestList = null;
            }

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

            if (msEntryType.SelectedItem != null && msEntryType.SelectedItem.Value != "Null")
            {
                obj.EntryType = DojoTestListJournalEntryType.NewPlaceHolder(
                    int.Parse(msEntryType.SelectedItem.Value));
            }
            else
            {
                obj.EntryType = null;
            }

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

            if (msPromotion.SelectedItem != null && msPromotion.SelectedItem.Value != "Null")
            {
                obj.Promotion = DojoPromotion.NewPlaceHolder(
                    int.Parse(msPromotion.SelectedItem.Value));
            }
            else
            {
                obj.Promotion = null;
            }

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

            if (resetOnAdd)
            {
                tbComment.Text            = string.Empty;
                msTestList.SelectedIndex  = 0;
                msMember.SelectedIndex    = 0;
                msEntryType.SelectedIndex = 0;
                msEditor.SelectedIndex    = 0;
                msPromotion.SelectedIndex = 0;
            }

            OnUpdated(EventArgs.Empty);
        }
Example #10
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoTestID == 0)
            {
                obj = new DojoTest();
            }
            else
            {
                obj = new DojoTest(dojoTestID);
            }

            obj.Name        = tbName.Text;
            obj.Description = tbDescription.Text;
            obj.TestDate    = DateTime.Parse(tbTestDate.Text);
            if (comboLocation.SelectedItem != null)
            {
                obj.Location = GreyFoxContact.NewPlaceHolder("kitTessen_Locations", int.Parse(comboLocation.SelectedValue));
            }
            else
            {
                obj.Location = null;
            }
            if (comboListMemberType1.SelectedItem != null)
            {
                obj.ListMemberType1 = DojoMemberType.NewPlaceHolder(int.Parse(comboListMemberType1.SelectedValue));
            }
            else
            {
                obj.ListMemberType1 = null;
            }
            if (comboListMemberType2.SelectedItem != null)
            {
                obj.ListMemberType2 = DojoMemberType.NewPlaceHolder(int.Parse(comboListMemberType2.SelectedValue));
            }
            else
            {
                obj.ListMemberType2 = null;
            }
            if (comboListMemberType3.SelectedItem != null)
            {
                obj.ListMemberType3 = DojoMemberType.NewPlaceHolder(int.Parse(comboListMemberType3.SelectedValue));
            }
            else
            {
                obj.ListMemberType3 = null;
            }
            if (ddPanelChief.SelectedItem != null && ddPanelChief.SelectedValue != "null")
            {
                obj.PanelChief = DojoMember.NewPlaceHolder(int.Parse(ddPanelChief.SelectedValue));
            }
            else
            {
                obj.PanelChief = null;
            }
            DojoMemberManager panelMembersManager = new DojoMemberManager();

            obj.PanelMembers = panelMembersManager.DecodeString(tbPanelMembers.Text, "");

            if (comboStatus.SelectedItem != null)
            {
                obj.Status = DojoTestListStatus.NewPlaceHolder(int.Parse(comboStatus.SelectedValue));
            }
            else
            {
                obj.Status = null;
            }
            if (ddActiveTestList.SelectedItem != null && ddActiveTestList.SelectedValue != "null")
            {
                obj.ActiveTestList = DojoTestList.NewPlaceHolder(int.Parse(ddActiveTestList.SelectedValue));
            }
            else
            {
                obj.ActiveTestList = null;
            }
            if (comboItem.SelectedItem != null)
            {
                obj.Item = RHItem.NewPlaceHolder(int.Parse(comboItem.SelectedValue));
            }
            else
            {
                obj.Item = null;
            }
            if (editOnAdd)
            {
                dojoTestID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                DojoTest newObj = new DojoTest();
                tbName.Text        = newObj.Name;
                tbDescription.Text = newObj.Description;
                tbTestDate.Text    = newObj.TestDate.ToString();
                if (newObj.Location != null)
                {
                    comboLocation.Text = newObj.Location.BusinessName;
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboLocation.Items)
                    {
                        if (item.Value == newObj.Location.ID.ToString())
                        {
                            comboLocation.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboLocation.Text         = string.Empty;
                    comboLocation.SelectedItem = null;
                }
                if (newObj.ListMemberType1 != null)
                {
                    comboListMemberType1.Text = newObj.ListMemberType1.Name;
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboListMemberType1.Items)
                    {
                        if (item.Value == newObj.ListMemberType1.ID.ToString())
                        {
                            comboListMemberType1.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboListMemberType1.Text         = string.Empty;
                    comboListMemberType1.SelectedItem = null;
                }
                if (newObj.ListMemberType2 != null)
                {
                    comboListMemberType2.Text = newObj.ListMemberType2.Name;
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboListMemberType2.Items)
                    {
                        if (item.Value == newObj.ListMemberType2.ID.ToString())
                        {
                            comboListMemberType2.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboListMemberType2.Text         = string.Empty;
                    comboListMemberType2.SelectedItem = null;
                }
                if (newObj.ListMemberType3 != null)
                {
                    comboListMemberType3.Text = newObj.ListMemberType3.Name;
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboListMemberType3.Items)
                    {
                        if (item.Value == newObj.ListMemberType3.ID.ToString())
                        {
                            comboListMemberType3.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboListMemberType3.Text         = string.Empty;
                    comboListMemberType3.SelectedItem = null;
                }
                if (newObj.PanelChief != null)
                {
                    foreach (ListItem item in ddPanelChief.Items)
                    {
                        item.Selected = newObj.PanelChief.ID.ToString() == item.Value;
                    }
                }
                else if (ddPanelChief.Items.Count > 0)
                {
                    ddPanelChief.SelectedIndex = 0;
                }

                tbPanelMembers.Text = newObj.PanelMembers.ToEncodedString("\r\n", "");
                if (newObj.Status != null)
                {
                    comboStatus.Text = newObj.Status.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboStatus.Items)
                    {
                        if (item.Value == newObj.Status.ID.ToString())
                        {
                            comboStatus.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboStatus.Text         = string.Empty;
                    comboStatus.SelectedItem = null;
                }
                if (newObj.ActiveTestList != null)
                {
                    foreach (ListItem item in ddActiveTestList.Items)
                    {
                        item.Selected = newObj.ActiveTestList.ID.ToString() == item.Value;
                    }
                }
                else if (ddActiveTestList.Items.Count > 0)
                {
                    ddActiveTestList.SelectedIndex = 0;
                }

                if (newObj.Item != null)
                {
                    comboItem.Text = newObj.Item.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboItem.Items)
                    {
                        if (item.Value == newObj.Item.ID.ToString())
                        {
                            comboItem.SelectedItem = item;
                            break;
                        }
                    }
                }
                else
                {
                    // Necissary to clear prior ViewState - if only we don't need it.
                    comboItem.Text         = string.Empty;
                    comboItem.SelectedItem = null;
                }
            }

            OnUpdated(EventArgs.Empty);
        }
Example #11
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoTestID == 0)
            {
                obj = new DojoTest();
            }
            else
            {
                obj = new DojoTest(dojoTestID);
            }

            obj.Name        = tbName.Text;
            obj.Description = tbDescription.Text;
            obj.TestDate    = DateTime.Parse(tbTestDate.Text);

            if (msLocation.SelectedItem != null && msLocation.SelectedItem.Value != "Null")
            {
                obj.Location = GreyFoxContact.NewPlaceHolder("kitTessen_Locations",
                                                             int.Parse(msLocation.SelectedItem.Value));
            }
            else
            {
                obj.Location = null;
            }

            if (msListMemberType1.SelectedItem != null && msListMemberType1.SelectedItem.Value != "Null")
            {
                obj.ListMemberType1 = DojoMemberType.NewPlaceHolder(
                    int.Parse(msListMemberType1.SelectedItem.Value));
            }
            else
            {
                obj.ListMemberType1 = null;
            }

            if (msListMemberType2.SelectedItem != null && msListMemberType2.SelectedItem.Value != "Null")
            {
                obj.ListMemberType2 = DojoMemberType.NewPlaceHolder(
                    int.Parse(msListMemberType2.SelectedItem.Value));
            }
            else
            {
                obj.ListMemberType2 = null;
            }

            if (msListMemberType3.SelectedItem != null && msListMemberType3.SelectedItem.Value != "Null")
            {
                obj.ListMemberType3 = DojoMemberType.NewPlaceHolder(
                    int.Parse(msListMemberType3.SelectedItem.Value));
            }
            else
            {
                obj.ListMemberType3 = null;
            }

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

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

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

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

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

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

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

            if (msActiveTestList.SelectedItem != null && msActiveTestList.SelectedItem.Value != "Null")
            {
                obj.ActiveTestList = DojoTestList.NewPlaceHolder(
                    int.Parse(msActiveTestList.SelectedItem.Value));
            }
            else
            {
                obj.ActiveTestList = null;
            }

            if (msItem.SelectedItem != null && msItem.SelectedItem.Value != "Null")
            {
                obj.Item = RHItem.NewPlaceHolder(
                    int.Parse(msItem.SelectedItem.Value));
            }
            else
            {
                obj.Item = null;
            }

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

            if (resetOnAdd)
            {
                tbName.Text                     = string.Empty;
                tbDescription.Text              = string.Empty;
                tbTestDate.Text                 = DateTime.Now.ToString();
                msLocation.SelectedIndex        = 0;
                msListMemberType1.SelectedIndex = 0;
                msListMemberType2.SelectedIndex = 0;
                msListMemberType3.SelectedIndex = 0;
                msPanelChief.SelectedIndex      = 0;
                msPanelMember1.SelectedIndex    = 0;
                msPanelMember2.SelectedIndex    = 0;
                msPanelMember3.SelectedIndex    = 0;
                msPanelMember4.SelectedIndex    = 0;
                msPanelMember5.SelectedIndex    = 0;
                msStatus.SelectedIndex          = 0;
                msActiveTestList.SelectedIndex  = 0;
                msItem.SelectedIndex            = 0;
            }

            OnUpdated(EventArgs.Empty);
        }
Example #12
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);
        }