예제 #1
0
		public void ClearMethod ()
		{
			ArrayList list = new ArrayList ();
			SelectedDatesCollection s = new SelectedDatesCollection (list);			
			
			s.Add (DateTime.Today);
			s.Clear ();
			Assert.AreEqual (0, s.Count, "A1");
		}
예제 #2
0
		public void SelectedDatesCollectionTest_DefaultValues ()
		{
			ArrayList list = new ArrayList ();
			SelectedDatesCollection s = new SelectedDatesCollection (list);			

			Assert.AreEqual (0, s.Count, "A1");
			Assert.AreEqual (false, s.IsReadOnly, "A2");
			Assert.AreEqual (false, s.IsSynchronized, "A3");
			Assert.AreEqual (s, s.SyncRoot, "A4");
		}
예제 #3
0
		public void AddMethod ()
		{
			ArrayList list = new ArrayList ();
			SelectedDatesCollection s = new SelectedDatesCollection (list);			
			
			s.Add (DateTime.Today);
			Assert.AreEqual (true, s.Contains (DateTime.Today), "A1");
			Assert.AreEqual (1, s.Count, "A2");
			
			s.Add (DateTime.Today);	// Duplicates are not inserted
			Assert.AreEqual (1, s.Count, "A2");
		}
        private void SelectRange(DateTime dateFrom, DateTime dateTo)
        {
            Debug.Assert(dateFrom <= dateTo, "Bad Date Range");

            // see if this range differs in any way from the current range
            // these checks will determine this because the colleciton is sorted
            TimeSpan ts = dateTo - dateFrom;

            WebControls.SelectedDatesCollection selectedDates = Control.SelectedDates;
            if (selectedDates.Count != ts.Days + 1 ||
                selectedDates[0] != dateFrom ||
                selectedDates[selectedDates.Count - 1] != dateTo)
            {
                selectedDates.SelectRange(dateFrom, dateTo);
                Control.RaiseSelectionChangedEvent();
            }
        }
예제 #5
0
		protected override void LoadViewState (object savedState)
		{
			object [] states = (object []) savedState;

			if (states [0] != null)
				 base.LoadViewState (states [0]);

			if (states [1] != null)
				DayHeaderStyle.LoadViewState (states [1]);

			if (states [2] != null)
				DayStyle.LoadViewState (states [2]);

			if (states [3] != null)
			 	NextPrevStyle.LoadViewState (states [3]);

			if (states [4] != null)
				OtherMonthDayStyle.LoadViewState (states [4]);

			if (states [5] != null)
				SelectedDayStyle.LoadViewState (states [5]);

			if (states [6] != null)
			 	TitleStyle.LoadViewState (states [6]);

			if (states [7] != null)
				TodayDayStyle.LoadViewState (states [7]);

			if (states [8] != null)
				SelectorStyle.LoadViewState (states [8]);

			if (states [9] != null)
				WeekendDayStyle.LoadViewState (states [9]);

			ArrayList array = (ArrayList) ViewState ["SelectedDates"];
			if (array != null) {
				dateList = array;
				selectedDatesCollection = new SelectedDatesCollection (dateList);
			}
		}
