亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? smartdate.cs

?? C# 版本的一個三層商業架構
?? CS
字號:
using System;
using CSLA.Resources;

namespace CSLA
{
  /// <summary>
  /// Provides a date data type that understands the concept
  /// of an empty date value.
  /// </summary>
  /// <remarks>
  /// See Chapter 5 for a full discussion of the need for this
  /// data type and the design choices behind it.
  /// </remarks>
  [Serializable()]
  sealed public class SmartDate : IComparable
  {
    DateTime _date;
    bool _emptyIsMin;

    #region Constructors

    /// <summary>
    /// Creates a new SmartDate object.
    /// </summary>
    public SmartDate()
    {
      _emptyIsMin = false;
      _date = DateTime.MaxValue;
    }

    /// <summary>
    /// Creates a new SmartDate object.
    /// </summary>
    /// <param name="emptyIsMin">
    /// Indicates whether an empty date is the min or max date value.</param>
    public SmartDate(bool emptyIsMin)
    {
      _emptyIsMin = emptyIsMin;
      if(_emptyIsMin)
        _date = DateTime.MinValue;
      else
        _date = DateTime.MaxValue;
    }

    /// <summary>
    /// Creates a new SmartDate object.
    /// </summary>
    /// <remarks>
    /// An empty date will be treated as the smallest
    /// possible date.
    /// </remarks>
    /// <param name="date">The initial value of the object.</param>
    public SmartDate(DateTime date)
    {
      _emptyIsMin = false;
      _date = date;
    }

    /// <summary>
    /// Creates a new SmartDate object.
    /// </summary>
    /// <remarks>
    /// An empty date will be treated as the smallest
    /// possible date.
    /// </remarks>
    /// <param name="date">The initial value of the object.</param>
    public SmartDate(string date)
    {
      _emptyIsMin = false;
      Text = date;
    }

    /// <summary>
    /// Creates a new SmartDate object.
    /// </summary>
    /// <param name="date">The initial value of the object.</param>
    /// <param name="emptyIsMin">
    /// Indicates whether an empty date is the min or max date value.</param>
    public SmartDate(DateTime date, bool emptyIsMin)
    {
      _emptyIsMin = emptyIsMin;
      _date = date;
    }

    /// <summary>
    /// Creates a new SmartDate object.
    /// </summary>
    /// <param name="date">The initial value of the object (as text).</param>
    /// <param name="emptyIsMin">
    /// Indicates whether an empty date is the min or max date value.</param>
    public SmartDate(string date, bool emptyIsMin)
    {
      _emptyIsMin = emptyIsMin;
      this.Text = date;
    }

    #endregion

    #region Text Support

    string _format = "{0:d}";

    /// <summary>
    /// Gets or sets the format string used to format a date
    /// value when it is returned as text.
    /// </summary>
    /// <remarks>
    /// The format string should follow the requirements for 
    /// standard .NET string formatting statements.
    /// </remarks>
    /// <value>A format string.</value>
    public string FormatString
    {
      get
      {
        return _format;
      }
      set
      {
        _format = value;
      }
    }

    /// <summary>
    /// Gets or sets the date value.
    /// </summary>
    /// <remarks>
    /// <para>
    /// This property can be used to set the date value by passing a
    /// text representation of the date. Any text date representation
    /// that can be parsed by the .NET runtime is valid.
    /// </para><para>
    /// When the date value is retrieved via this property, the text
    /// is formatted by using the format specified by the 
    /// <see cref="P:CSLA.SmartDate.FormatString" /> property. The 
    /// default is the "d", or short date, format.
    /// </para>
    /// </remarks>
    /// <returns></returns>
    public string Text
    {
      get
      {
        return DateToString(_date, _format, _emptyIsMin);
      }
      set
      {
        if(value == null)
          _date = StringToDate(string.Empty, _emptyIsMin);
        else
          _date = StringToDate(value, _emptyIsMin);
      }
    }

