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.

226 lines
9.6 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Data;
  8. using System.Web.Services;
  9. #region histroy
  10. ///程式代號:Default
  11. ///程式名稱:訂席預設頁面
  12. ///程式說明:
  13. ///xx.YYYY/MM/DD VER AUTHOR COMMENTS(說明修改的內容)
  14. ///01.2012/11/06 1.0 Ethan CREATE
  15. ///02.2014/03/26 1.1 Gary Modified
  16. ///03.2014/04/10 1.2 Gary Modified
  17. #endregion
  18. namespace OT.Web
  19. {
  20. public partial class ModuleDefault : Ap_Code.BasePage
  21. {
  22. #region Declare Region
  23. // 自定義變量區
  24. //string strNowModule;
  25. #endregion
  26. #region Definition Public Methods
  27. // 公有方法區
  28. #endregion
  29. #region Definition Private Methods
  30. // 私有方法區
  31. #region AddProgramID
  32. [WebMethod]
  33. public static string AddProgramID(string strProgramID, string strUserID)
  34. {
  35. //設定Model資料 End
  36. //該筆資料不存在,可以新增。
  37. bool blReturn = false;
  38. string strReturn1 = "0";//該筆資料已存在
  39. return strReturn1;
  40. }
  41. #endregion
  42. #region DeleteProgramID
  43. [WebMethod]
  44. public static string DeleteProgramID(string strProgramID, string strUserID)
  45. {
  46. string strReturn1 = "1";//該筆資料不存在
  47. return strReturn1;
  48. }
  49. #endregion
  50. #endregion
  51. #region Page Control Event
  52. // 頁面事件觸發區
  53. #region Page_Load
  54. /// <summary>
  55. /// 頁面加載事件
  56. /// </summary>
  57. /// <param name="sender"></param>
  58. /// <param name="e"></param>
  59. protected void Page_Load(object sender, EventArgs e)
  60. {
  61. if (!IsPostBack)
  62. {
  63. //Modified by Gary,20140326 Start. 先判斷是否有權限,如果沒有直接跳頁
  64. string strDefaultID = string.Empty;
  65. string gstrUserID = Session["gstrUserId"] == null ? "" : Session["gstrUserId"].ToString(); //登入者ID
  66. HidUserID.Value = gstrUserID;
  67. OT.BLL.CommonClass o_CommonClass_BLL = new OT.BLL.CommonClass();
  68. DataSet dsCommonClass = o_CommonClass_BLL.GetDDLModuleList(gstrUserID);//gstrUserRoleId-->gstrUserID
  69. int intRowsCount = dsCommonClass.Tables[0].Rows.Count;
  70. if (intRowsCount == 0)
  71. {
  72. Response.Redirect("~/NotView.aspx?PageTile=", false);//true-->false //轉入登入頁面
  73. }
  74. else
  75. {
  76. strDefaultID = dsCommonClass.Tables[0].Rows[0]["ModuleID"].ToString();
  77. string strModuleID = Request.QueryString["ModuleID"];
  78. strModuleID = (strModuleID == "") ? strDefaultID : strModuleID;
  79. hidModuleID.Value = strModuleID;
  80. //Modified by Gary,20140410 Start. 改於前台執行
  81. #region 改於前台執行
  82. //OT.BLL.CommonClass o_Common_BLL = new OT.BLL.CommonClass();
  83. //DataSet dsFunction = o_Common_BLL.GetProgramListByModuleID(strModuleID, gstrUserID);
  84. //string strAccNameSort = dsFunction.Tables[2].Rows[0]["AccountNameSort"].ToString();
  85. //string strModIDSort = dsFunction.Tables[2].Rows[0]["ModuleIDSort"].ToString();
  86. // strNowModule = dsFunction.Tables[2].Rows[0]["ModuleName"].ToString();
  87. //string strHTML = string.Empty;
  88. //#region old
  89. //////List<string> mystrLocTitle = new List<string>();
  90. //////List<string> mystrLocSite = new List<string>();
  91. ////while (strLocTitle.IndexOf('/') != -1)
  92. ////{
  93. //// string strTitle = strLocTitle.Substring(0, strLocTitle.IndexOf('/'));
  94. //// string strSite = strLocSite.Substring(0, strLocSite.IndexOf('/'));
  95. //// strHTML += "<input type='button' runat='server' value='" + strTitle + "' onClick=\"runGoToModuleID('" + strSite + "');\">";
  96. //// //mystrLocTitle.Add(strLocTitle.Substring(0, strLocTitle.IndexOf('/')));
  97. //// //mystrLocSite.Add(strLocSite.Substring(0, strLocSite.IndexOf('/')));
  98. //// if (strLocTitle.LastIndexOf('/') != -1)
  99. //// {
  100. //// strLocTitle = strLocTitle.Substring(strLocTitle.IndexOf('/') + 1, strLocTitle.Length - strLocTitle.IndexOf('/') - 1);
  101. //// strLocSite = strLocSite.Substring(strLocSite.IndexOf('/') + 1, strLocSite.Length - strLocSite.IndexOf('/') - 1);
  102. //// }
  103. //// else
  104. //// {
  105. //// strLocTitle = "";
  106. //// strLocSite = "";
  107. //// }
  108. ////}
  109. ////strHTML += "<input type='button' runat='server' value='" + strNowModule + "' onClick=\"runGoToModuleID('" + strModuleID + "');\">";
  110. ////LocSort.InnerHtml = (strHTML);
  111. //////for (int intCount = 0; intCount < mystrLocTitle.Count; intCount++)
  112. //////{
  113. ////// strHTML += "<input type='button' runat='server' value='" + mystrLocTitle[intCount] + "' onClick=\"runGoToModuleID('" + mystrLocSite[intCount] + "');\">";
  114. //////}
  115. //#endregion
  116. //string[] strTitleAry = strAccNameSort.Split(new char[1] { '/' });
  117. //string[] strSiteAry = strModIDSort.Split(new char[1] { '/' });
  118. //for (int intCount = 0; intCount < strTitleAry.Length; intCount++)
  119. //{
  120. // strHTML += "<input type='button' runat='server' value='" + strTitleAry[intCount] + "' onClick=\"runGoToModuleID('" + strSiteAry[intCount] + "');\">";
  121. //}
  122. //LocSort.InnerHtml = (strHTML);
  123. //LoadProgram(strModuleID, gstrUserID);
  124. #endregion
  125. // Modified by Gary,20140410 end. 改於前台執行
  126. }
  127. // Modified by Gary,20140326 end. 先判斷是否有權限,如果沒有直接跳頁
  128. }
  129. }
  130. #endregion
  131. #region
  132. protected void LoadProgram(string strModuleID, string gstrUserID)
  133. {
  134. //Modified by Gary,20140410 Start. 改於前台執行
  135. #region 改於前台執行
  136. //OT.BLL.CommonClass o_Common_BLL = new OT.BLL.CommonClass();
  137. //DataSet dsFunction = o_Common_BLL.GetProgramListByModuleID(strModuleID, gstrUserID);
  138. //if (dsFunction != null && dsFunction.Tables.Count > 1)
  139. //{
  140. // if (dsFunction.Tables[2] != null && dsFunction.Tables[2].Rows[0]["ParentID"].ToString() != "")
  141. // {
  142. // HidParentID.Value = dsFunction.Tables[2].Rows[0]["ParentID"].ToString();
  143. // }
  144. // else
  145. // {
  146. // lireturn.Visible = false;
  147. // }
  148. // if (txtProgramID.Text == "")
  149. // {
  150. // DataView dvFunction = new DataView(dsFunction.Tables[4]);
  151. // dvFunction.RowFilter = " ParentID = '" + strModuleID + "'";
  152. // rptFunctionProgram.DataSource = dvFunction.ToTable();
  153. // rptFunctionProgram.DataBind();
  154. // }
  155. // else {
  156. // DataView dvFunction = new DataView(dsFunction.Tables[4]);
  157. // dvFunction.RowFilter = " ModuleName like '%" + txtProgramID.Text + "%'";
  158. // rptFunctionProgram.DataSource = dvFunction.ToTable();
  159. // rptFunctionProgram.DataBind();
  160. // }
  161. //}
  162. #endregion
  163. //Modified by Gary,20140410 End. 改於前台執行
  164. }
  165. #endregion
  166. #region btnQry_Click
  167. /// <summary>
  168. /// 查詢按鈕事件
  169. /// </summary>
  170. /// <param name="sender"></param>
  171. /// <param name="e"></param>
  172. protected void btnQry_Click(object sender, EventArgs e)
  173. {
  174. string strModuleID = Request.QueryString["ModuleID"];
  175. string gstrUserID = Session["gstrUserId"] == null ? "" : Session["gstrUserId"].ToString(); //登入者ID
  176. LoadProgram(strModuleID, gstrUserID);
  177. }
  178. #endregion
  179. #region rptFunctionProgram_ItemDataBound
  180. /// <summary>
  181. /// 綁定程式列表後觸發事件
  182. /// </summary>
  183. /// <param name="sender"></param>
  184. /// <param name="e"></param>
  185. protected void rptFunctionProgram_ItemDataBound(object sender, RepeaterItemEventArgs e)
  186. {
  187. //if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
  188. //{
  189. // Image imgPhoto = (Image)e.Item.FindControl("imgPhoto");
  190. // string strSrc = DataBinder.Eval(e.Item.DataItem, "ImgPath").ToString();
  191. // if (!strSrc.Equals(""))
  192. // {
  193. // imgPhoto.ImageUrl = strSrc;
  194. // }
  195. //{
  196. // imgPhoto.ImageUrl = "~/App_Themes/Default/Images/defaultfolder.png";
  197. //}
  198. //else
  199. //}
  200. }
  201. #endregion
  202. #endregion
  203. }
  204. }