chore: 首次簽入 Thinkyu ASP.NET 專案

- 加入 Visual Studio / ASP.NET .gitignore
- 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
2026-09-10 09:42:37 +08:00
commit 577060bc78
2496 changed files with 501389 additions and 0 deletions
+155
View File
@@ -0,0 +1,155 @@
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Wellan.Common;
public partial class forms_basedata_fmBhrd : Wellan.Web.UI.WUserControlBase
{
private string[] holidayData = null;
protected void Page_Load(object sender, EventArgs e)
{
if (txtYear.Text == "")
{
txtYear.Text = DateTime.UtcNow.AddHours(8).ToString("yyyy");
ddlMonth.SelectedValue = DateTime.UtcNow.AddHours(8).ToString("MM");
Calendar1.VisibleDate = DateTime.UtcNow.AddHours(8).Date;
StoreYYMM();
}
}
private void StoreYYMM()
{
hfYear.Value = Calendar1.VisibleDate.ToString("yyyy", WGuard1.InvariantCulture);
hfMonth.Value = Calendar1.VisibleDate.ToString("MM");
}
protected void Calendar1_PreRender(object sender, EventArgs e)
{
// 取得節假日資料
holidayData = new BhrdDAC().GetYear(Calendar1.VisibleDate.Year);
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
e.Cell.Style["padding"] = "3px";
e.Cell.Style["border"] = "2px solid white";
// 非本月,結束處理
if (e.Day.IsOtherMonth)
return;
// 本月,清除重畫
e.Cell.Controls.Clear();
Label aLabel = new Label();
aLabel.Text = e.Day.Date.Day.ToString();
aLabel.Font.Name = "Tahoma";
aLabel.Font.Size = new FontUnit("16pt");
aLabel.Font.Bold = true;
aLabel.ForeColor = System.Drawing.Color.Black;
e.Cell.Controls.Add(aLabel);
// 加入換行的 Literal
Literal aBR = new Literal();
aBR.Text = "<br/>";
e.Cell.Controls.Add(aBR);
//加入 DropDownList 用以挑選假日型態
DropDownList aDDL = new DropDownList();
aDDL.ID = String.Format("HolidayType{0:00}", e.Day.Date.Day);
aDDL.Style.Add("width", "95%");
// aDDL.Style.Add("position", "relative");
aDDL.Style.Add("top", "2px");
aDDL.Style.Add("font-size", "9pt");
aDDL.Items.Add(new ListItem("上班", "-"));
aDDL.Items.Add(new ListItem("補班", "B"));
aDDL.Items.Add(new ListItem("國定/民俗", "N"));
aDDL.Items.Add(new ListItem("例假日", "H"));
aDDL.Items.Add(new ListItem("彈性休假", "V"));
aDDL.Items.Add(new ListItem("補假", "O"));
aDDL.Items.Add(new ListItem("颱風假", "T"));
aDDL.Items.Add(new ListItem("選舉假", "E"));
aDDL.Items.Add(new ListItem("公司活動", "A"));
//if (Request["HolidayType01"] == null || holidayData == null)
if (holidayData == null)
{
if (e.Day.IsWeekend)
aDDL.SelectedValue = "H";
else
aDDL.SelectedValue = "-";
}
else
{
aDDL.SelectedValue = holidayData[e.Day.Date.Month - 1].Substring(e.Day.Date.Day - 1, 1);
}
switch (aDDL.SelectedValue)
{
case "-":
e.Cell.BackColor = System.Drawing.Color.White;
break;
case "H":
e.Cell.BackColor = System.Drawing.Color.FromArgb(0xFF99CC);
break;
case "B":
e.Cell.BackColor = System.Drawing.Color.FromArgb(0xFFFF99);
break;
case "N":
e.Cell.BackColor = System.Drawing.Color.FromArgb(0x0099FF);
break;
case "V":
e.Cell.BackColor = System.Drawing.Color.FromArgb(0xFF9900);
break;
case "O":
e.Cell.BackColor = System.Drawing.Color.FromArgb(0x99CC00);
break;
case "T":
e.Cell.BackColor = System.Drawing.Color.FromArgb(0x999999);
break;
case "E":
e.Cell.BackColor = System.Drawing.Color.FromArgb(0xCC7FFF);
break;
case "A":
e.Cell.BackColor = System.Drawing.Color.FromArgb(0x7FCCFF);
break;
}
e.Cell.Controls.Add(aDDL);
}
protected void btnSave_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
for (int i = 1; i <= 31; i++)
{
sb.Append(Request[String.Format("HolidayType{0:00}", i)]);
}
BhrdDAC bhrd = new BhrdDAC();
bhrd.SetMonth(Convert.ToInt32(hfYear.Value), Convert.ToInt32(hfMonth.Value), sb.ToString());
Calendar1.VisibleDate = Convert.ToDateTime(hfYear.Value + "/" + hfMonth.Value + "/01", WGuard1.InvariantCulture);
}
protected void btnGoto_Click(object sender, EventArgs e)
{
Calendar1.VisibleDate = Convert.ToDateTime(txtYear.Text + "/" + ddlMonth.SelectedValue + "/01");
StoreYYMM();
}
protected void Calendar1_VisibleMonthChanged(object sender, MonthChangedEventArgs e)
{
txtYear.Text = Calendar1.VisibleDate.ToString("yyyy");
ddlMonth.SelectedValue = Calendar1.VisibleDate.ToString("MM");
StoreYYMM();
}
}