public MainWindow() { InitializeComponent(); SeriesMapping seriesMapping = new SeriesMapping(); seriesMapping.ItemsSource = new List <FruitSales>() { new FruitSales { Fruit = "Apples", Orders = 13 }, new FruitSales { Fruit = "Oranges", Orders = 33 }, new FruitSales { Fruit = "Grapes", Orders = 52 }, }; seriesMapping.LegendLabel = "Exported Fruits"; seriesMapping.SeriesDefinition = new BarSeriesDefinition(); ItemMapping itemMapping = new ItemMapping(); itemMapping.DataPointMember = DataPointMember.XCategory; itemMapping.FieldName = "Fruit"; seriesMapping.ItemMappings.Add(itemMapping); itemMapping = new ItemMapping(); itemMapping.DataPointMember = DataPointMember.YValue; itemMapping.FieldName = "Orders"; seriesMapping.ItemMappings.Add(itemMapping); radChart.SeriesMappings.Add(seriesMapping); }
public async Task <Rental> GetRentalAsync(Guid rentalId, CancellationToken cancellationToken = default) { if (rentalId == Guid.Empty) { throw new ArgumentNullException(nameof(rentalId)); } var dtoRental = await rentalRepository.GetAsync(rentalId, cancellationToken); var dtoItemRentalDetails = await itemRentalDetailsRepository.GetAsync(dtoRental.ItemRentalDetailsId, cancellationToken); var dtoItem = itemRepository.GetAsync(dtoItemRentalDetails.ItemId, cancellationToken); var dtoUser = userRepository.GetAsync(dtoRental.UserId, cancellationToken); if (dtoRental == null) { throw new NullReferenceException(nameof(dtoRental)); } var rental = dtoRental.ConvertDtoRentalToRental(); var user = UserMapping.ConvertDtoUser(await dtoUser); var itemRentalDetails = ItemMapping.ConvertItemRentalDetails(dtoItemRentalDetails, await dtoItem); rental.User = user; rental.ItemRentalDetails = itemRentalDetails; return(rental); }
public ItemService(IItemRepository itemRepo, ISupplierRepository supplierRepo, IItemStructureRepository itemStructureRepo, IStructureRepository structureRepository) { _itemRepository = itemRepo; _supplierRepository = supplierRepo; _structureRepository = structureRepository; _itemStructureRepository = itemStructureRepo; itemMapping = new ItemMapping(); }
private void GetMatch(Match match, PropertyInfo prop, ItemMapping mapping, object entity) { var pName = prop.Name; var preVal = match.Value; var group = match.Groups[pName]; if (group.Success) { preVal = group.Value.Trim(); } else { if (mapping?.MatchIndex != null) { group = match.Groups[mapping.MatchIndex.Value]; if (group.Success) { preVal = group.Value; } } } // Empty value is ignored if (string.IsNullOrEmpty(preVal)) { return; } object objVal = null; if (!string.IsNullOrEmpty(mapping?.ValuePrepocess)) { objVal = Eval.Invoke(string.Format(mapping.ValuePrepocess, preVal)); } else { if (prop.PropertyType == typeof(bool)) { objVal = match.Success; } else if (prop.PropertyType == typeof(int) && int.TryParse(preVal, System.Globalization.NumberStyles.Number, _configuration.DocumentCulture, out int parVal)) { objVal = parVal; // Convert.ChangeType(preVal, typeof(int), _configuration.DocumentCulture); } else { if (TryGetVal(preVal, prop.PropertyType, out object tryVal)) { objVal = tryVal; } } } if (objVal != null) { prop.SetValue(entity, objVal); } }
public async Task AddItemToDispenserAsync(Item item, CancellationToken cancellationToken = default) { if (item == null) { throw new ArgumentNullException(nameof(item)); } await itemRepository.AddAsync(ItemMapping.CreateDtoItem(item), cancellationToken); }
static SeriesMapping InitChartDataString(SeriesMapping sm1) { ItemMapping imX = new ItemMapping("XCategory", DataPointMember.XCategory); ItemMapping imY = new ItemMapping("YValue", DataPointMember.YValue); ItemMapping imL = new ItemMapping("Label", DataPointMember.Label); sm1.ItemMappings.Add(imY); sm1.ItemMappings.Add(imX); sm1.ItemMappings.Add(imL); return(sm1); }
private void GetValueParser(string textToParse, PropertyInfo prop, ItemMapping mapping, IReportDocument reportDocumentEntity) { if (string.IsNullOrEmpty(textToParse)) { return; } try { prop.SetValue(reportDocumentEntity, mapping.ValueParser.Parser.Parse(textToParse)); } catch (Exception e) { _logger.LogError(e, $"There is an error in custom value parser for type ${reportDocumentEntity.GetType()} and property ${prop.Name}"); } }
public static List <SeriesMapping> InitBubbleChart(Structuring s, ClusterEnsemble.Attribute att_x, ClusterEnsemble.Attribute att_y) { List <SeriesMapping> result = new List <SeriesMapping>(); int i = 0; foreach (Cluster item in s.Clusters.Values) { SeriesMapping sm = new SeriesMapping(); sm.SeriesDefinition = new BubbleSeriesDefinition(); sm.LegendLabel = item.Name; sm.CollectionIndex = i; i++; ItemMapping bubblesize = new ItemMapping("BubbleSize", DataPointMember.BubbleSize); ItemMapping imXCat = new ItemMapping("XCategory", DataPointMember.XCategory); ItemMapping imX = new ItemMapping("XValue", DataPointMember.XValue); ItemMapping imY = new ItemMapping("YValue", DataPointMember.YValue); sm.ItemMappings.Add(bubblesize); sm.ItemMappings.Add(imXCat); sm.ItemMappings.Add(imX); sm.ItemMappings.Add(imY); result.Add(sm); } if (s.HaveUnassignedElements()) { SeriesMapping sm = new SeriesMapping(); sm.SeriesDefinition = new BubbleSeriesDefinition(); sm.LegendLabel = "Unassigned Elements"; sm.CollectionIndex = i; i++; ItemMapping bubblesize = new ItemMapping("BubbleSize", DataPointMember.BubbleSize); ItemMapping imXCat = new ItemMapping("XCategory", DataPointMember.XCategory); ItemMapping imX = new ItemMapping("XValue", DataPointMember.XValue); ItemMapping imY = new ItemMapping("YValue", DataPointMember.YValue); sm.ItemMappings.Add(bubblesize); sm.ItemMappings.Add(imXCat); sm.ItemMappings.Add(imX); sm.ItemMappings.Add(imY); result.Add(sm); } return(result); }
internal SimpleDb(string domainName) { this.domainName = domainName; var secrets = Secrets.LoadFromFile("aws.secrets"); var config = new SavantConfig { ReadConsistency = ConsistencyBehavior.Immediate }; Savant = new SimpleSavant(secrets.AwsAccessKeyId, secrets.AwsSecretAccessKey, config); var itemNameMapping = AttributeMapping.Create("Id", typeof(Guid)); itemMapping = ItemMapping.Create(domainName, itemNameMapping); itemMapping.AttributeMappings.Add(AttributeMapping.Create("Text", typeof(string))); itemMapping.AttributeMappings.Add(AttributeMapping.Create("Tags", typeof(string))); itemMapping.AttributeMappings.Add(AttributeMapping.Create("Erledigt", typeof(bool))); itemMapping.AttributeMappings.Add(AttributeMapping.Create("Version", typeof(int))); itemMapping.AttributeMappings.Add(AttributeMapping.Create("Deleted", typeof(bool))); }
public virtual JsonResult DeleteItemMapping(int itemID) { bool result = false; ItemMapping item = db.ItemMappings.Where(x => x.ItemMappingId == itemID).FirstOrDefault(); if (item != null) { item.IsActive = 0; item.Modifiedon = DateTime.Now; db.SaveChanges(); result = true; } var list = db.SubItemMappings.Where(x => x.ItemMappingId == itemID).ToList(); list.ForEach(x => x.IsActive = 0); db.SaveChanges(); return(Json(result, JsonRequestBehavior.AllowGet)); }
private void BindChart() { Chart.ItemsSource = null; var mapping = Chart.SeriesMappings.First(); mapping.GroupingSettings.GroupDescriptors.Clear(); if (GridView.GroupDescriptors.Count > 0) { mapping.LegendLabel = null; var memberName = string.Empty; foreach (var descriptor in GridView.GroupDescriptors.OfType <ColumnGroupDescriptor>()) { var gridViewColumn = descriptor.Column as GridViewDataColumn; memberName = gridViewColumn.UniqueName; var memberType = gridViewColumn.DataType; if (memberName == "Date") { memberName = "ChartDate"; memberType = typeof(string); } var chartGroupDescriptor = new ChartGroupDescriptor(memberName); chartGroupDescriptor.MemberType = memberType; mapping.GroupingSettings.GroupDescriptors.Add(chartGroupDescriptor); } var itemMapping = new ItemMapping(memberName, DataPointMember.XCategory); mapping.ItemMappings.Add(itemMapping); } else { mapping.LegendLabel = "Timespent"; Chart.DefaultView.ChartArea.AxisX.LabelRotationAngle = 0; } var chartSource = GetChartSource(); if (chartSource != null) { mapping.ItemsSource = chartSource; } }
/// <summary> /// Runs a balloon layout where the hierarchy edges are the tree edges and original edges are bundled. /// </summary> private async Task RunBalloonLayout(IListEnumerable <INode> affectedNodes = null) { // create the balloon layout var layout = new BalloonLayout { IntegratedNodeLabeling = true, NodeLabelingPolicy = NodeLabelingPolicy.RayLikeLeaves, FromSketchMode = true, CompactnessFactor = 0.1, AllowOverlaps = true }; // prepend a TreeReduction stage with the hierarchy edges as tree edges layout.PrependStage(new TreeReductionStage()); var nonTreeEdges = GraphControl.Graph.Edges.Where(e => !aggregationHelper.IsHierarchyEdge(e)).ToList(); // mark all other edges to be bundled var bundleDescriptorMap = new ItemMapping <IEdge, EdgeBundleDescriptor>(); foreach (var nonTreeEdge in nonTreeEdges) { bundleDescriptorMap.Mapper[nonTreeEdge] = new EdgeBundleDescriptor { Bundled = true }; } var treeReductionStageData = new TreeReductionStageData { NonTreeEdges = { Items = nonTreeEdges }, EdgeBundleDescriptors = bundleDescriptorMap }; // create a layout executor that also zooms to all nodes that were affected by the last operation var layoutExecutor = new ZoomToNodesLayoutExecutor(affectedNodes ?? ListEnumerable <INode> .Empty, GraphControl, layout) { Duration = TimeSpan.FromSeconds(0.5), AnimateViewport = true, EasedAnimation = true, LayoutData = treeReductionStageData }; await layoutExecutor.Start(); }
public ReportScreenMasterview() { InitializeComponent(); var mapping = Chart.SeriesMappings.First(); try { var itemMapping = new ItemMapping("TimeSpent", DataPointMember.YValue, ChartAggregateFunction.Sum); mapping.ItemMappings.Add(itemMapping); } catch (Exception) { } GridView.Grouped += (sender, args) => BindChart(); GridView.Filtered += (sender, args) => BindChart(); GridView.DataLoaded += GridViewOnDataLoaded; BtnClearFilter.Click += btnClearFilter_Clicked; ReportCommands.DataLoaded.RegisterCommand(new DelegateCommand <object>(o => BindChart())); }
public MainPage() { InitializeComponent(); SeriesMapping seriesMapping = new SeriesMapping(); seriesMapping.ItemsSource = new List<FruitSales>() { new FruitSales { Fruit = "Apples", Orders = 13 }, new FruitSales { Fruit = "Oranges", Orders = 33 }, new FruitSales { Fruit = "Grapes", Orders = 52 }, }; seriesMapping.LegendLabel = "Exported Fruits"; seriesMapping.SeriesDefinition = new BarSeriesDefinition(); ItemMapping itemMapping = new ItemMapping(); itemMapping.DataPointMember = DataPointMember.XCategory; itemMapping.FieldName = "Fruit"; seriesMapping.ItemMappings.Add(itemMapping); itemMapping = new ItemMapping(); itemMapping.DataPointMember = DataPointMember.YValue; itemMapping.FieldName = "Orders"; seriesMapping.ItemMappings.Add(itemMapping); radChart.SeriesMappings.Add(seriesMapping); }
public TreeConverter() { itemMapping = new ItemMapping <int>(); }
public async Task <IEnumerable <ItemBundle> > GetItemBundlesAsync(CancellationToken cancellationToken = default) { var itemBundles = await itemBundleRepository.ListAsync(cancellationToken); return(ItemMapping.ConvertDtoItemBundlesToItemBundles(itemBundles)); }