Beispiel #1
0
        public BaseKey Build(List <string> newStr, BaseKey last, BaseKey per)
        {
            if (this.DateTime.Equals(default(DateTime)))
            {
                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < newStr.Count; i++)
                {
                    sb.Append(newStr[i] + " ");
                }

                this.DateTime = DatesKeyService.Instance.GetDateTime(sb.ToString());

                return(this);
            }
            else
            {
                if (this.ParentKey == null)
                {
                    return(null);
                }

                //   兼容格式
                //   DATES
                //   31 'DEC' 2015/
                //   31 'DEC' 2016/

                DATES newDates = new DATES("DATES");

                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < newStr.Count; i++)
                {
                    sb.Append(newStr[i] + " ");
                }

                newDates.DateTime = DatesKeyService.Instance.GetDateTime(sb.ToString());

                this.ParentKey.Add(newDates);

                //  上一节点指向新建的时间节点
                return(newDates);
            }
        }
Beispiel #2
0
        /// <summary> 重启时间比较方法 </summary>
        public int CompareTo(object obj)
        {
            DATES pdate = obj as DATES;

            if (pdate == null)
            {
                return(-1);
            }
            else
            {
                if (pdate.DateTime.Date > this.DateTime.Date)
                {
                    return(1);
                }
                else if (pdate.DateTime.Date.Equals(this.DateTime.Date))
                {
                    return(0);
                }
                else
                {
                    return(-1);
                }
            }
        }