    /// <summary>
    /// Returns a text representation of the date value.
    /// </summary>
    public override string ToString()
    {
      return this.Text;
    }

    #endregion

    #region Date Support

    /// <summary>
    /// Gets or sets the date value.
    /// </summary>
    public DateTime Date
    {
      get
      {
        return _date;
      }
      set
      {
        _date = value;
      }
    }

    #endregion

    #region DBValue

    /// <summary>
    /// Gets a database-friendly version of the date value.
    /// </summary>
    /// <remarks>
    /// <para>
    /// If the SmartDate contains an empty date, this returns DBNull. Otherwise
    /// the actual date value is returned as type Date.
    /// </para><para>
    /// This property is very useful when setting parameter values for
    /// a Command object, since it automatically stores null values into
    /// the database for empty date values.
    /// </para><para>
    /// When you also use the SafeDataReader and its GetSmartDate method,
    /// you can easily read a null value from the database back into a
    /// SmartDate object so it remains considered as an empty date value.
    /// </para>
    /// </remarks>
    public object DBValue
    {
      get
      {
        if(this.IsEmpty)
          return DBNull.Value;
        else
          return _date;
      }
    }

    #endregion

    #region Empty Dates

    /// <summary>
    /// Indicates whether this object contains an empty date.
    /// </summary>
    /// <returns>True if the date is empty.</returns>
    public bool IsEmpty
    {
      get
      {
        if(_emptyIsMin)
          return _date.Equals(DateTime.MinValue);
        else
          return _date.Equals(DateTime.MaxValue);
      }
    }

    /// <summary>
    /// Indicates whether an empty date is the min or max possible date value.
    /// </summary>
    /// <remarks>
    /// Whether an empty date is considered to be the smallest or largest possible
    /// date is only important for comparison operations. This allows you to
    /// compare an empty date with a real date and get a meaningful result.
    /// </remarks>
    /// <returns>True if an empty date is the smallest 
    /// date, False if it is the largest.</returns>
    public bool EmptyIsMin
    {
      get
      {
        return _emptyIsMin;
      }
    }

    #endregion

    #region Conversion Functions

    /// <summary>
    /// Converts a text date representation into a Date value.
    /// </summary>
    /// <remarks>
    /// An empty string is assumed to represent an empty date. An empty date
    /// is returned as the MinValue.
    /// </remarks>
    /// <param name="date">The text representation of the date.</param>
    /// <returns>A Date value.</returns>
    static public DateTime StringToDate(string date)
    {
      return StringToDate(date, true);
    }

    /// <summary>
    /// Converts a text date representation into a Date value.
    /// </summary>
    /// <remarks>
    /// An empty string is assumed to represent an empty date. An empty date
    /// is returned as the MinValue or MaxValue of the Date datatype depending
    /// on the EmptyIsMin parameter.
    /// </remarks>
    /// <param name="date">The text representation of the date.</param>
    /// <param name="emptyIsMin">
    /// Indicates whether an empty date is the min or max date value.</param>
    /// <returns>A Date value.</returns>
    static public DateTime StringToDate(string date, bool emptyIsMin)
    {
      if(date.Length == 0)
      {
        if(emptyIsMin)
          return DateTime.MinValue;
        else
          return DateTime.MaxValue;
      }                                                                                          
      else
      {
        string ldate = date.ToLower();
        if(ldate==Strings.GetResourceString("SmartDateToday") ||
          ldate==Strings.GetResourceString("SmartDateT") ||
          ldate==".")
          return DateTime.Now;
        else
        {
          if(ldate==Strings.GetResourceString("SmartDateYesterday") ||
            ldate==Strings.GetResourceString("SmartDateY") ||
            ldate=="-")
          {
            return DateTime.Now.AddDays(-1);
          }
          else
          {
            if(ldate==Strings.GetResourceString("SmartDateTomorrow") ||
              ldate==Strings.GetResourceString("SmartDateTom") ||
              ldate=="+")
            {
              return DateTime.Now.AddDays(1);
            }
            else
            {
              return DateTime.Parse(date);
            }
          }
        }
      }
    }