예제 #6
0
파일: Calendar.cs 프로젝트: Tsalex71/mono-1
        protected override void LoadViewState(object savedState)
        {
            object [] states = (object [])savedState;

            if (states [0] != null)
            {
                base.LoadViewState(states [0]);
            }

            if (states [1] != null)
            {
                DayHeaderStyle.LoadViewState(states [1]);
            }

            if (states [2] != null)
            {
                DayStyle.LoadViewState(states [2]);
            }

            if (states [3] != null)
            {
                NextPrevStyle.LoadViewState(states [3]);
            }

            if (states [4] != null)
            {
                OtherMonthDayStyle.LoadViewState(states [4]);
            }

            if (states [5] != null)
            {
                SelectedDayStyle.LoadViewState(states [5]);
            }

            if (states [6] != null)
            {
                TitleStyle.LoadViewState(states [6]);
            }

            if (states [7] != null)
            {
                TodayDayStyle.LoadViewState(states [7]);
            }

            if (states [8] != null)
            {
                SelectorStyle.LoadViewState(states [8]);
            }

            if (states [9] != null)
            {
                WeekendDayStyle.LoadViewState(states [9]);
            }

            ArrayList array = (ArrayList)ViewState ["SelectedDates"];

            if (array != null)
            {
                dateList = array;
                selectedDatesCollection = new SelectedDatesCollection(dateList);
            }
        }
 protected override void LoadViewState(object savedState)
 {
     if (savedState != null)
     {
         object[] objArray = (object[]) savedState;
         if (objArray[0] != null)
         {
             base.LoadViewState(objArray[0]);
         }
         if (objArray[1] != null)
         {
             ((IStateManager) this.TitleStyle).LoadViewState(objArray[1]);
         }
         if (objArray[2] != null)
         {
             ((IStateManager) this.NextPrevStyle).LoadViewState(objArray[2]);
         }
         if (objArray[3] != null)
         {
             ((IStateManager) this.DayStyle).LoadViewState(objArray[3]);
         }
         if (objArray[4] != null)
         {
             ((IStateManager) this.DayHeaderStyle).LoadViewState(objArray[4]);
         }
         if (objArray[5] != null)
         {
             ((IStateManager) this.TodayDayStyle).LoadViewState(objArray[5]);
         }
         if (objArray[6] != null)
         {
             ((IStateManager) this.WeekendDayStyle).LoadViewState(objArray[6]);
         }
         if (objArray[7] != null)
         {
             ((IStateManager) this.OtherMonthDayStyle).LoadViewState(objArray[7]);
         }
         if (objArray[8] != null)
         {
             ((IStateManager) this.SelectedDayStyle).LoadViewState(objArray[8]);
         }
         if (objArray[9] != null)
         {
             ((IStateManager) this.SelectorStyle).LoadViewState(objArray[9]);
         }
         ArrayList list = (ArrayList) this.ViewState["SD"];
         if (list != null)
         {
             this.dateList = list;
             this.selectedDates = null;
         }
     }
 }
예제 #8
0
		public void SelectRangeMethod ()
		{
			ArrayList list = new ArrayList ();
			SelectedDatesCollection s = new SelectedDatesCollection (list);			
			
			s.Add (DateTime.Today);
			s.Add (DateTime.Today);
			// Internally clears the list
			s.SelectRange (new DateTime (2000, 1, 1), new DateTime (2001, 1, 1));

			Assert.AreEqual (367, s.Count, "A1");
		}
예제 #9
0
        /// <internalonly/>
        /// <devdoc>
        /// <para>Loads a saved state of the <see cref='System.Web.UI.WebControls.Calendar'/>. </para>
        /// </devdoc>
        protected override void LoadViewState(object savedState) {
            if (savedState != null) {
                object[] myState = (object[])savedState;

                if (myState[0] != null)
                    base.LoadViewState(myState[0]);
                if (myState[1] != null)
                    ((IStateManager)TitleStyle).LoadViewState(myState[1]);
                if (myState[2] != null)
                    ((IStateManager)NextPrevStyle).LoadViewState(myState[2]);
                if (myState[3] != null)
                    ((IStateManager)DayStyle).LoadViewState(myState[3]);
                if (myState[4] != null)
                    ((IStateManager)DayHeaderStyle).LoadViewState(myState[4]);
                if (myState[5] != null)
                    ((IStateManager)TodayDayStyle).LoadViewState(myState[5]);
                if (myState[6] != null)
                    ((IStateManager)WeekendDayStyle).LoadViewState(myState[6]);
                if (myState[7] != null)
                    ((IStateManager)OtherMonthDayStyle).LoadViewState(myState[7]);
                if (myState[8] != null)
                    ((IStateManager)SelectedDayStyle).LoadViewState(myState[8]);
                if (myState[9] != null)
                    ((IStateManager)SelectorStyle).LoadViewState(myState[9]);

                ArrayList selDates = (ArrayList)ViewState["SD"];
                if (selDates != null) {
                    dateList = selDates;
                    selectedDates = null;   // reset wrapper collection
                }

            }
        }