コード例 #1
0
        /// <summary>
        /// </summary>
        /// <exception cref="ArgumentNullException"><para><paramref name="value"/> is <see langword="null"/>.</para></exception>
        public void Move(NuGenDateItem value, int index)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            if (index < 0)
            {
                index = 0;
            }
            else if (index > this.Count)
            {
                index = this.Count;
            }

            if (!this.Contains(value) || this.IndexOf(value) == index)
            {
                return;
            }

            this.List.Remove(value);

            if (index > this.Count)
            {
                this.List.Add(value);
            }
            else
            {
                this.List.Insert(index, value);
            }
        }
コード例 #2
0
        /// <summary>
        /// </summary>
        /// <exception cref="ArgumentNullException"><para><paramref name="dateItem"/> is <see langword="null"/>.</para></exception>
        public bool Contains(NuGenDateItem dateItem)
        {
            if (dateItem == null)
            {
                throw new ArgumentNullException("dateItem");
            }

            return(this.IndexOf(dateItem) != -1);
        }
コード例 #3
0
        /// <summary>
        /// </summary>
        /// <exception cref="ArgumentNullException"><para><paramref name="value"/> is <see langword="null"/>.</para></exception>
        public void Remove(NuGenDateItem value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            this.List.Remove(value);
        }
コード例 #4
0
		/// <summary>
		/// </summary>
		/// <exception cref="ArgumentNullException"><para><paramref name="dateItems"/> is <see langword="null"/>.</para></exception>
		public void AddRange(NuGenDateItem[] dateItems)
		{
			if (dateItems == null)
				throw new ArgumentNullException("dateItems");

			for (int i = 0; i < dateItems.Length; i++)
			{
				dateItems[i].Calendar = _owner;
				this.Add(dateItems[i]);
			}
		}
コード例 #5
0
        /// <summary>
        /// </summary>
        public NuGenDateItem[] AddInfo(NuGenDateItem dt, NuGenDateItem[] old)
        {
            int l = old.Length;
            int i;

            NuGenDateItem[] n = new NuGenDateItem[l + 1];
            n.Initialize();
            for (i = 0; i < l; i++)
            {
                n[i] = old[i];
            }
            n[i] = dt;
            return(n);
        }
コード例 #6
0
		/// <summary>
		/// </summary>
		/// <exception cref="ArgumentNullException"><para><paramref name="value"/> is <see langword="null"/>.</para></exception>
		public void Add(NuGenDateItem value)
		{
			int index;
			if (value == null)
				throw new ArgumentNullException("value");

			if ((NuGenCalendar)value.Calendar == null)
				value.Calendar = _owner;

			index = this.IndexOf(value);
			if (index == -1)
				this.List.Add(value);
			else
				this.List[index] = value;
		}
コード例 #7
0
        /// <summary>
        /// </summary>
        /// <exception cref="ArgumentNullException"><para><paramref name="dateItem"/> is <see langword="null"/>.</para></exception>
        public int IndexOf(NuGenDateItem dateItem)
        {
            if (dateItem == null)
            {
                throw new ArgumentNullException("dateItem");
            }

            for (int i = 0; i < this.Count; i++)
            {
                if (this[i] == dateItem)
                {
                    return(i);
                }
            }

            return(-1);
        }
コード例 #8
0
        /// <summary>
        /// </summary>
        /// <exception cref="ArgumentNullException"><para><paramref name="value"/> is <see langword="null"/>.</para></exception>
        public void Add(NuGenDateItem value)
        {
            int index;

            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            if ((NuGenCalendar)value.Calendar == null)
            {
                value.Calendar = _owner;
            }

            index = this.IndexOf(value);
            if (index == -1)
            {
                this.List.Add(value);
            }
            else
            {
                this.List[index] = value;
            }
        }
コード例 #9
0
        /// <summary>
        /// </summary>
        public NuGenDateItem[] DateInfo(DateTime dt)
        {
            NuGenDateItem[] ret = new NuGenDateItem[0];
            ret.Initialize();
            for (int i = 0; i < this.Count; i++)
            {
                if (((this[i].Date <= dt) && (this[i].Range >= dt)))
                {
                    switch (this[i].Pattern)
                    {
                    case NuGenRecurrence.None:
                    {
                        if (this[i].Date.ToShortDateString() == dt.ToShortDateString())
                        {
                            this[i].Index = i;
                            ret           = AddInfo(this[i], ret);
                        }
                        break;
                    }

                    case NuGenRecurrence.Daily:
                    {
                        this[i].Index = i;
                        ret           = AddInfo(this[i], ret);
                        break;
                    }

                    case NuGenRecurrence.Weekly:
                    {
                        if ((this[i].Date.DayOfWeek == dt.DayOfWeek))
                        {
                            this[i].Index = i;
                            ret           = AddInfo(this[i], ret);
                        }
                        break;
                    }

                    case NuGenRecurrence.Monthly:
                    {
                        if ((this[i].Date.Day == dt.Day))
                        {
                            this[i].Index = i;
                            ret           = AddInfo(this[i], ret);
                        }
                        break;
                    }

                    case NuGenRecurrence.Yearly:
                    {
                        if (this[i].Date.ToShortDateString().Substring(5) ==
                            dt.ToShortDateString().Substring(5))
                        {
                            this[i].Index = i;
                            ret           = AddInfo(this[i], ret);
                        }
                        break;
                    }
                    }
                }
            }
            return(ret);
        }
