string[] validateSqlFilter(WebRequest webRequest, Type entityClass, string joinSql, string filterSql) { SessionData sessionData = sessionService.GetSessionData(webRequest); division Division = sessionData.Division; if (null == Division) { return(new string[] { joinSql, filterSql }); } Attribute customAttr = entityClass.GetCustomAttribute(typeof(AdditionalFilter)); if (null != customAttr) { AdditionalFilter additionalFilter = (AdditionalFilter)customAttr; //join if (additionalFilter.join != null) { joinSql += " " + additionalFilter.join; } //filter if (additionalFilter.filter != null) { const string toReplace = "${filterId}"; string replacedParam = additionalFilter.filter.Replace(toReplace, Division.id.ToString()); if (filterSql == null || filterSql.Trim().Equals("")) { filterSql = "WHERE " + replacedParam; } else { filterSql += " AND " + replacedParam; } } } return(new string[] { joinSql, filterSql }); }
/// <summary> /// Checks whether represented data equals to corresponding data of object /// </summary> /// <param name="obj">Compared object</param> /// <returns></returns> public bool ContainedDataEquals(IDisplayingEntity obj) { if (!(obj is DispatcheredTemplateDetailListScreen)) { return(false); } if (!(obj.ContainedData is TemplateAircraft)) { return(false); } DispatcheredTemplateDetailListScreen dispatcheredTemplateDetailListScreen = obj as DispatcheredTemplateDetailListScreen; return(detailContainer == dispatcheredTemplateDetailListScreen.detailContainer //&& initialFilter.Equals(dispatcheredTemplateDetailListScreen.initialFilter) && AdditionalFilter.Equals(dispatcheredTemplateDetailListScreen.AdditionalFilter)); }
/// <summary> /// Checks whether represented data equals to corresponding data of object /// </summary> /// <param name="obj">Compared object</param> /// <returns></returns> public bool ContainedDataEquals(IDisplayingEntity obj) { if (!(obj is DispatcheredComponentStatusControl)) { return(false); } if (!(obj.ContainedData is Aircraft)) { return(false); } DispatcheredComponentStatusControl dispatcheredComponentStatusControl = obj as DispatcheredComponentStatusControl; return(detailContainer == dispatcheredComponentStatusControl.detailContainer && initialFilter.Equals(dispatcheredComponentStatusControl.initialFilter) && AdditionalFilter.Equals(dispatcheredComponentStatusControl.AdditionalFilter)); }