Exemplo n.º 1
0
        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>");;
            }
        }
Exemplo n.º 2
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);
		}
Exemplo n.º 3
0
        protected void btOk_Click(object sender, EventArgs e)
        {
            DojoPromotion dojoPromotion = new DojoPromotion(dojoPromotionID);

            dojoPromotion.Delete();

            dojoPromotionID = 0;

            OnDeleted(EventArgs.Empty);
        }
Exemplo n.º 4
0
		protected override void OnPreRender(EventArgs e)
		{
			if(loadFlag)
			{
				if(dojoPromotionID > 0)
				{
					obj = new DojoPromotion(dojoPromotionID);
					text = "Edit  - " + obj.ToString();
				}
				else if(dojoPromotionID <= 0)
				{
					obj = new DojoPromotion();
					text = "Add ";
				}

				//
				// Set Field Entries
				//
				tbPromotionDate.Text = obj.PromotionDate.ToString();

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

				if(obj.Test != null)
					foreach(ListItem item in msTest.Items)
						item.Selected = obj.Test.ID.ToString() == item.Value;
					else
						msTest.SelectedIndex = 0;

				if(obj.PromotionRank != null)
					foreach(ListItem item in msPromotionRank.Items)
						item.Selected = obj.PromotionRank.ID.ToString() == item.Value;
					else
						msPromotionRank.SelectedIndex = 0;

				if(obj.LastRank != null)
					foreach(ListItem item in msLastRank.Items)
						item.Selected = obj.LastRank.ID.ToString() == item.Value;
					else
						msLastRank.SelectedIndex = 0;

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

			}
		}
Exemplo n.º 5
0
        public void Remove(DojoPromotion value)
        {
            OnCollectionChanged(EventArgs.Empty);
            int index = IndexOf(value);

            if (index == -1)
            {
                throw(new Exception("DojoPromotion not found in collection."));
            }
            RemoveAt(index);
        }
Exemplo n.º 6
0
 protected override void OnPreRender(EventArgs e)
 {
     if (dojoPromotionID != 0)
     {
         dojoPromotion = new DojoPromotion(dojoPromotionID);
         Text          = "Delete - " + dojoPromotion.ToString();
     }
     else
     {
         Text = "Delete ";
     }
 }
Exemplo n.º 7
0
 public int Add(DojoPromotion value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         ensureArrays();
         addIndexKey(value.ID);
         DojoPromotionArray[count - 1] = value;
         return(count - 1);
     }
 }
Exemplo n.º 8
0
 public void Add(DojoPromotion dojoPromotion, TimeSpan slidingExpiration)
 {
     lock (this)
     {
         count++;
         ensureArrays();
         dojoPromotionArray[count - 1]  = dojoPromotion;
         timeStamps[count - 1]          = DateTime.Now;
         absoluteExpirations[count - 1] = DateTime.Now.Add(slidingExpiration); // Never Expires
         slidingExpirations[count - 1]  = slidingExpiration;                   // Never slides
         quickSort(0, count - 1);
     }
 }
Exemplo n.º 9
0
 protected override void OnPreRender(EventArgs e)
 {
     if (dojoPromotionID != 0)
     {
         dojoPromotion = new DojoPromotion(dojoPromotionID);
         text          = "Delete - " + dojoPromotion.ToString();
     }
     else
     {
         text = "Delete ";
     }
     EnsureWindowScripts();
 }
Exemplo n.º 10
0
        protected override void OnPreRender(EventArgs e)
        {
            if (loadForm)
            {
                if (dojoPromotionID != 0)
                {
                    editDojoPromotion = new DojoPromotion(dojoPromotionID);

                    //
                    // Set Field Entries
                    //
                    tbPromotionDate.Text = editDojoPromotion.PromotionDate.ToString();

                    //
                    // Set Children Selections
                    //
                    foreach (ListItem item in ddMember.Items)
                    {
                        item.Selected = editDojoPromotion.Member.ID.ToString() == item.Value;
                    }

                    if (editDojoPromotion.Test != null)
                    {
                        foreach (ListItem item in ddTest.Items)
                        {
                            item.Selected = editDojoPromotion.Test.ID.ToString() == item.Value;
                        }
                    }

                    foreach (ListItem item in ddPromotionRank.Items)
                    {
                        item.Selected = editDojoPromotion.PromotionRank.ID.ToString() == item.Value;
                    }

                    foreach (ListItem item in ddLastRank.Items)
                    {
                        item.Selected = editDojoPromotion.LastRank.ID.ToString() == item.Value;
                    }

                    Text = "Edit Promotion - " + editDojoPromotion.Name;

                    btNext.Visible = false;
                }
                else
                {
                    Text = "Add Promotion";
                    reset();
                }
            }
        }