    /// <summary>
    /// Converts a date value into a text representation.
    /// </summary>
    /// <remarks>
    /// The date value is considered empty assuming EmptyIsMin is true. 
    /// If the date is empty, this
    /// method returns an empty string. Otherwise it returns the date
    /// value formatted based on the FormatString parameter.
    /// </remarks>
    /// <param name="date">The date value to convert.</param>
    /// <param name="formatString">The format string used to format the date into text.</param>
    /// <returns>Text representation of the date value.</returns>
    static public string DateToString(DateTime date, string formatString)
    {
      return DateToString(date, formatString, true);
    }

    /// <summary>
    /// Converts a date value into a text representation.
    /// </summary>
    /// <remarks>
    /// Whether the date value is considered empty is determined by
    /// the EmptyIsMin parameter value. If the date is empty, this
    /// method returns an empty string. Otherwise it returns the date
    /// value formatted based on the FormatString parameter.
    /// </remarks>
    /// <param name="date">The date value to convert.</param>
    /// <param name="formatString">The format string used to format the date into text.</param>
    /// <param name="emptyIsMin">
    /// Indicates whether an empty date is the min or max date value.</param>
    /// <returns>Text representation of the date value.</returns>
    static public string DateToString(DateTime date, string formatString, 
                                      bool emptyIsMin)
    {
      if(emptyIsMin && (date == DateTime.MinValue))
        return string.Empty;
      else
        if(!emptyIsMin && (date == DateTime.MaxValue))
        return string.Empty;
      else
        return string.Format(formatString, date);
    }

    #endregion

    #region Operators

    static public bool operator > (SmartDate date1, SmartDate date2)
    {
      return date1.Date > date2.Date;
    }

    static public bool operator > (SmartDate date1, DateTime date2)
    {
      return date1.Date > date2;
    }

    static public bool operator < (SmartDate date1, SmartDate date2)
    {
      return date1.Date < date2.Date;
    }

    static public bool operator < (SmartDate date1, DateTime date2)
    {
      return date1.Date < date2;
    }

    static public bool operator == (SmartDate date1, SmartDate date2)
    {
      return Equals(date1, date2);
    }

    static public bool operator == (SmartDate date1, DateTime date2)
    {
      return Equals(date1, date2);
    }

    static public bool operator != (SmartDate date1, SmartDate date2)
    {
      return !Equals(date1, date2);
    }

    static public bool operator != (SmartDate date1, DateTime date2)
    {
      return !Equals(date1, date2);
    }

    static public SmartDate operator + (SmartDate d, TimeSpan t)
    {
      if (d.IsEmpty)
        return d;
      else
        return new SmartDate(d.Date + t, d.EmptyIsMin);
    }

    static public SmartDate operator - (SmartDate d, TimeSpan t)
    {
      if (d.IsEmpty)
        return d;
      else
        return new SmartDate(d.Date - t, d.EmptyIsMin);
    }

    public override bool Equals(object o)
    {
      if (o is SmartDate)
      {
        SmartDate tmp = o as SmartDate;
        if (this.IsEmpty && tmp.IsEmpty)
          return true;
        else
          return _date.Equals(((SmartDate)o).Date);
      }
      else if(o is DateTime)
        return _date.Equals((DateTime)o);
      else
        return false;
    }

    public override int GetHashCode()
    {
      return _date.GetHashCode ();
    }
    
    #endregion

    #region Manipulation Functions

    /// <summary>
    /// Compares one SmartDate to another.
    /// </summary>
    /// <remarks>
    /// This method works the same as the CompareTo method
    /// on the Date datetype, with the exception that it
    /// understands the concept of empty date values.
    /// </remarks>
    /// <param name="Value">The date to which we are being compared.</param>
    /// <returns>
    /// A value indicating if the comparison date is less than, 
    /// equal to or greater than this date.</returns>
    public int CompareTo(SmartDate date)
    {
      if(this.IsEmpty && date.IsEmpty)
        return 0;
      else
        return _date.CompareTo(date.Date);
    }

