You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

227 lines
9.6 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Services;
#region histroy
///程式代號:Default
///程式名稱:訂席預設頁面
///程式說明:
///xx.YYYY/MM/DD VER AUTHOR COMMENTS(說明修改的內容)
///01.2012/11/06 1.0 Ethan CREATE
///02.2014/03/26 1.1 Gary Modified
///03.2014/04/10 1.2 Gary Modified
#endregion
namespace OT.Web
{
public partial class ModuleDefault : Ap_Code.BasePage
{
#region Declare Region
// 自定義變量區
//string strNowModule;
#endregion
#region Definition Public Methods
// 公有方法區
#endregion
#region Definition Private Methods
// 私有方法區
#region AddProgramID
[WebMethod]
public static string AddProgramID(string strProgramID, string strUserID)
{
//設定Model資料 End
//該筆資料不存在,可以新增。
bool blReturn = false;
string strReturn1 = "0";//該筆資料已存在
return strReturn1;
}
#endregion
#region DeleteProgramID
[WebMethod]
public static string DeleteProgramID(string strProgramID, string strUserID)
{
string strReturn1 = "1";//該筆資料不存在
return strReturn1;
}
#endregion
#endregion
#region Page Control Event
// 頁面事件觸發區
#region Page_Load
/// <summary>
/// 頁面加載事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//Modified by Gary,20140326 Start. 先判斷是否有權限,如果沒有直接跳頁
string strDefaultID = string.Empty;
string gstrUserID = Session["gstrUserId"] == null ? "" : Session["gstrUserId"].ToString(); //登入者ID
HidUserID.Value = gstrUserID;
OT.BLL.CommonClass o_CommonClass_BLL = new OT.BLL.CommonClass();
DataSet dsCommonClass = o_CommonClass_BLL.GetDDLModuleList(gstrUserID);//gstrUserRoleId-->gstrUserID
int intRowsCount = dsCommonClass.Tables[0].Rows.Count;
if (intRowsCount == 0)
{
Response.Redirect("~/NotView.aspx?PageTile=", false);//true-->false //轉入登入頁面
}
else
{
strDefaultID = dsCommonClass.Tables[0].Rows[0]["ModuleID"].ToString();
string strModuleID = Request.QueryString["ModuleID"];
strModuleID = (strModuleID == "") ? strDefaultID : strModuleID;
hidModuleID.Value = strModuleID;
//Modified by Gary,20140410 Start. 改於前台執行
#region 改於前台執行
//OT.BLL.CommonClass o_Common_BLL = new OT.BLL.CommonClass();
//DataSet dsFunction = o_Common_BLL.GetProgramListByModuleID(strModuleID, gstrUserID);
//string strAccNameSort = dsFunction.Tables[2].Rows[0]["AccountNameSort"].ToString();
//string strModIDSort = dsFunction.Tables[2].Rows[0]["ModuleIDSort"].ToString();
// strNowModule = dsFunction.Tables[2].Rows[0]["ModuleName"].ToString();
//string strHTML = string.Empty;
//#region old
//////List<string> mystrLocTitle = new List<string>();
//////List<string> mystrLocSite = new List<string>();
////while (strLocTitle.IndexOf('/') != -1)
////{
//// string strTitle = strLocTitle.Substring(0, strLocTitle.IndexOf('/'));
//// string strSite = strLocSite.Substring(0, strLocSite.IndexOf('/'));
//// strHTML += "<input type='button' runat='server' value='" + strTitle + "' onClick=\"runGoToModuleID('" + strSite + "');\">";
//// //mystrLocTitle.Add(strLocTitle.Substring(0, strLocTitle.IndexOf('/')));
//// //mystrLocSite.Add(strLocSite.Substring(0, strLocSite.IndexOf('/')));
//// if (strLocTitle.LastIndexOf('/') != -1)
//// {
//// strLocTitle = strLocTitle.Substring(strLocTitle.IndexOf('/') + 1, strLocTitle.Length - strLocTitle.IndexOf('/') - 1);
//// strLocSite = strLocSite.Substring(strLocSite.IndexOf('/') + 1, strLocSite.Length - strLocSite.IndexOf('/') - 1);
//// }
//// else
//// {
//// strLocTitle = "";
//// strLocSite = "";
//// }
////}
////strHTML += "<input type='button' runat='server' value='" + strNowModule + "' onClick=\"runGoToModuleID('" + strModuleID + "');\">";
////LocSort.InnerHtml = (strHTML);
//////for (int intCount = 0; intCount < mystrLocTitle.Count; intCount++)
//////{
////// strHTML += "<input type='button' runat='server' value='" + mystrLocTitle[intCount] + "' onClick=\"runGoToModuleID('" + mystrLocSite[intCount] + "');\">";
//////}
//#endregion
//string[] strTitleAry = strAccNameSort.Split(new char[1] { '/' });
//string[] strSiteAry = strModIDSort.Split(new char[1] { '/' });
//for (int intCount = 0; intCount < strTitleAry.Length; intCount++)
//{
// strHTML += "<input type='button' runat='server' value='" + strTitleAry[intCount] + "' onClick=\"runGoToModuleID('" + strSiteAry[intCount] + "');\">";
//}
//LocSort.InnerHtml = (strHTML);
//LoadProgram(strModuleID, gstrUserID);
#endregion
// Modified by Gary,20140410 end. 改於前台執行
}
// Modified by Gary,20140326 end. 先判斷是否有權限,如果沒有直接跳頁
}
}
#endregion
#region
protected void LoadProgram(string strModuleID, string gstrUserID)
{
//Modified by Gary,20140410 Start. 改於前台執行
#region 改於前台執行
//OT.BLL.CommonClass o_Common_BLL = new OT.BLL.CommonClass();
//DataSet dsFunction = o_Common_BLL.GetProgramListByModuleID(strModuleID, gstrUserID);
//if (dsFunction != null && dsFunction.Tables.Count > 1)
//{
// if (dsFunction.Tables[2] != null && dsFunction.Tables[2].Rows[0]["ParentID"].ToString() != "")
// {
// HidParentID.Value = dsFunction.Tables[2].Rows[0]["ParentID"].ToString();
// }
// else
// {
// lireturn.Visible = false;
// }
// if (txtProgramID.Text == "")
// {
// DataView dvFunction = new DataView(dsFunction.Tables[4]);
// dvFunction.RowFilter = " ParentID = '" + strModuleID + "'";
// rptFunctionProgram.DataSource = dvFunction.ToTable();
// rptFunctionProgram.DataBind();
// }
// else {
// DataView dvFunction = new DataView(dsFunction.Tables[4]);
// dvFunction.RowFilter = " ModuleName like '%" + txtProgramID.Text + "%'";
// rptFunctionProgram.DataSource = dvFunction.ToTable();
// rptFunctionProgram.DataBind();
// }
//}
#endregion
//Modified by Gary,20140410 End. 改於前台執行
}
#endregion
#region btnQry_Click
/// <summary>
/// 查詢按鈕事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnQry_Click(object sender, EventArgs e)
{
string strModuleID = Request.QueryString["ModuleID"];
string gstrUserID = Session["gstrUserId"] == null ? "" : Session["gstrUserId"].ToString(); //登入者ID
LoadProgram(strModuleID, gstrUserID);
}
#endregion
#region rptFunctionProgram_ItemDataBound
/// <summary>
/// 綁定程式列表後觸發事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void rptFunctionProgram_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
//if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
//{
// Image imgPhoto = (Image)e.Item.FindControl("imgPhoto");
// string strSrc = DataBinder.Eval(e.Item.DataItem, "ImgPath").ToString();
// if (!strSrc.Equals(""))
// {
// imgPhoto.ImageUrl = strSrc;
// }
//{
// imgPhoto.ImageUrl = "~/App_Themes/Default/Images/defaultfolder.png";
//}
//else
//}
}
#endregion
#endregion
}
}