/// <summary> /// 頁面載入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { qryAreaGrant.ucServiceMethod = AclExpress._AclAreaGrantServiceMethod; qryAreaGrant.ucCategory01 = "AreaID"; qryAreaGrant.ucCategory02 = "GrantID"; qryAreaGrant.ucDropDownListEnabled01 = true; qryAreaGrant.ucDropDownListEnabled02 = true; qryAreaGrant.ucDropDownListEnabled03 = false; qryAreaGrant.ucDropDownListEnabled04 = false; qryAreaGrant.ucDropDownListEnabled05 = false; qryAreaGrant.Refresh(); if (!IsPostBack) { //首次載入 qryRuleID.ucSourceDictionary = Util.getDictionary(AclExpress.getAclRuleData(), 0, 1, true); qryRuleID.Refresh(); qryAuthType.ucSourceDictionary = Util.getDictionary(AclExpress.getAclAuthTypeList()); qryAuthType.Refresh(); ucGridView1.ucDBName = _DBName; ucGridView1.ucDataQrySQL = _QryResultSQL; ucGridView1.ucDataKeyList = _PKList; Dictionary <string, string> dicDisplay = new Dictionary <string, string>(); dicDisplay.Clear(); dicDisplay.Add("AreaID", "區域代號"); dicDisplay.Add("AreaName", "區域名稱"); dicDisplay.Add("GrantID", "項目代號"); dicDisplay.Add("GrantName", "項目名稱"); dicDisplay.Add("AuthType", "授權類型"); dicDisplay.Add("AllowActList", "限定動作"); dicDisplay.Add("UpdUser", "更新人員"); dicDisplay.Add("UpdDateTime", "更新時間@T"); ucGridView1.ucDataGroupKey = "RuleID"; ucGridView1.ucDataDisplayDefinition = dicDisplay; ucGridView1.ucSelectEnabled = false; ucGridView1.ucAddEnabled = true; ucGridView1.ucEditEnabled = true; ucGridView1.ucCopyEnabled = true; ucGridView1.ucDeleteEnabled = true; //Data Dump 2016.11.08 ucGridView1.ucDataDumpEnabled = true; ucGridView1.Refresh(true); } //事件訂閱 ucGridView1.RowCommand += new Util_ucGridView.GridViewRowClick(ucGridView1_RowCommand); ucModalPopup1.onClose += ucModalPopup1_onClose; }
/// <summary> /// fmMain 資料繫結事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void fmMain_DataBound(object sender, EventArgs e) { //初始物件 Util_ucTextBox oText; Util_ucCascadingDropDown oCascad; Util_ucCommSingleSelect oDdl; Util_ucCheckBoxList oChkList; string strObjID; DataRow dr = null; if (fmMain.DataSource != null) { dr = ((DataTable)fmMain.DataSource).Rows[0]; } //「新增」「資料複製」模式 if (fmMain.CurrentMode == FormViewMode.Insert) { //自訂檢核失敗時的JS提醒訊息 Util.setJS_AlertPageNotValid("btnInsert"); strObjID = "RuleID"; oDdl = (Util_ucCommSingleSelect)fmMain.FindControl(strObjID); oDdl.ucSourceDictionary = Util.getDictionary(AclExpress.getAclRuleData(), 0, 1, true); if (dr != null) { oDdl.ucSelectedID = dr[strObjID].ToString().Trim(); } oDdl.Refresh(); strObjID = "AreaGrant"; oCascad = (Util_ucCascadingDropDown)fmMain.FindControl(strObjID); oCascad.ucServiceMethod = AclExpress._AclAreaGrantServiceMethod; oCascad.ucCategory01 = "AreaID"; oCascad.ucCategory02 = "GrantID"; oCascad.ucDropDownListEnabled01 = true; oCascad.ucDropDownListEnabled02 = true; oCascad.ucDropDownListEnabled03 = false; oCascad.ucDropDownListEnabled04 = false; oCascad.ucDropDownListEnabled05 = false; if (dr != null) { oCascad.ucDefaultSelectedValue01 = dr["AreaID"].ToString().Trim(); } if (dr != null) { oCascad.ucDefaultSelectedValue02 = dr["GrantID"].ToString().Trim(); } oCascad.Refresh(); strObjID = "AuthType"; oDdl = (Util_ucCommSingleSelect)fmMain.FindControl(strObjID); oDdl.ucSourceDictionary = Util.getDictionary(AclExpress.getAclAuthTypeList()); if (dr != null) { oDdl.ucSelectedID = dr[strObjID].ToString().Trim(); } oDdl.Refresh(); strObjID = "AllowActList"; oChkList = (Util_ucCheckBoxList)fmMain.FindControl(strObjID); oChkList.ucSourceDictionary = Util.getDictionary(AclExpress.getAclAuthActList()); if (dr != null) { oChkList.ucSelectedIDList = dr[strObjID].ToString().Trim(); } oChkList.Refresh(); strObjID = "Remark"; oText = (Util_ucTextBox)fmMain.FindControl(strObjID); if (dr != null) { oText.ucTextData = dr[strObjID].ToString().Trim(); } } //「編輯」模式 if (fmMain.CurrentMode == FormViewMode.Edit) { //自訂檢核失敗時的JS提醒訊息 Util.setJS_AlertPageNotValid("btnUpdate"); strObjID = "RuleID"; oDdl = (Util_ucCommSingleSelect)fmMain.FindControl(strObjID); oDdl.ucSourceDictionary = Util.getDictionary(AclExpress.getAclRuleData(), 0, 1, true); oDdl.ucIsReadOnly = true; //鍵值欄位需為唯讀 if (dr != null) { oDdl.ucSelectedID = dr[strObjID].ToString().Trim(); } oDdl.Refresh(); strObjID = "AreaGrant"; oCascad = (Util_ucCascadingDropDown)fmMain.FindControl(strObjID); oCascad.ucServiceMethod = AclExpress._AclAreaGrantServiceMethod; oCascad.ucCategory01 = "AreaID"; oCascad.ucCategory02 = "GrantID"; oCascad.ucDropDownListEnabled01 = true; oCascad.ucDropDownListEnabled02 = true; oCascad.ucDropDownListEnabled03 = false; oCascad.ucDropDownListEnabled04 = false; oCascad.ucDropDownListEnabled05 = false; oCascad.ucIsReadOnly01 = true; //鍵值欄位需為唯讀 oCascad.ucIsReadOnly02 = true; //鍵值欄位需為唯讀 if (dr != null) { oCascad.ucDefaultSelectedValue01 = dr["AreaID"].ToString().Trim(); } if (dr != null) { oCascad.ucDefaultSelectedValue02 = dr["GrantID"].ToString().Trim(); } oCascad.Refresh(); strObjID = "AuthType"; oDdl = (Util_ucCommSingleSelect)fmMain.FindControl(strObjID); oDdl.ucSourceDictionary = Util.getDictionary(AclExpress.getAclAuthTypeList()); if (dr != null) { oDdl.ucSelectedID = dr[strObjID].ToString().Trim(); } oDdl.Refresh(); strObjID = "AllowActList"; oChkList = (Util_ucCheckBoxList)fmMain.FindControl(strObjID); oChkList.ucSourceDictionary = Util.getDictionary(AclExpress.getAclAuthActList()); if (dr != null) { oChkList.ucSelectedIDList = dr[strObjID].ToString().Trim(); } oChkList.Refresh(); strObjID = "Remark"; oText = (Util_ucTextBox)fmMain.FindControl(strObjID); if (dr != null) { oText.ucTextData = dr[strObjID].ToString().Trim(); } //刪除確認訊息 Button oBtn = (Button)fmMain.FindControl("btnDelete"); if (oBtn != null) { Util.ConfirmBox(oBtn, RS.Resources.Msg_Confirm_Delete); } } }