Example #1
0
        public void reset()
        {
            DojoTest recentTest = null;

            DojoTestManager    tm    = new DojoTestManager();
            DojoTestCollection tests = tm.GetCollection(string.Empty, "TestDate", null);

            // Select the most recent test automatically
            if (!Page.IsPostBack)
            {
                if (tests.Count > 0)
                {
                    recentTest = tests[0];
                }

                foreach (DojoTest test in tests)
                {
                    if ((DateTime.Now - test.TestDate).Negate() <
                        (DateTime.Now - recentTest.TestDate).Negate())
                    {
                        recentTest = test;
                    }
                }
            }

            if (recentTest != null)
            {
                foreach (ListItem i in ddTest.Items)
                {
                    i.Selected = i.Value == recentTest.ID.ToString();
                }
            }
        }
        private void btPromote_Click(object sender, EventArgs e)
        {
            if (ddTests.SelectedValue != "-1")
            {
                DojoMember    member    = new DojoMember(this.SelectedID);
                DojoTest      test      = new DojoTest(int.Parse(ddTests.SelectedValue));
                DojoPromotion promotion = new DojoPromotion();

                promotion.LastRank      = member.Rank;
                promotion.Member        = member;
                promotion.PromotionDate = test.TestDate;
                promotion.PromotionRank = member.Rank.PromotionRank;
                promotion.Test          = test;
                promotion.Save();

                member.Rank     = member.Rank.PromotionRank;
                member.RankDate = test.TestDate;
                member.Save();

//				MembershipScan mScan = new MembershipScan();
//				mScan.FixAttendance();

                Page.ClientScript.RegisterStartupScript(this.GetType(), "WarningMessage",
                                                        "<script language=\"javascript\">alert('" +
                                                        member.PrivateContact.FullName + " promoted to " + member.Rank.Name + "." +
                                                        "');</script>");;
            }
        }
Example #3
0
        public DojoMemberCollection GetEligibleMembers()
        {
            DojoTest tempTest = new DojoTest();

            tempTest.TestDate = DateTime.Now;
            return(GetEligibleMembers(tempTest));
        }
Example #4
0
 public void CompileTestList(DojoTest test)
 {
     if (test.ActiveTestList != null)
     {
         CompileTestList(test.ActiveTestList);
     }
 }
Example #5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            #region Process Test List Postback

            if (Page.IsPostBack)
            {
                string key;

                for (int i = 0; i < Page.Request.Form.Count; i++)
                {
                    key = Page.Request.Form.GetKey(i);

                    if (key.StartsWith(this.ClientID + "_remove_"))
                    {
                        int memberID =
                            int.Parse(key.Substring(this.ClientID.Length + 8));

                        DojoTest          test = new DojoTest(selectedID);
                        TestListGenerator gen  = new TestListGenerator(connectionString);
                        gen.RemoveMember(test.ActiveTestList,
                                         DojoMember.NewPlaceHolder(memberID));
                        gen.CompileTestList(test);
                    }
                }
            }

            #endregion
        }
Example #6
0
        public TestCandidateCollection BuildTestList(DojoTest test)
        {
            if (test.ActiveTestList != null)
            {
                return(BuildTestList(test.ActiveTestList));
            }

            return(null);
        }
Example #7
0
		protected void ok_Click(object sender, EventArgs e)
		{
			if(dojoPromotionID == 0)
				obj = new DojoPromotion();
			else
				obj = new DojoPromotion(dojoPromotionID);

			obj.PromotionDate = DateTime.Parse(tbPromotionDate.Text);

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

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

			if(msPromotionRank.SelectedItem != null && msPromotionRank.SelectedItem.Value != "Null")
				obj.PromotionRank = DojoRank.NewPlaceHolder(
					int.Parse(msPromotionRank.SelectedItem.Value));
			else
				obj.PromotionRank = null;

			if(msLastRank.SelectedItem != null && msLastRank.SelectedItem.Value != "Null")
				obj.LastRank = DojoRank.NewPlaceHolder(
					int.Parse(msLastRank.SelectedItem.Value));
			else
				obj.LastRank = null;

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

			if(editOnAdd)
				dojoPromotionID = obj.Save();
			else
				obj.Save();

			if(resetOnAdd)
			{
				tbPromotionDate.Text = DateTime.Now.ToString();
				msMember.SelectedIndex = 0;
				msTest.SelectedIndex = 0;
				msPromotionRank.SelectedIndex = 0;
				msLastRank.SelectedIndex = 0;
				msStatus.SelectedIndex = 0;
			}

			OnUpdated(EventArgs.Empty);
		}
