public static RelationPredicateBucket CreateBucket(short godina, string jqGridFilters) { RelationPredicateBucket bucket = new RelationPredicateBucket(RacunGlavaFields.Godina == godina); if (!string.IsNullOrWhiteSpace(jqGridFilters)) { bucket.PredicateExpression.Add(PredicateHelper.CreatePredicateFromJqGridFilterString(jqGridFilters, typeof(RacunGlavaFields), DbGenericHelper.GetDbGenericTypeByName)); JqGridFilter jqGrid = JsonConvert.DeserializeObject <JqGridFilter>(jqGridFilters); if (jqGrid != null && jqGrid.rules != null) { DateTime?datumOd = null; DateTime?datumDo = null; foreach (JqGridFilterItem item in jqGrid.rules.Where(r => r.field == "Datum")) { if (item.op == "ge") { datumOd = DateTime.Parse(item.data).Date; } if (item.op == "le") { datumDo = DateTime.Parse(item.data).Date.AddDays(1); } bucket.PredicateExpression.Add(PredicateHelper.FilterValidEntities(datumOd, datumDo, RacunGlavaFields.Datum)); } } } return(bucket); }