Exemplo n.º 11
0
 public int IndexOf(DojoPromotion value)
 {
     lock (this)
     {
         for (int x = 0; x < count; x++)
         {
             if (DojoPromotionArray[x].Equals(value))
             {
                 return(x);
             }
         }
     }
     return(-1);
 }
Exemplo n.º 12
0
 public void Insert(int index, DojoPromotion value)
 {
     OnCollectionChanged(EventArgs.Empty);
     lock (this)
     {
         count++;
         ensureArrays();
         addIndexKey(value.ID);
         for (int x = index + 1; x == count - 2; x++)
         {
             DojoPromotionArray[x] = DojoPromotionArray[x - 1];
         }
         DojoPromotionArray[index] = value;
     }
 }
Exemplo n.º 13
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 > DojoPromotionArray.GetUpperBound(0) + 1)
     {
         int[,] tempIndex = new int[count * 2, 2];
         DojoPromotion[] tempDojoPromotionArray = new DojoPromotion[count * 2];
         for (int x = 0; x <= DojoPromotionArray.GetUpperBound(0); x++)
         {
             tempIndex[x, 0]           = index[x, 0];             // Copy ID
             tempIndex[x, 1]           = index[x, 1];             // Copy Location
             tempDojoPromotionArray[x] = DojoPromotionArray[x];   // Copy Object
         }
         index = tempIndex;
         DojoPromotionArray = tempDojoPromotionArray;
     }
 }
Exemplo n.º 14
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 > dojoPromotionArray.GetUpperBound(0) + 1)
     {
         DojoPromotion[] tempDojoPromotionArray  = new DojoPromotion[count * 2];
         DateTime[]      tempTimeStamps          = new DateTime[count * 2];
         DateTime[]      tempAbsoluteExpirations = new DateTime[count * 2];
         TimeSpan[]      tempSlidingExpirations  = new TimeSpan[count * 2];
         Array.Copy(dojoPromotionArray, tempDojoPromotionArray, count - 1);
         Array.Copy(timeStamps, tempTimeStamps, count - 1);
         Array.Copy(absoluteExpirations, tempAbsoluteExpirations, count - 1);
         Array.Copy(slidingExpirations, tempSlidingExpirations, count - 1);
         dojoPromotionArray  = tempDojoPromotionArray;
         timeStamps          = tempTimeStamps;
         absoluteExpirations = tempAbsoluteExpirations;
         slidingExpirations  = tempSlidingExpirations;
     }
 }
Exemplo n.º 15
0
 public void CheckedAdd(DojoPromotion dojoPromotion, TimeSpan slidingExpiration)
 {
     lock (this)
     {
         int i = binarySearch(dojoPromotion.iD);
         if (i != -1)
         {
             dojoPromotionArray[i]  = dojoPromotion;
             absoluteExpirations[i] = DateTime.Now.Add(slidingExpiration);  // Expires
             slidingExpirations[i]  = slidingExpiration;                    // Never slides
             return;
         }
         count++;
         ensureArrays();
         dojoPromotionArray[count - 1]  = dojoPromotion;
         timeStamps[count - 1]          = DateTime.Now;
         absoluteExpirations[count - 1] = DateTime.Now.Add(slidingExpiration); // Expires
         slidingExpirations[count - 1]  = slidingExpiration;                   // Never slides
         quickSort(0, count - 1);
     }
 }
Exemplo n.º 16
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();
        }
Exemplo n.º 17
0
        protected override void OnPreRender(EventArgs e)
        {
            if (dojoPromotionID != 0)
            {
                dojoPromotion = new DojoPromotion(dojoPromotionID);

                #region Bind Default Folder

                //
                // Set Field Entries
                //

                ltPromotionDate.Text = dojoPromotion.PromotionDate.ToString();

                //
                // Set Children Selections
                //

                // Member

                if (dojoPromotion.Member != null)
                {
                    ltMember.Text = dojoPromotion.Member.ToString();
                }
                else
                {
                    ltMember.Text = string.Empty;
                }

                // Test

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

                // PromotionRank

                if (dojoPromotion.PromotionRank != null)
                {
                    ltPromotionRank.Text = dojoPromotion.PromotionRank.ToString();
                }
                else
                {
                    ltPromotionRank.Text = string.Empty;
                }

                // LastRank

                if (dojoPromotion.LastRank != null)
                {
                    ltLastRank.Text = dojoPromotion.LastRank.ToString();
                }
                else
                {
                    ltLastRank.Text = string.Empty;
                }

                // Status

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


                #endregion

                #region Bind _system Folder

                //
                // Set Field Entries
                //


                //
                // Set Children Selections
                //


                #endregion

                text = "View  - " + dojoPromotion.ToString();
            }
        }
Exemplo n.º 18
0
 public bool Contains(DojoPromotion value)
 {
     return(IndexOf(value) != -1);
 }
Exemplo n.º 19
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);
        }