/// <summary> /// 建立物件複本。 /// </summary> public GFilterItem Clone() { GFilterItem oItem; oItem = new GFilterItem { FieldName = this.FieldName, FilterValue = this.FilterValue, CombineOperator = this.CombineOperator, ComparisonOperator = this.ComparisonOperator, GroupNumber = this.GroupNumber, Required = this.Required }; return(oItem); }
/// <summary> /// 系統變數過濾條件轉換為一般過濾條件。 /// </summary> /// <param name="filterItem">系統變數過濾條件。</param> private GFilterItem ConvertItemForVariable(GFilterItem filterItem) { GFilterItem oFilterItem; ESysVariable oVariable; string sValue; // 取得系統變數,若無法正確轉換系統變數,則傳回空字串 try { oVariable = GetSysVariable(filterItem.FilterValue); } catch { return(null); } // 取得系統變數值 sValue = GetSysVariableValue(this.SessionInfo, oVariable); if (StrFunc.StrIsEmpty(sValue)) { return(null); } switch (oVariable) { case ESysVariable.CompanyID: case ESysVariable.DepartmentID: case ESysVariable.EmployeeID: case ESysVariable.UserID: // 轉換為等於過濾條件 oFilterItem = filterItem.Clone(); oFilterItem.ComparisonOperator = EComparisonOperator.Equal; oFilterItem.FilterValue = sValue; return(oFilterItem); default: // 日期相關變數 // 轉換為日期區間過濾條件 oFilterItem = filterItem.Clone(); oFilterItem.ComparisonOperator = EComparisonOperator.Between; oFilterItem.FilterValue = sValue; return(oFilterItem); } }