84 lines
2.8 KiB
C#
84 lines
2.8 KiB
C#
using System;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.HtmlControls;
|
|
using WebLib;
|
|
using System.Web;
|
|
using System.Web.Services;
|
|
using System.Web.Script.Services;
|
|
|
|
namespace Education
|
|
{
|
|
public partial class Default : FormBase
|
|
{
|
|
private DAC_場地遴選 Dao場地遴選;
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
FunctionName = "首頁";
|
|
|
|
Dao場地遴選 = new DAC_場地遴選(conn);
|
|
|
|
if (IsPostBack)
|
|
{
|
|
gv課程資訊.DataBind();
|
|
rp課程剪影.DataBind();
|
|
dl課程回饋.DataBind();
|
|
}
|
|
}
|
|
|
|
protected void ds課程資訊_ObjectCreating(object sender, ObjectDataSourceEventArgs e)
|
|
{
|
|
e.ObjectInstance = new DAC_訓練課程企劃(conn);
|
|
}
|
|
|
|
protected void ds課程資訊_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
|
|
{
|
|
//DateTime d = new DateTime(DateTime.UtcNow.AddHours(8).Date.Year, DateTime.UtcNow.AddHours(8).Date.Month, 1);
|
|
//e.InputParameters["訓練日期1"] = d;
|
|
//e.InputParameters["訓練日期2"] = d.AddMonths(2).AddDays(-1);
|
|
}
|
|
|
|
protected string Get訓練地點(object 課程ID)
|
|
{
|
|
return GetData.取得選定場地(DAC.GetInt32(課程ID)).場地名稱;
|
|
}
|
|
|
|
protected string Get剩餘名額(object 課程ID, object 人數)
|
|
{
|
|
int 名額 = DAC.GetInt32(人數);
|
|
int 已報名人數 = Dao課程報名.Get報名人數(DAC.GetInt32(課程ID));
|
|
if (名額 > 已報名人數)
|
|
return String.Format("{0}", 名額 - 已報名人數);
|
|
else
|
|
return "額滿";
|
|
}
|
|
|
|
protected void dl課程回饋_DataBinding(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
protected void dl課程回饋_ItemDataBound(object sender, DataListItemEventArgs e)
|
|
{
|
|
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
|
|
{
|
|
if (e.Item.FindControl("btn展開") is LinkButton btn展開
|
|
&& e.Item.FindControl("div心得") is HtmlControl div心得)
|
|
{
|
|
btn展開.OnClientClick = String.Format("ShowHideContent(this, \"{0}\"); return false;", div心得.ClientID);
|
|
}
|
|
}
|
|
}
|
|
|
|
[WebMethod(EnableSession = true)]
|
|
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
|
|
public static string Heartbeat()
|
|
{
|
|
//讀取Session,避免逾時
|
|
var chk = HttpContext.Current.Session[PublicVariable.UserId] as string;
|
|
if (string.IsNullOrEmpty(chk))
|
|
return "Session lost";
|
|
return "OK";
|
|
}
|
|
}
|
|
}
|