Example #8
0
        protected void btOk_Click(object sender, EventArgs e)
        {
            DojoTest dojoTest = new DojoTest(dojoTestID);

            dojoTest.Delete();

            dojoTestID = 0;

            OnDeleted(EventArgs.Empty);
        }
Example #9
0
 /// <summary>
 /// Given an instance of a player's test class, will
 /// call that test's Benchmark() method, safely
 /// catching any exceptions. If an exception occurs,
 /// meaning the player failed the test case, then they
 /// will be penalized 250ms.
 /// </summary>
 /// <param name="test"></param>
 protected void Run(DojoTest <T> test)
 {
     try
     {
         test.Benchmark();
     }
     catch
     {
         Thread.Sleep(250);
     }
 }
Example #10
0
        public void Remove(DojoTest value)
        {
            OnCollectionChanged(EventArgs.Empty);
            int index = IndexOf(value);

            if (index == -1)
            {
                throw(new Exception("DojoTest not found in collection."));
            }
            RemoveAt(index);
        }
Example #11
0
 public int Add(DojoTest value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         ensureArrays();
         addIndexKey(value.ID);
         DojoTestArray[count - 1] = value;
         return(count - 1);
     }
 }
Example #12
0
 public void Add(DojoTest dojoTest, TimeSpan slidingExpiration)
 {
     lock (this)
     {
         count++;
         ensureArrays();
         dojoTestArray[count - 1]       = dojoTest;
         timeStamps[count - 1]          = DateTime.Now;
         absoluteExpirations[count - 1] = DateTime.Now.Add(slidingExpiration); // Never Expires
         slidingExpirations[count - 1]  = slidingExpiration;                   // Never slides
         quickSort(0, count - 1);
     }
 }
Example #13
0
 protected override void OnPreRender(EventArgs e)
 {
     if (dojoTestID != 0)
     {
         dojoTest = new DojoTest(dojoTestID);
         text     = "Delete - " + dojoTest.ToString();
     }
     else
     {
         text = "Delete ";
     }
     EnsureWindowScripts();
 }
Example #14
0
 public int IndexOf(DojoTest value)
 {
     lock (this)
     {
         for (int x = 0; x < count; x++)
         {
             if (DojoTestArray[x].Equals(value))
             {
                 return(x);
             }
         }
     }
     return(-1);
 }
Example #15
0
 public void Insert(int index, DojoTest value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         ensureArrays();
         addIndexKey(value.ID);
         for (int x = index + 1; x == count - 2; x++)
         {
             DojoTestArray[x] = DojoTestArray[x - 1];
         }
         DojoTestArray[index] = value;
     }
 }
Example #16
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 #17
0
 /// <summary>
 /// Ensures that the index and object array are sized correctly
 /// for additions. This method should be protected by locks
 /// issued by calling methods.
 /// </summary>
 private void ensureArrays()
 {
     if (count > DojoTestArray.GetUpperBound(0) + 1)
     {
         int[,] tempIndex = new int[count * 2, 2];
         DojoTest[] tempDojoTestArray = new DojoTest[count * 2];
         for (int x = 0; x <= DojoTestArray.GetUpperBound(0); x++)
         {
             tempIndex[x, 0]      = index[x, 0];                  // Copy ID
             tempIndex[x, 1]      = index[x, 1];                  // Copy Location
             tempDojoTestArray[x] = DojoTestArray[x];             // Copy Object
         }
         index         = tempIndex;
         DojoTestArray = tempDojoTestArray;
     }
 }
