/// <summary> /// 通用查询条件 /// </summary> /// <param name="userID"></param> /// <param name="attr"></param> /// <param name="where"></param> public static dynamic GetWhereByEntityID(int userID, CriteriaPropertyAttribute attr, int?empID = null) { dynamic value = null; var result = PermissionsConditionDAO.GetPermissionData(attr.EntityID, userID); if (empID != null) { result.Add(empID.Value); } if (result != null && result.Count > 0) { if (!result.Contains(-999)) { value = result.ToArray(); } } else { value = new int[] { attr.NoDataID }; } return(value); }
public static AbstractWhereItem ToWhereItem(CriteriaPropertyAttribute attr, dynamic val) { AbstractWhereItem result = null; switch (attr.Opration) { case CriteriaOprations.In: result = new InWhereItem { Dimission = attr.Dimission, Values = val }; break; case CriteriaOprations.Range: result = new RangeWhereItem { Dimission = attr.Dimission, ValueFrom = val[0], ValueTo = val.Length > 1 ? val[1] : null }; break; default: result = new EqualWhereItem { Dimission = attr.Dimission, Value = val }; break; } return(result); }
private IMDXAxis ToAxis(CriteriaPropertyAttribute attr, dynamic val) { AbstractWhereItem result = ToWhereItem(attr, val); var axis = new MDXAxis { AxisType = MDXAxis.COLUMN_AXIS }; if (attr.Opration == CriteriaOprations.Eq) { axis.AxisItem = new StringAxisItem($"({{{result.Build()}}})"); } else { axis.AxisItem = new StringAxisItem($"({result.Build()})"); } return(axis); }
public static void GetWhere(CriteriaPropertyAttribute attr, dynamic value, MDXWhere where) { switch (attr.Opration) { case CriteriaOprations.Eq: if (value != null) { var item = ToWhereItem(attr, value); where.And(item); } break; default: if (value != null && value.Length > 0) { var item = ToWhereItem(attr, value); where.And(item); } break; } }