    int IComparable.CompareTo(object value)
    {
      if(value is SmartDate)
        return CompareTo((SmartDate)value);
      else
        throw new ArgumentException(Strings.GetResourceString("ValueNotSmartDateException"));
    }

    /// <summary>
    /// Adds a TimeSpan onto the object.
    /// </summary>
    public DateTime Add(TimeSpan span)
    {
      if (IsEmpty)
        return _date;
      else
        return  _date.Add(span);
    }

    /// <summary>
    /// Subtracts a TimeSpan from the object.
    /// </summary>
    public DateTime Subtract(TimeSpan span)
    {
      if (IsEmpty)
        return _date;
      else
        return  _date.Subtract(span);
    }

    /// <summary>
    /// Subtracts a DateTime from the object.
    /// </summary>
    public TimeSpan Subtract(DateTime date)
    {
      if (IsEmpty)
        return TimeSpan.Zero;
      else
        return _date.Subtract(date);
    }

    #endregion
  }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕一区二区三区色视频| 亚洲精品一区二区三区精华液| 在线欧美日韩国产| 欧美午夜精品久久久| 日韩女优视频免费观看| 欧美激情中文字幕一区二区| 亚洲品质自拍视频| 亚洲综合一二区| 精品一区二区三区香蕉蜜桃| 成人性生交大片免费看在线播放| 欧美主播一区二区三区美女| 日韩欧美在线1卡| 国产精品久久久久久久浪潮网站| 亚洲人快播电影网| 亚洲gay无套男同| 国产成人丝袜美腿| 欧美日韩国产欧美日美国产精品| 精品国产一区二区三区不卡| 亚洲一二三专区| 99久久er热在这里只有精品15 | 欧美本精品男人aⅴ天堂| 一区二区三区四区不卡在线 | 精品视频在线免费| 亚洲激情综合网| 色丁香久综合在线久综合在线观看| 久久精品日产第一区二区三区高清版| 日日摸夜夜添夜夜添国产精品| 91官网在线观看| 一区二区三区日韩精品视频| 色婷婷av一区| 亚洲最大成人综合| 欧美日韩精品一区二区三区四区| 亚洲日本在线天堂| 91啪在线观看| 亚洲一区二区中文在线| 欧美三级三级三级| 日韩电影在线观看电影| 日韩欧美成人激情| 国产精品2024| 国产精品美女一区二区三区| 国产成人精品一区二区三区四区 | 亚洲国产另类av| 欧美精三区欧美精三区| 午夜精品影院在线观看| 欧美福利电影网| 六月丁香综合在线视频| 久久综合九色综合欧美98| 国产一区二区三区国产| 国产精品日产欧美久久久久| 97精品久久久久中文字幕 | 欧美三级中文字| 免费人成黄页网站在线一区二区| 欧美不卡一区二区| 国产成人精品影视| 亚洲欧美日韩久久| 欧美日韩高清影院| 国产一区999| 亚洲你懂的在线视频| 欧美色欧美亚洲另类二区| 久久99久久99小草精品免视看| 久久色成人在线| 一本色道久久综合亚洲aⅴ蜜桃 | 成人深夜在线观看| 一区二区三区在线影院| 7777精品伊人久久久大香线蕉完整版| 久久成人羞羞网站| 1区2区3区精品视频| 欧美日韩精品一区二区三区| 久久91精品国产91久久小草| 国产精品久久综合| 51精品国自产在线| 99久久er热在这里只有精品66| 视频一区二区中文字幕| 国产午夜精品一区二区三区视频 | 成人国产视频在线观看| 亚洲伊人伊色伊影伊综合网| 2020国产精品自拍| 欧美性受xxxx| 成人爱爱电影网址| 日韩中文欧美在线| 亚洲欧洲精品成人久久奇米网| 欧美精品在线视频| www.欧美日韩| 狠狠狠色丁香婷婷综合久久五月| 亚洲激情在线激情| 中文欧美字幕免费| 日韩欧美不卡一区| 欧美日韩久久一区二区| 不卡av在线免费观看| 麻豆精品国产传媒mv男同 | 免费成人在线视频观看| 亚洲免费av网站| 欧美国产欧美综合| 日韩三级高清在线| 欧美色爱综合网| 色综合天天做天天爱| 高清在线不卡av| 国产一区二区三区香蕉| 蜜臀va亚洲va欧美va天堂| 亚洲一区二区免费视频| 亚洲激情网站免费观看| 国产精品人成在线观看免费| 日韩欧美国产一区在线观看| 在线不卡一区二区| 欧美精品乱码久久久久久| 在线免费观看一区| 成人动漫在线一区| 成人精品免费看| 经典三级在线一区| 久久99精品国产.久久久久| 天天综合日日夜夜精品| 亚洲成av人影院| 亚洲在线一区二区三区| 亚洲线精品一区二区三区| 亚洲毛片av在线| 亚洲国产日韩精品| 天堂va蜜桃一区二区三区| 亚洲小少妇裸体bbw| 亚洲午夜精品网| 亚洲成av人片一区二区三区| 亚洲国产美女搞黄色| 偷拍一区二区三区| 日本麻豆一区二区三区视频| 日韩国产在线观看| 精品一区二区三区在线观看国产| 国产一区美女在线| 成人美女在线视频| 99久久伊人精品| 欧美网站大全在线观看| 8x福利精品第一导航| 亚洲精品在线观看网站| 国产日产亚洲精品系列| 中文字幕欧美一区| 亚洲一区二区精品视频| 麻豆成人久久精品二区三区小说| 国产麻豆91精品| av午夜一区麻豆| 欧美日韩国产美女| 久久先锋影音av| 亚洲精品自拍动漫在线| 日本一区中文字幕| 夫妻av一区二区| 在线观看日产精品| 欧美一级午夜免费电影| 欧美激情综合网| 亚欧色一区w666天堂| 美女一区二区久久| av在线播放一区二区三区| 欧美亚洲动漫制服丝袜| 精品国产成人在线影院 | 五月婷婷综合激情| 国产麻豆精品theporn| 91豆麻精品91久久久久久| 日韩欧美不卡一区| 亚洲日本在线看| 韩国av一区二区三区在线观看| 不卡视频免费播放| 日韩精品在线看片z| 亚洲人成7777| 国产伦精品一区二区三区免费| 色综合色狠狠天天综合色| 欧美刺激脚交jootjob| 亚洲精品久久7777| 成人小视频在线观看| 在线播放国产精品二区一二区四区 | 欧美草草影院在线视频| 亚洲精品v日韩精品| 国产在线精品免费av| 欧美丰满高潮xxxx喷水动漫| 国产精品国产自产拍在线| 免费观看30秒视频久久| 欧洲在线/亚洲| 中文字幕第一页久久| 秋霞影院一区二区| 在线观看日韩av先锋影音电影院| 日本一区二区三区视频视频| 日本aⅴ免费视频一区二区三区| 91亚洲精品久久久蜜桃| 久久一夜天堂av一区二区三区 | 制服丝袜一区二区三区| 亚洲精品视频在线| 成人h动漫精品| 久久精品日产第一区二区三区高清版| 日韩二区三区四区| 欧美日韩精品一区二区天天拍小说| 中文字幕在线不卡一区 | 精品无码三级在线观看视频| 欧美日高清视频| 亚洲午夜久久久| 欧美性生活影院| 夜夜亚洲天天久久| 91精品1区2区| 亚洲综合小说图片| 欧美亚洲综合色| 亚洲图片有声小说| 欧美视频一区在线观看| 亚洲最色的网站| 欧美日韩精品一区二区三区蜜桃| 一区二区三区中文字幕精品精品| av中文字幕亚洲|