Example #18
0
 /// <summary>
 /// Ensures that the index and object array are sized correctly
 /// for additions. This method should be protected by locks
 /// issued by calling methods.
 /// </summary>
 private void ensureArrays()
 {
     if (count > dojoTestArray.GetUpperBound(0) + 1)
     {
         DojoTest[] tempDojoTestArray       = new DojoTest[count * 2];
         DateTime[] tempTimeStamps          = new DateTime[count * 2];
         DateTime[] tempAbsoluteExpirations = new DateTime[count * 2];
         TimeSpan[] tempSlidingExpirations  = new TimeSpan[count * 2];
         Array.Copy(dojoTestArray, tempDojoTestArray, count - 1);
         Array.Copy(timeStamps, tempTimeStamps, count - 1);
         Array.Copy(absoluteExpirations, tempAbsoluteExpirations, count - 1);
         Array.Copy(slidingExpirations, tempSlidingExpirations, count - 1);
         dojoTestArray       = tempDojoTestArray;
         timeStamps          = tempTimeStamps;
         absoluteExpirations = tempAbsoluteExpirations;
         slidingExpirations  = tempSlidingExpirations;
     }
 }
Example #19
0
 public void CheckedAdd(DojoTest dojoTest, TimeSpan slidingExpiration)
 {
     lock (this)
     {
         int i = binarySearch(dojoTest.iD);
         if (i != -1)
         {
             dojoTestArray[i]       = dojoTest;
             absoluteExpirations[i] = DateTime.Now.Add(slidingExpiration);  // Expires
             slidingExpirations[i]  = slidingExpiration;                    // Never slides
             return;
         }
         count++;
         ensureArrays();
         dojoTestArray[count - 1]       = dojoTest;
         timeStamps[count - 1]          = DateTime.Now;
         absoluteExpirations[count - 1] = DateTime.Now.Add(slidingExpiration); // Expires
         slidingExpirations[count - 1]  = slidingExpiration;                   // Never slides
         quickSort(0, count - 1);
     }
 }
Example #20
0
        public DojoMemberCollection GetEligibleMembers(DojoTest test)
        {
            DojoMemberManager    m;
            DojoMemberCollection members;
            DojoMemberCollection eligibleMembers;

            // Load active members
            eligibleMembers = new DojoMemberCollection();
            m       = new DojoMemberManager();
            members = m.GetCollection("DojoMember.IsPrimaryOrgActive=true",
                                      "DojoMember.RankID, DojoMember.RankDate DESC",
                                      new DojoMemberFlags[]
            {
                DojoMemberFlags.PrivateContact,
                DojoMemberFlags.Rank
            });

            // Create temp test if none specified
            if (test == null)
            {
                test          = new DojoTest();
                test.TestDate = DateTime.Now;
            }

            // Add members that satisfy requirements
            foreach (DojoMember member in members)
            {
                if (member.Rank.PromotionRank != null)
                {
                    if (member.TestEligibilityDate <= DateTime.Now &
                        member.TestEligibilityHoursBalance >= TimeSpan.Zero)
                    {
                        eligibleMembers.Add(member);
                    }
                }
            }

            return(eligibleMembers);
        }
