public IEnumerable <WellParametersStatisticValues> GetQueryResult() { IEnumerable <Well> wells = wellDataProvider.GetItems(); IEnumerable <WellParameter> wellParameters = wellParameterDataProvider.GetItems(); return(wells .Where(well => well.Id >= 10 && well.Id <= 30) .Join(wellParameters, well => well.Id, wellParameter => wellParameter.WellId, (well, wellParameter) => new { Well = well.Name, wellParameter.ParameterName, wellParameter.Value }) .GroupBy(group => group.Well) .Select(group => new WellParametersStatisticValues { Name = group.Key, Parameters = group .GroupBy(g => g.ParameterName) .Select(parameters => new ParametersValues { Name = parameters.Key, Min = Math.Round(parameters.Select(p => p.Value).Min(), 2), Max = Math.Round(parameters.Select(p => p.Value).Max(), 2), Average = Math.Round(parameters.Select(p => p.Value).Average()), Median = Math.Round(parameters.Select(p => p.Value).Median()) }) })); }
public IEnumerable <DepartmentWells> GetQueryResult() { IEnumerable <Well> wells = wellDataProvider.GetItems(); IEnumerable <Department> departments = departmentDataProvider.GetItems(); Department[] departmentsArray = departments.ToArray(); IEnumerable <DepartmentWells> wellsDepartments = Enumerable.Range(0, departmentsArray.Length) .Select(i => new DepartmentWells { Department = departmentsArray[i].Name, Wells = wells .Where(well => IsInside(departmentsArray[i].X, departmentsArray[i].Y, departmentsArray[i].Radius, well.X, well.Y)).Select(d => d.Name) }); DepartmentWells wellsWithoutDepartment = new DepartmentWells { Department = "Неизвестное месторождение", Wells = wells.Select(well => well.Name).Except(wellsDepartments.SelectMany(x => x.Wells)) }; IEnumerable <DepartmentWells> departmentsWithoutWells = departments.Select(department => department.Name) .Except(wellsDepartments.Select(x => x.Department)) .Select(department => new DepartmentWells { Department = department, Wells = null }); return(wellsDepartments.Union(departmentsWithoutWells.Append(wellsWithoutDepartment))); }
private static Dictionary <object[], int> UpdateTally(Dictionary <object[], int> oldTally, IDataProvider provider, ICollection <DataBinding> bindings, bool includeDynamicItems) { Dictionary <object[], int> tally = new Dictionary <object[], int>(ArrayEqualityComparer <object> .Default); int maxCount = int.MaxValue; foreach (IDataItem item in provider.GetItems(bindings, includeDynamicItems)) { object[] values = GetValues(item, bindings); if (values != null) { if (oldTally != null && !oldTally.TryGetValue(values, out maxCount)) { continue; } int count; tally.TryGetValue(values, out count); if (count < maxCount) { count += 1; tally[values] = count; } } } return(tally); }
public List <EntityInfo> GetItems(int portalID) { DotNetNuke.Common.Requires.PropertyNotNegative("postID", "", portalID); // TODO: Implement caching here return(CBO.FillCollection <EntityInfo>(_dataProvider.GetItems(portalID))); }
public override IEnumerable GetItems(IDataProvider dataProvider) { var criterias = DataSource.GetPropertyFilters(); // Todo var pageNumber = DataSource.GetPageNumber(); var pageSize = DataSource.GetPageSize(); return(dataProvider.GetItems(criterias, pageNumber, pageSize)); }
private List <Dictionary <string, object> > LoadDataCollection(ExpressionMetadataChain chain) { var selectQuery = ModelQueryBuilder.BuildSelectQuery(chain); var response = _dataProvider.GetItems(selectQuery); return(response != null && response.Success ? response.Items : new List <Dictionary <string, object> >()); }
private static IEnumerable<IDataItem> GetItemsAccordingToTally(Dictionary<object[], int> tally, IDataProvider provider, ICollection<DataBinding> bindings, bool includeDynamicItems) { foreach (IDataItem item in provider.GetItems(bindings, includeDynamicItems)) { object[] values = GetValues(item, bindings); int count; if (values != null && tally.TryGetValue(values, out count)) { yield return item; count -= 1; if (count == 0) tally.Remove(values); else tally[values] = count; } } }
private static IEnumerable <IDataItem> GetItemsAccordingToTally(Dictionary <object[], int> tally, IDataProvider provider, ICollection <DataBinding> bindings, bool includeDynamicItems) { foreach (IDataItem item in provider.GetItems(bindings, includeDynamicItems)) { object[] values = GetValues(item, bindings); int count; if (values != null && tally.TryGetValue(values, out count)) { yield return(item); count -= 1; if (count == 0) { tally.Remove(values); } else { tally[values] = count; } } } }
private static Dictionary<object[], int> UpdateTally(Dictionary<object[], int> oldTally, IDataProvider provider, ICollection<DataBinding> bindings, bool includeDynamicItems) { Dictionary<object[], int> tally = new Dictionary<object[], int>(ArrayEqualityComparer<object>.Default); int maxCount = int.MaxValue; foreach (IDataItem item in provider.GetItems(bindings, includeDynamicItems)) { object[] values = GetValues(item, bindings); if (values != null) { if (oldTally != null && !oldTally.TryGetValue(values, out maxCount)) continue; int count; tally.TryGetValue(values, out count); if (count < maxCount) { count += 1; tally[values] = count; } } } return tally; }
public IEnumerable <string> GetQueryResult() => wellDataProvider.GetItems() .GroupBy(wellParameter => wellParameter.ParameterName) .Select(group => group.Key);