コード例 #10
0
		/// <summary>
		/// </summary>
		public NuGenDateItem[] AddInfo(NuGenDateItem dt, NuGenDateItem[] old)
		{
			int l = old.Length;
			int i;
			NuGenDateItem[] n = new NuGenDateItem[l + 1];
			n.Initialize();
			for (i = 0; i < l; i++)
			{
				n[i] = old[i];
			}
			n[i] = dt;
			return n;
		}
コード例 #11
0
		/// <summary>
		/// </summary>
		public NuGenDateItem[] GetDateInfo()
		{
			NuGenDateItem[] ret = new NuGenDateItem[0];
			ret.Initialize();
			for (int i = 0; i < Dates.Count; i++)
			{
				ret = Dates.AddInfo(Dates[i], ret);
			}
			return ret;
		}
コード例 #12
0
		/// <summary>
		/// </summary>
		public void AddDateInfo(NuGenDateItem info)
		{
			Dates.Add(info);
			Invalidate();
		}
コード例 #13
0
		/// <summary>
		/// </summary>
		public NuGenDateItem[] DateInfo(DateTime dt)
		{
			NuGenDateItem[] ret = new NuGenDateItem[0];
			ret.Initialize();
			for (int i = 0; i < this.Count; i++)
			{
				if (((this[i].Date <= dt) && (this[i].Range >= dt)))
				{
					switch (this[i].Pattern)
					{
						case NuGenRecurrence.None:
						{
							if (this[i].Date.ToShortDateString() == dt.ToShortDateString())
							{
								this[i].Index = i;
								ret = AddInfo(this[i], ret);
							}
							break;
						}

						case NuGenRecurrence.Daily:
						{
							this[i].Index = i;
							ret = AddInfo(this[i], ret);
							break;
						}
						case NuGenRecurrence.Weekly:
						{
							if ((this[i].Date.DayOfWeek == dt.DayOfWeek))
							{
								this[i].Index = i;
								ret = AddInfo(this[i], ret);
							}
							break;
						}
						case NuGenRecurrence.Monthly:
						{
							if ((this[i].Date.Day == dt.Day))
							{
								this[i].Index = i;
								ret = AddInfo(this[i], ret);
							}
							break;
						}
						case NuGenRecurrence.Yearly:
						{
							if (this[i].Date.ToShortDateString().Substring(5) ==
								dt.ToShortDateString().Substring(5))
							{
								this[i].Index = i;
								ret = AddInfo(this[i], ret);
							}
							break;
						}
					}

				}
			}
			return ret;
		}
コード例 #14
0
 /// <summary>
 /// </summary>
 public void MoveToBottom(NuGenDateItem value)
 {
     this.Move(value, this.Count);
 }
コード例 #15
0
		/// <summary>
		/// </summary>
		/// <exception cref="ArgumentNullException"><para><paramref name="dateItem"/> is <see langword="null"/>.</para></exception>
		public int IndexOf(NuGenDateItem dateItem)
		{
			if (dateItem == null)
				throw new ArgumentNullException("dateItem");

			for (int i = 0; i < this.Count; i++)
			{
				if (this[i] == dateItem)
				{
					return i;
				}
			}

			return -1;
		}
コード例 #16
0
		/// <summary>
		/// </summary>
		public void MoveToBottom(NuGenDateItem value)
		{
			this.Move(value, this.Count);
		}
コード例 #17
0
		/// <summary>
		/// </summary>
		public void MoveToTop(NuGenDateItem value)
		{
			this.Move(value, 0);
		}
コード例 #18
0
		/// <summary>
		/// </summary>
		/// <exception cref="ArgumentNullException"><para><paramref name="value"/> is <see langword="null"/>.</para></exception>
		public void Move(NuGenDateItem value, int index)
		{
			if (value == null)
				throw new ArgumentNullException("value");

			if (index < 0)
			{
				index = 0;
			}
			else if (index > this.Count)
			{
				index = this.Count;
			}

			if (!this.Contains(value) || this.IndexOf(value) == index)
			{
				return;
			}

			this.List.Remove(value);

			if (index > this.Count)
			{
				this.List.Add(value);
			}
			else
			{
				this.List.Insert(index, value);
			}

		}
コード例 #19
0
		/// <summary>
		/// </summary>
		/// <exception cref="ArgumentNullException"><para><paramref name="value"/> is <see langword="null"/>.</para></exception>
		public void Remove(NuGenDateItem value)
		{
			if (value == null)
				throw new ArgumentNullException("value");

			this.List.Remove(value);

		}
コード例 #20
0
 /// <summary>
 /// </summary>
 public void MoveToTop(NuGenDateItem value)
 {
     this.Move(value, 0);
 }
コード例 #21
0
		/// <summary>
		/// </summary>
		public void AddDateInfo(NuGenDateItem[] info)
		{
			for (int i = 0; i < info.Length; i++)
			{
				if (info[i] != null)
					Dates.Add(info[i]);
			}
			Invalidate();
		}
コード例 #22
0
		/// <summary>
		/// </summary>
		public void RemoveDateInfo(NuGenDateItem info)
		{
			Dates.Remove(info);
		}
コード例 #23
0
		/// <summary>
		/// </summary>
		/// <exception cref="ArgumentNullException"><para><paramref name="dateItem"/> is <see langword="null"/>.</para></exception>
		public bool Contains(NuGenDateItem dateItem)
		{
			if (dateItem == null)
				throw new ArgumentNullException("dateItem");

			return (this.IndexOf(dateItem) != -1);
		}