protected override bool WfQueryOk() { DataTable dtSource = null; string strQueryAll; string strQueryApend = ""; List <SqlParameter> sqlParmList; string strQueryExternal = ""; try { uGridMaster.PerformAction(UltraGridAction.ExitEditMode); this.TabMaster.DtSource.EndInit(); sqlParmList = new List <SqlParameter>(); this.StrQueryWhere = BoMaster.WfCombineQuerystring(TabMaster, out sqlParmList); StrQueryWhere = GlobalFn.isNullRet(StrQueryWhere, ""); StrQueryWhereAppend = GlobalFn.isNullRet(StrQueryWhereAppend, ""); //額外加入的查詢內容------開始 if (ucx_qryIsBloced.Checked) { strQueryExternal = " AND blkBy >0"; } //額外加入的查詢內容------ end //不下條件仍可以查詢,後續要再做處理 if (StrQueryWhereAppend.Trim().Length > 0) { if (StrQueryWhereAppend.ToLower().TrimStart().IndexOf("and ") < 0) { strQueryApend = " AND " + StrQueryWhereAppend.TrimStart(); } else { strQueryApend = StrQueryWhereAppend.TrimStart(); } } //額外加入的查詢內容------開始 strQueryAll = StrQueryWhere + strQueryApend + this.StrQuerySecurity + strQueryExternal; //額外加入的查詢內容------ end dtSource = this.TabMaster.BoBasic.OfSelect(strQueryAll, sqlParmList); this.ResumeLayout(true); this.FormEditMode = YREditType.NA; //這裡就要把行為改為 YREditType.因為會觸發 retrieve detail for multi form this.TabMaster.DtSource = dtSource; this.WfSetMasterDatasource(this.TabMaster.DtSource); if (this.uGridMaster.Rows.Count > 0) { this.uGridMaster.PerformAction(UltraGridAction.FirstRowInGrid); uGridMaster.ActiveRow = uGridMaster.DisplayLayout.Rows.GetRowAtVisibleIndex(0); //因為這裡不會將第一列設定activeRow 所以人工處理 DrMaster = WfGetActiveDatarow(); } } catch (Exception ex) { throw ex; } finally { this.FormEditMode = YREditType.NA; WfShowRibbonGroup(FormEditMode, TabMaster.IsCheckSecurity, TabMaster.AddTbModel); this.IsChanged = false; } return(true); }