Files
sryang 577060bc78 chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore
- 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
2026-09-10 09:42:37 +08:00

71 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace Education.Forms.Common
{
public partial class 起訖日顯示 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
[Bindable(true)]
public Object 起日
{
get;
set;
}
[Bindable(true)]
public Object 迄日
{
get;
set;
}
[Bindable(true)]
[DefaultValue("yyyy-MM-dd")]
public string Format
{
get;
set;
}
public override void DataBind()
{
base.DataBind();
if (DesignMode)
return;
DateTime dt起日 = WebLib.DAC.GetDateTime(起日);
DateTime dt迄日 = WebLib.DAC.GetDateTime(迄日);
if (dt起日.Ticks > 0)
{
lb起日.Text = dt起日.ToString(Format);
}
else
{
lb起日.Text = "";
}
if (dt迄日.Ticks > 0 && dt起日.CompareTo(dt迄日) != 0)
{
lb至.Text = "至";
lb迄日.Text = dt迄日.ToString(Format);
}
else
{
lb至.Text = "";
lb迄日.Text = "";
}
}
}
}