Example #1
0
        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="post"></param>
        //public void AddNewPost(MessagePost post)
        //{
        //	#region Validate parameters
        //	if ( post == null )
        //		throw new ArgumentNullException("post");
        //	#endregion

        //	if ( post.LINK != 0 )
        //		throw new ArgumentException("Посылка должна иметь LINK равный 0.");

        //	post.MessageLINK = this.LINK;

        //	lock ( this.posts )
        //	{
        //		this.posts.Add(post);
        //	}
        //}

        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="virtAddress"></param>
        ///// <returns></returns>
        //public MessagePost FindPost(string virtAddress)
        //{
        //	lock ( this.posts )
        //	{
        //		return this.posts.SingleOrDefault(p => p.Address.Equals(virtAddress, StringComparison.InvariantCultureIgnoreCase));
        //	}
        //}

        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="virtAddress"></param>
        ///// <exception cref="MessagePostNotFoundException"></exception>
        ///// <returns></returns>
        //public MessagePost GetPost(string virtAddress)
        //{
        //	lock ( this.posts )
        //	{
        //		MessagePost post = this.posts.SingleOrDefault(p => p.Address.Equals(virtAddress, StringComparison.InvariantCultureIgnoreCase));
        //		if ( post == null )
        //			throw new MessagePostNotFoundException(String.Format("Посылка сообщения с адресом \"{0}\" не найдена.", virtAddress));

        //		return post;
        //	}
        //}

        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="postLink"></param>
        ///// <returns></returns>
        //public MessagePost FindPost(int postLink)
        //{
        //	lock ( this.posts )
        //	{
        //		return this.posts.SingleOrDefault(p => p.LINK == postLink);
        //	}
        //}

        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="postLink"></param>
        ///// <exception cref="MessagePostNotFoundException"></exception>
        ///// <returns></returns>
        //public MessagePost GetPost(int postLink)
        //{
        //	lock ( this.posts )
        //	{
        //		MessagePost post = this.posts.SingleOrDefault(p => p.LINK == postLink);
        //		if ( post == null )
        //			throw new MessagePostNotFoundException(String.Format("Посылка сообщения #{0} не найдена.", postLink));

        //		return post;
        //	}
        //}

        ///// <summary>
        /////
        ///// </summary>
        //public void ClearPosts()
        //{
        //	lock ( this.posts )
        //	{
        //		this.posts.Clear();
        //	}
        //}

        /// <summary>
        /// Установить статус.
        /// </summary>
        /// <param name="status"></param>
        public void SetStatus(MessageStatus status)
        {
            #region Validate parameters
            if (status == null)
            {
                throw new ArgumentNullException("status");
            }
            #endregion

            this.PrevStatus = this.Status;
            this.Status     = status;
        }
Example #2
0
        /// <summary>
        /// Установить статус.
        /// </summary>
        /// <param name="status"></param>
        public void SetStatus(string status)
        {
            var newStatus = new MessageStatus()
            {
                Value = status,
                Date  = DateTime.Now,
                Info  = null,
                Code  = null
            };

            SetStatus(newStatus);
        }
        /// <summary>
        /// Сравнение по Value.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            //if ( base.Equals(obj) )
            //   return true;

            MessageStatus status = (MessageStatus)obj;

            return((this.Value ?? "").Equals((status.Value ?? ""), StringComparison.InvariantCultureIgnoreCase));
        }