Example #21
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 #22
0
        public override void Render(System.Web.UI.HtmlTextWriter output)
        {
            DojoTest test;
            TestCandidateCollection candidates;
            TestListGenerator       gen;
            string    connectionString;
            TableGrid grid;

            if (ParentWindow is TableGrid)
            {
                grid = (TableGrid)ParentWindow;

                if (ParentWindow is DojoTestGrid)
                {
                    connectionString = ((DojoTestGrid)ParentWindow).ConnectionString;
                }
                else if (ParentWindow is DojoTestListGrid)
                {
                    connectionString = ((DojoTestListGrid)ParentWindow).ConnectionString;
                }
                else
                {
                    throw(new Exception("Parent window is not supported."));
                }
            }
            else
            {
                throw(new Exception("Parent window is not supported."));
            }

            test = new DojoTest(int.Parse(grid.Page.Request.QueryString[0]));

            RenderTableBeginTag(output, "_viewPanel", grid.CellPadding, grid.CellSpacing, Unit.Percentage(100), Unit.Empty, grid.CssClass);

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("th");
            output.WriteAttribute("colspan", "4");
            output.WriteAttribute("class", grid.HeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write(test.Name);
            output.WriteEndTag("th");
            output.WriteEndTag("tr");

            #region Candidates Information

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.WriteAttribute("colspan", "4");
            output.WriteAttribute("class", grid.SubHeaderCssClass);
            output.Write(HtmlTextWriter.TagRightChar);
            output.Write("Candidates");
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            if (test.ActiveTestList != null)
            {
                gen        = new TestListGenerator(connectionString);
                candidates = gen.BuildTestList(test);

                foreach (TestCandidate candidate in candidates)
                {
                    if (!candidate.IsRemoved)
                    {
                        output.WriteFullBeginTag("tr");

                        output.WriteBeginTag("td");
                        output.WriteAttribute("class", grid.DefaultRowCssClass);
                        output.Write(HtmlTextWriter.TagRightChar);
                        output.Write(candidate.Member.PrivateContact.ConstructName("L,FMi"));
                        output.WriteEndTag("td");

                        output.WriteBeginTag("td");
                        output.WriteAttribute("class", grid.DefaultRowCssClass);
                        output.Write(HtmlTextWriter.TagRightChar);
                        output.Write(candidate.Status.Name);
                        output.WriteEndTag("td");

                        output.WriteBeginTag("td");
                        output.WriteAttribute("class", grid.DefaultRowCssClass);
                        output.Write(HtmlTextWriter.TagRightChar);
                        output.Write(candidate.LastEntry.Comment);
                        output.WriteEndTag("td");

                        output.WriteBeginTag("td");
                        output.WriteAttribute("class", grid.DefaultRowCssClass);
                        output.Write(HtmlTextWriter.TagRightChar);
                        output.Write("<input type=\"submit\" name=\"" +
                                     grid.ClientID + "_remove_" + candidate.Member.ID.ToString() +
                                     "\" value=\"Remove\" />");
                        output.WriteEndTag("td");

                        output.WriteEndTag("tr");
                    }
                }
            }
            else
            {
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                output.WriteAttribute("colspan", "4");
                output.WriteAttribute("class", grid.DefaultRowCssClass);
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("No active test list found.");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
            }

            #endregion

            output.WriteEndTag("table");
        }
Example #23
0
        private void add()
        {
            DojoTest   test;
            DojoMember member;

            member = new DojoMember(int.Parse(ddMember.SelectedValue));

            if (dojoPromotionID == 0)
            {
                editDojoPromotion = new DojoPromotion();
            }
            else
            {
                editDojoPromotion = new DojoPromotion(dojoPromotionID);
            }

            if (ddMember.SelectedItem != null)
            {
                editDojoPromotion.Member = member;
            }
            else
            {
                editDojoPromotion.Member = null;
            }

            // If a test is not selected, set the test to null
            // and the promotion date to the date entered unless
            // the date entered is blank. In the event it is blank
            // use the current date.
            // If the test is selected, use the test and test date
            // to set the promotion test and promotion date.
            if (ddTest.SelectedValue == "-1")
            {
                editDojoPromotion.Test = null;
                try
                {
                    editDojoPromotion.PromotionDate =
                        DateTime.Parse(tbPromotionDate.Text);
                }
                catch
                {
                    editDojoPromotion.PromotionDate =
                        DateTime.Now;
                    tbPromotionDate.Text =
                        DateTime.Now.ToString();
                }
            }
            else
            {
                test = new DojoTest(int.Parse(ddTest.SelectedValue));
                editDojoPromotion.Test          = test;
                editDojoPromotion.PromotionDate = test.TestDate;
                tbPromotionDate.Text            = "";
            }

            if (ddPromotionRank.SelectedItem != null)
            {
                editDojoPromotion.PromotionRank = DojoRank.NewPlaceHolder(
                    int.Parse(ddPromotionRank.SelectedItem.Value));
            }
            else
            {
                editDojoPromotion.PromotionRank = null;
            }

            // If the Last Rank is "Current" then get the member's
            // last rank and set it.
            if (ddLastRank.SelectedValue == "-1")
            {
                editDojoPromotion.LastRank = member.Rank;
            }
            else
            {
                if (ddLastRank.SelectedItem != null)
                {
                    editDojoPromotion.LastRank = DojoRank.NewPlaceHolder(
                        int.Parse(ddLastRank.SelectedItem.Value));
                }
                else
                {
                    editDojoPromotion.LastRank = null;
                }
            }

            // Run an attendace adjustment on this rank.
            MembershipScan scan = new MembershipScan();

            scan.AttendanceAdjustment(editDojoPromotion.Member);

            dojoPromotionID = editDojoPromotion.Save();
        }
Example #24
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (loadFlag)
            {
                if (dojoTestID > 0)
                {
                    obj             = new DojoTest(dojoTestID);
                    headerText.Text = "Edit  - " + obj.ToString();
                }
                else if (dojoTestID <= 0)
                {
                    obj             = new DojoTest();
                    headerText.Text = "Add ";
                }

                // Bind Default Data
                tbName.Text        = obj.Name;
                tbDescription.Text = obj.Description;
                tbTestDate.Text    = obj.TestDate.ToString();
                if (obj.Location != null)
                {
                    comboLocation.Text = obj.Location.BusinessName;
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboLocation.Items)
                    {
                        if (item.Value == obj.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;
                }

                // Bind List Generator Data
                if (obj.ListMemberType1 != null)
                {
                    comboListMemberType1.Text = obj.ListMemberType1.Name;
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboListMemberType1.Items)
                    {
                        if (item.Value == obj.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 (obj.ListMemberType2 != null)
                {
                    comboListMemberType2.Text = obj.ListMemberType2.Name;
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboListMemberType2.Items)
                    {
                        if (item.Value == obj.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 (obj.ListMemberType3 != null)
                {
                    comboListMemberType3.Text = obj.ListMemberType3.Name;
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboListMemberType3.Items)
                    {
                        if (item.Value == obj.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;
                }

                // Bind Administration Data
                if (obj.PanelChief != null)
                {
                    foreach (ListItem item in ddPanelChief.Items)
                    {
                        item.Selected = obj.PanelChief.ID.ToString() == item.Value;
                    }
                }
                else if (ddPanelChief.Items.Count > 0)
                {
                    ddPanelChief.SelectedIndex = 0;
                }

                tbPanelMembers.Text = obj.PanelMembers.ToEncodedString("\r\n", "");

                // Bind System Data
                if (obj.Status != null)
                {
                    comboStatus.Text = obj.Status.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboStatus.Items)
                    {
                        if (item.Value == obj.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 (obj.ActiveTestList != null)
                {
                    foreach (ListItem item in ddActiveTestList.Items)
                    {
                        item.Selected = obj.ActiveTestList.ID.ToString() == item.Value;
                    }
                }
                else if (ddActiveTestList.Items.Count > 0)
                {
                    ddActiveTestList.SelectedIndex = 0;
                }


                // Bind Rappahanock Data
                if (obj.Item != null)
                {
                    comboItem.Text = obj.Item.ToString();
                    foreach (ComponentArt.Web.UI.ComboBoxItem item in comboItem.Items)
                    {
                        if (item.Value == obj.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;
                }
                tabstrip.SelectedTab    = tabstrip.Tabs[0];
                multipage.SelectedIndex = 0;
            }
        }
Example #25
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 #26
0
        protected override void OnPreRender(EventArgs e)
        {
            if (loadFlag)
            {
                if (dojoTestID > 0)
                {
                    obj  = new DojoTest(dojoTestID);
                    text = "Edit  - " + obj.ToString();
                }
                else if (dojoTestID <= 0)
                {
                    obj  = new DojoTest();
                    text = "Add ";
                }

                //
                // Set Field Entries
                //
                tbName.Text        = obj.Name;
                tbDescription.Text = obj.Description;
                tbTestDate.Text    = obj.TestDate.ToString();

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

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

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

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

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

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

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

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

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

                if (obj.PanelMember5 != null)
                {
                    foreach (ListItem item in msPanelMember5.Items)
                    {
                        item.Selected = obj.PanelMember5.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msPanelMember5.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.ActiveTestList != null)
                {
                    foreach (ListItem item in msActiveTestList.Items)
                    {
                        item.Selected = obj.ActiveTestList.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msActiveTestList.SelectedIndex = 0;
                }

                if (obj.Item != null)
                {
                    foreach (ListItem item in msItem.Items)
                    {
                        item.Selected = obj.Item.ID.ToString() == item.Value;
                    }
                }
                else
                {
                    msItem.SelectedIndex = 0;
                }
            }
        }
Example #27
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 #28
0
 public bool Contains(DojoTest value)
 {
     return(IndexOf(value) != -1);
 }
Example #29
0
        protected override void OnPreRender(EventArgs e)
        {
            if (dojoTestID != 0)
            {
                dojoTest = new DojoTest(dojoTestID);

                #region Bind Default Folder

                //
                // Set Field Entries
                //

                ltName.Text        = dojoTest.Name.ToString();
                ltDescription.Text = dojoTest.Description.ToString();
                ltTestDate.Text    = dojoTest.TestDate.ToString();

                //
                // Set Children Selections
                //

                // Location

                if (dojoTest.Location != null)
                {
                    ltLocation.Text = dojoTest.Location.ToString();
                }
                else
                {
                    ltLocation.Text = string.Empty;
                }


                #endregion

                #region Bind _system Folder

                //
                // Set Field Entries
                //


                //
                // Set Children Selections
                //


                #endregion

                #region Bind List Generator Folder

                //
                // Set Field Entries
                //


                //
                // Set Children Selections
                //

                // ListMemberType1

                if (dojoTest.ListMemberType1 != null)
                {
                    ltListMemberType1.Text = dojoTest.ListMemberType1.ToString();
                }
                else
                {
                    ltListMemberType1.Text = string.Empty;
                }

                // ListMemberType2

                if (dojoTest.ListMemberType2 != null)
                {
                    ltListMemberType2.Text = dojoTest.ListMemberType2.ToString();
                }
                else
                {
                    ltListMemberType2.Text = string.Empty;
                }

                // ListMemberType3

                if (dojoTest.ListMemberType3 != null)
                {
                    ltListMemberType3.Text = dojoTest.ListMemberType3.ToString();
                }
                else
                {
                    ltListMemberType3.Text = string.Empty;
                }


                #endregion

                #region Bind Administration Folder

                //
                // Set Field Entries
                //


                //
                // Set Children Selections
                //

                // PanelChief

                if (dojoTest.PanelChief != null)
                {
                    ltPanelChief.Text = dojoTest.PanelChief.ToString();
                }
                else
                {
                    ltPanelChief.Text = string.Empty;
                }

                // PanelMember1

                if (dojoTest.PanelMember1 != null)
                {
                    ltPanelMember1.Text = dojoTest.PanelMember1.ToString();
                }
                else
                {
                    ltPanelMember1.Text = string.Empty;
                }

                // PanelMember2

                if (dojoTest.PanelMember2 != null)
                {
                    ltPanelMember2.Text = dojoTest.PanelMember2.ToString();
                }
                else
                {
                    ltPanelMember2.Text = string.Empty;
                }

                // PanelMember3

                if (dojoTest.PanelMember3 != null)
                {
                    ltPanelMember3.Text = dojoTest.PanelMember3.ToString();
                }
                else
                {
                    ltPanelMember3.Text = string.Empty;
                }

                // PanelMember4

                if (dojoTest.PanelMember4 != null)
                {
                    ltPanelMember4.Text = dojoTest.PanelMember4.ToString();
                }
                else
                {
                    ltPanelMember4.Text = string.Empty;
                }

                // PanelMember5

                if (dojoTest.PanelMember5 != null)
                {
                    ltPanelMember5.Text = dojoTest.PanelMember5.ToString();
                }
                else
                {
                    ltPanelMember5.Text = string.Empty;
                }


                #endregion

                #region Bind System Folder

                //
                // Set Field Entries
                //


                //
                // Set Children Selections
                //

                // Status

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

                // ActiveTestList

                if (dojoTest.ActiveTestList != null)
                {
                    ltActiveTestList.Text = dojoTest.ActiveTestList.ToString();
                }
                else
                {
                    ltActiveTestList.Text = string.Empty;
                }


                #endregion

                #region Bind Rappahanock Folder

                //
                // Set Field Entries
                //


                //
                // Set Children Selections
                //

                // Item

                if (dojoTest.Item != null)
                {
                    ltItem.Text = dojoTest.Item.ToString();
                }
                else
                {
                    ltItem.Text = string.Empty;
                }


                #endregion

                text = "View  - " + dojoTest.ToString();
            }
        }