private void SaveCurrentDb() { var messageID = FrmWaitScreen.ShowMessage("Saving Changes ...."); _currentDB.SubmitChanges(); FrmWaitScreen.HideMessage(messageID); }
private void tmrMatch_Tick(object sender, EventArgs e) { if (_workerThread == null || !_workerThread.IsAlive) { tmrMatch.Stop(); MessageBox.Show(_currentStatus.Replace('|', '\n'), "Done!"); _currentStatus = string.Empty; var fi = new FileInfo(skuGapsFileName); if (fi.Exists) { AryaTools.Instance.Forms.BrowserForm.GotoUrl(fi.FullName); } } if (string.IsNullOrEmpty(_currentStatus)) { if (_waitkey != Guid.Empty) { FrmWaitScreen.HideMessage(_waitkey); _waitkey = Guid.Empty; } } else { if (_waitkey == Guid.Empty) { _waitkey = FrmWaitScreen.ShowMessage(_currentStatus); } else { FrmWaitScreen.UpdateMessage(_waitkey, _currentStatus); } } }
private void btnReplaceAll_Click(object sender, EventArgs e) { if (!ValidateInputParameters()) { return; } _findNext = false; int changeCount = 0; Guid waitKey = FrmWaitScreen.ShowMessage("Replace all"); while (DoFind()) { string originalValue = _parent.edgv.CurrentCell.Value.ToString(); _parent.CurrentChange.NewValues.Val = ddReplaceType.Text.Equals(FindTypeEntireValue) ? txtReplace.Text : Replace(_parent.edgv.CurrentCell.Value.ToString(), txtFind.Text, txtReplace.Text, rbMatchCase.Checked); _parent.SaveCurrentChangeAndGetNewChange(true); if (!_parent.edgv.CurrentCell.Value.ToString().Equals(originalValue)) { changeCount++; FrmWaitScreen.UpdateMessage(waitKey, string.Format("Replace all: {0} values updated", changeCount)); } } FrmWaitScreen.HideMessage(waitKey); AryaTools.Instance.SaveChangesIfNecessary(false, false); lblStatus.Text = string.Format("{0} values updated.", changeCount); ReselectSelection(); }
private void initdgvSkuGroups() { Guid waitkey = FrmWaitScreen.ShowMessage("Fetching data, please wait..."); InitGroupData(); FrmWaitScreen.HideMessage(waitkey); }
private void InitAttributes(HashSet <Guid> attributeExclusions = null) { var waitKey = FrmWaitScreen.ShowMessage("Reading Attributes"); _allAttributes = AryaTools.Instance.InstanceData.Dc.Attributes.Where( att => att.Project.Equals(AryaTools.Instance.InstanceData.CurrentProject)).ToList(); _attributeGroups.Clear(); var groups = (from att in _allAttributes where !string.IsNullOrEmpty(att.Group) select att.Group).Distinct(); _attributeGroups.AddRange(groups); InitAttributeTypes(); InitAttributeGroups(); _checkedAttributes.Clear(); if (attributeExclusions != null) { _checkedAttributes = attributeExclusions; } InitDgv(); FrmWaitScreen.HideMessage(waitKey); }
private void SaveChangesToDb() { var waitKey = FrmWaitScreen.ShowMessage("Waiting for workers to finish"); if (!Monitor.TryEnter(Instance.UpdateNodeWorkerSyncRoot, TimeSpan.FromSeconds(1))) // || //!Monitor.TryEnter(Instance.UpdateDefinitionWorkerSyncRoot, TimeSpan.FromSeconds(1)) || //!Monitor.TryEnter(Instance.UpdateEnrichmentsWorkerSyncRoot, TimeSpan.FromSeconds(1))) { Forms.TreeForm.taxonomyTree.AbortWorkers(); Monitor.Enter(Instance.UpdateNodeWorkerSyncRoot); //Monitor.Enter(Instance.UpdateDefinitionWorkerSyncRoot); //Monitor.Enter(Instance.UpdateEnrichmentsWorkerSyncRoot); } try { FrmWaitScreen.UpdateMessage(waitKey, "Saving"); SubmitAllChanges(); } finally { Monitor.Exit(Instance.UpdateNodeWorkerSyncRoot); //Monitor.Exit(Instance.UpdateDefinitionWorkerSyncRoot); //Monitor.Exit(Instance.UpdateEnrichmentsWorkerSyncRoot); Forms.TreeForm.taxonomyTree.TryStartWorkers(); } FrmWaitScreen.HideMessage(waitKey); }
private void StoreImage(string localName) { if (!String.IsNullOrEmpty(RemoteImageGuid)) { Guid waitkey = FrmWaitScreen.ShowMessage("Uploading image..."); string remoteDest = RemoteRoot + _projectId + "/" + RemoteImageGuid + OriginalImageExtension; var ftp = new Ftp(FtpHost, User, Pass); ftp.CreateDirectory(RemoteRoot + _projectId); ftp.Upload(remoteDest, localName); FrmWaitScreen.HideMessage(waitkey); } }
// Public Methods (1) public void UpdateTitleAndStatus() { if (mainTabControl.TabPages.Count == 0) { Close(); return; } foreach (TabPage tab in mainTabControl.TabPages) { if (AryaTools.Instance.Forms.SkuTabs.ContainsKey(tab)) { AryaTools.Instance.Forms.SkuTabs[tab].ShortcutKeysEnabled = false; } } Text = @"SKU View"; if (mainTabControl.SelectedTab != null && AryaTools.Instance.Forms.SkuTabs.ContainsKey(mainTabControl.SelectedTab)) { Text += @" - " + mainTabControl.SelectedTab.Text; AryaTools.Instance.Forms.SkuTabs[mainTabControl.SelectedTab].ShortcutKeysEnabled = true; btnClose.Visible = mainTabControl.TabCount > 0; Rectangle rectangle = mainTabControl.GetTabRect(mainTabControl.SelectedIndex); btnClose.Location = rectangle.Location; } //Show wait screen if loading skus int tabsToLoad = AryaTools.Instance.Forms.SkuForm.LoadQueue.Count; if (tabsToLoad > 0) { if (_skuLoadWaitKey == null) { _skuLoadWaitKey = FrmWaitScreen.ShowMessage("Loading SKUs"); } else { FrmWaitScreen.UpdateMessage( (Guid)_skuLoadWaitKey, string.Format("Loading SKUs: {0} tab{1}", tabsToLoad, tabsToLoad > 1 ? "s" : "")); } } else { if (_skuLoadWaitKey != null) { FrmWaitScreen.HideMessage((Guid)_skuLoadWaitKey); _skuLoadWaitKey = null; } } }
private void FrmAttributeBuilder_FormClosing(object sender, FormClosingEventArgs e) { _abortWorker = true; if (_workerThread == null || !_workerThread.IsAlive) { return; } var waitkey = FrmWaitScreen.ShowMessage("Please wait..."); _workerThread.Join(); FrmWaitScreen.HideMessage(waitkey); }
private void PopulateLov(bool overwrite) { // determine location Attribute attribute = SchemaInfo.Attribute; TaxonomyInfo taxonomy = SchemaInfo.TaxonomyInfo; Guid waitkey = FrmWaitScreen.ShowMessage(string.Format("Populating LOVs - {0} - {1}", taxonomy.NodeName, attribute.AttributeName)); // get values from database var listOfValues = GetLovs(attribute, taxonomy); SchemaInfo schemaInfo = taxonomy.SchemaInfos.FirstOrDefault(si => si.Attribute.Equals(attribute)); if (schemaInfo != null) { if (overwrite) { // assign database values to list of values schemaInfo.ActiveListOfValues = listOfValues; } else { // compare current list of values to database and add // missing database values to list of values var currentLov = schemaInfo.ActiveListOfValues.ToList(); foreach (var lov in listOfValues) { if (!currentLov.Contains(lov)) { currentLov.Add(lov); } } schemaInfo.ActiveListOfValues = currentLov; } } // save new list of values AryaTools.Instance.SaveChangesIfNecessary(false, false); FrmWaitScreen.HideMessage(waitkey); // refresh list of values form AryaTools.Instance.Forms.ListofValuesForm.SchemaInfo = schemaInfo; }
private void InitDgv() { var waitKey = FrmWaitScreen.ShowMessage("Populating Grid View"); var atts = FilteredAttributes; if (_sortBy != null) { switch (_sortBy) { case ColumnAttributeName: atts = _sortAscending ? atts.OrderBy(a => a.AttributeName) : atts.OrderByDescending(a => a.AttributeName); break; case ColumnAttributeType: atts = _sortAscending ? atts.OrderBy(a => a.AttributeType) : atts.OrderByDescending(a => a.AttributeType); break; case ColumnAttributeGroup: atts = _sortAscending ? atts.OrderBy(a => a.Group) : atts.OrderByDescending(a => a.Group); break; case "ImageCheckBox": atts = _sortAscending ? atts.OrderBy(a => a, new AttributeCheckBoxSort(_checkedAttributes)) : atts.OrderByDescending(a => a, new AttributeCheckBoxSort(_checkedAttributes)); break; } } _visibleAttributes = atts.ToList(); dgvAttributes.RowCount = _visibleAttributes.Count + 1; //AttributeColumn dgvAttributes.Columns[1].DefaultCellStyle = DisplayStyle.CellStyleAttributeColumn; dgvAttributes.Invalidate(); FrmWaitScreen.HideMessage(waitKey); }
private void SetAttributeName(string value) { if (Entities == null || (value == Attribute.AttributeName)) { return; } if (string.IsNullOrWhiteSpace(value)) { MessageBox.Show(@"AttributeName cannot be renamed to blank"); return; } if (Attribute.Type.ToString().Contains("Meta") || Attribute.Type == AttributeTypeEnum.Workflow) { MessageBox.Show(string.Format("{0} attributes cannot be renamed", Attribute.Type)); return; } var oldAttribute = Attribute; var newAtt = Attribute.GetAttributeFromName(value, true, Attribute.Type); if (newAtt.Type != oldAttribute.Type) { MessageBox.Show(string.Format("{0} attribute cannot be renamed to a {1} type.", Attribute.Type, newAtt.Type)); return; } var waitkey = FrmWaitScreen.ShowMessage("Renaming attribute"); UpdateDerivedAttributeExpressions(newAtt, oldAttribute); UpdateEntities(newAtt, waitkey); _schemaDatas = null; //Recompute the SchemaDatas! Attribute = newAtt; AryaTools.Instance.SaveChangesIfNecessary(false, false); FrmWaitScreen.HideMessage(waitkey); }
void ChangeTaxonomy(TaxonomyInfo currentTaxonomy, bool moveBlanks, Stack <EntityDataGridView.ChangeItem> undoHistory) { var waitkey = FrmWaitScreen.ShowMessage("Moving SKUs"); var newTaxonomy = NewValues.Tax; var changeId = Guid.NewGuid(); if (currentTaxonomy != null && !newTaxonomy.SchemaInfos.SelectMany(si => si.SchemaDatas).Any(sd => sd.Active) && currentTaxonomy.SchemaInfos.SelectMany(si => si.SchemaDatas).Any(sd => sd.Active)) { if (MessageBox.Show( @"The selected Destination node does not have an existing schema, do you wish it to be created from the Source Taxonomy?", @"Empty Schema", MessageBoxButtons.YesNo) == DialogResult.Yes) { FrmWaitScreen.UpdateMessage(waitkey, "Copying Schema"); var sourceSchemaDataList = currentTaxonomy.SchemaInfos.Where(si => si.SchemaData != null).Select(si => si.SchemaData).ToList(); CopySchema(sourceSchemaDataList, newTaxonomy); } } else if (currentTaxonomy != null && newTaxonomy.SchemaInfos.SelectMany(si => si.SchemaDatas).Any(sd => sd.Active) && currentTaxonomy.SchemaInfos.SelectMany(si => si.SchemaDatas).Any(sd => sd.Active)) { //Schema Append Process if (MessageBox.Show( string.Format("The selected destination node has an existing schema. Do you want to append additional schema attributes from the source node to the destination node? {0}{0}NOTE: Rank order of the appended schema attributes will be preserved and placed at the end of the existing schema.", Environment.NewLine), @"Append Schema", MessageBoxButtons.YesNo) == DialogResult.Yes) { FrmWaitScreen.UpdateMessage(waitkey, "Copying Schema"); var sourceAttributeList = currentTaxonomy.SchemaInfos.Where(si => si.SchemaData != null).Select( si => si.Attribute).Except ( newTaxonomy.SchemaInfos.Where(si => si.SchemaData != null).Select(si => si.Attribute) ).ToList(); var sourceSchemaDataList = currentTaxonomy.SchemaInfos.Where(si => sourceAttributeList.Contains(si.Attribute)).Select( si => si.SchemaData).ToList(); CopySchema(sourceSchemaDataList, newTaxonomy, true); } } int skuCount = 0; var resetTaxonomies = new List <TaxonomyInfo> { newTaxonomy }; var skus = GetSkus().Union(moveBlanks ? GetBlanks() : new List <Sku>()).ToList(); foreach (var sku in skus) { FrmWaitScreen.UpdateMessage(waitkey, string.Format("Moving SKUs ({0} of {1})", ++skuCount, skus.Count)); var currentSku = sku; // Make existing SkuInfos Inactive var oldSkuInfo = currentSku.SkuInfos.FirstOrDefault(si => si.Active); if (oldSkuInfo != null) { oldSkuInfo.Active = false; resetTaxonomies.Add(oldSkuInfo.TaxonomyInfo); } // Create a new SkuInfo var newSkuInfo = new SkuInfo { TaxonomyInfo = newTaxonomy }; currentSku.SkuInfos.Add(newSkuInfo); // Add these two to change history for Undo if (undoHistory != null) { undoHistory.Push(new EntityDataGridView.ChangeItem(oldSkuInfo, newSkuInfo, changeId)); } } resetTaxonomies.Distinct().ForEach(AryaTools.Instance.Forms.TreeForm.taxonomyTree.ResetSkuCount); FrmWaitScreen.HideMessage(waitkey); }
private void TryLoadLovs() { if (!ShowLovs || dgvAttributes.CurrentCell == null) { return; } var currentAttribute = ((AttributeColumn)dgvAttributes.CurrentCell.OwningRow.DataBoundItem).Attribute; if (currentAttribute == null || (_currentLovAttribute != null && _currentLovAttribute == currentAttribute)) { return; } _currentLovAttribute = currentAttribute; var waitKey = FrmWaitScreen.ShowMessage(string.Format("Generating List of Values for {0}", currentAttribute.AttributeName)); if (rbAllLovs.Checked) { // this query must go ToList(), otherwise the results are not case sensitive. var loadQuery = (from ei in _entities join ed in AryaTools.Instance.InstanceData.Dc.EntityDatas on ei.ID equals ed.EntityID where ed.AttributeID == currentAttribute.ID && ed.Active select ed).ToList(); var temp = (from ed in loadQuery group ed by new { ed.Value, ed.Uom } into grp orderby grp.Key.Value select new Lov(grp.Key.Value, grp.Key.Uom, grp.Select(ed => ed.EntityInfo))); _dsListOfValues = temp.ToList(); dgvListOfValues.DataSource = _dsListOfValues; } else if (rbInschemaLovs.Checked) { var inSchemaTaxonomies = _dsAttributes.First(ac => ac.Attribute.Equals(currentAttribute)) ._schemaDatas.Where(sd => sd.InSchema) .Select(sd => sd.SchemaInfo.TaxonomyID) .ToList(); // this query must go ToList(), otherwise the results are not case sensitive. var loadQuery = (from ei in _entities join ed in AryaTools.Instance.InstanceData.Dc.EntityDatas on ei.ID equals ed.EntityID join si in AryaTools.Instance.InstanceData.Dc.SkuInfos on ei.SkuID equals si.SkuID where ed.AttributeID == currentAttribute.ID && ed.Active && si.Active && inSchemaTaxonomies.Contains(si.TaxonomyID) select ed).ToList(); var temp = (from ed in loadQuery group ed by new { ed.Value, ed.Uom } into grp orderby grp.Key.Value select new Lov(grp.Key.Value, grp.Key.Uom, grp.Select(ed => ed.EntityInfo))); _dsListOfValues = temp.ToList(); dgvListOfValues.DataSource = _dsListOfValues; } FrmWaitScreen.HideMessage(waitKey); }
private void LoadTaxonomy(List <TaxonomyInfo> taxonomies) { var waitkey = FrmWaitScreen.ShowMessage("Generating list of nodes to open"); var nodesToLoad = new List <TaxonomyInfo>(); //Vivek - not sure why we need this if (taxonomies.Count == 1 && CurrentView == AryaView.SkuView) { var nodeType = taxonomies.Single().NodeType; if (nodeType == "Derived") { Query.DisplayCrossListInSkuView(Query.FetchCrossListObject(taxonomies.Single())); FrmWaitScreen.HideMessage(waitkey); return; } } taxonomies.ForEach( tax => nodesToLoad.AddRange(tax.GetNodes(IncludeChildren, CurrentView == AryaView.SchemaView))); if (nodesToLoad.Count == 0) { FrmWaitScreen.HideMessage(waitkey); MessageBox.Show("There are no SKUs to load.", "Zero SKUs"); return; } if (nodesToLoad.Count > 2000) { FrmWaitScreen.HideMessage(waitkey); MessageBox.Show("A database limit does not allow me to load more than 2000 nodes at once.", "Too many nodes"); return; } FrmWaitScreen.HideMessage(waitkey); // Now generate the name to be shown on the tab string tabName, fullTaxList; FrmSchemaView.GetTabName(taxonomies, nodesToLoad, out tabName, out fullTaxList); Program.WriteToErrorFile( string.Format("{0} Opening: {1} in {2} in {3}", DateTime.Now.ToShortTimeString(), tabName, (LoadToOneTab ? "one tab" : "separate tabs"), CurrentView), true); if (LoadToOneTab || CurrentView == AryaView.AttributeView) { TaxonomyInfo currentTaxonomy = null; if (nodesToLoad.Count == 1) { currentTaxonomy = nodesToLoad.First(); } switch (CurrentView) { //case AryaView.SkuView: // // TODO: Rewrite load function in Sku View and Attribute View to be able to accept multiple taxonomy nodes // break; case AryaView.SchemaView: AryaTools.Instance.Forms.SchemaForm.LoadTab(nodesToLoad.Cast <object>().ToList(), null); break; //case AryaView.BuildView: // // MessageBox.Show("Under Construction"); // AryaTools.Instance.BuildForm.LoadTab(nodesToLoad.Cast<object>().ToList(), null); // break; default: // Get the list of SKUs var nodesToLoadTaxonomIds = nodesToLoad.Select(p => p.ID).ToList(); switch (CurrentView) { case AryaView.SkuView: { var skuQuery = from si in AryaTools.Instance.InstanceData.Dc.SkuInfos where si.Active && nodesToLoadTaxonomIds.Contains(si.TaxonomyID) && si.Sku.SkuType == Framework.Data.AryaDb.Sku.ItemType.Product.ToString() select si.Sku; AryaTools.Instance.Forms.SkuForm.LoadTab(skuQuery, currentTaxonomy, tabName, fullTaxList); break; } case AryaView.AssetView: { var skuQuery = from si in AryaTools.Instance.InstanceData.Dc.SkuInfos where si.Active && nodesToLoadTaxonomIds.Contains(si.TaxonomyID) && si.Sku.SkuType == Framework.Data.AryaDb.Sku.ItemType.EnrichmentImage.ToString() select si.Sku; AryaTools.Instance.Forms.SkuForm.LoadTab(skuQuery, currentTaxonomy, tabName, fullTaxList); break; } case AryaView.AttributeView: //IQueryable<EntityInfo> entityInfoQuery = from ed in AryaTools.Instance.InstanceData.Dc.EntityDatas // join ei in AryaTools.Instance.InstanceData.Dc.EntityInfos on ed.EntityID equals // ei.ID // join si in AryaTools.Instance.InstanceData.Dc.SkuInfos on ei.SkuID equals si.SkuID // where // ed.Active && si.Active && // nodesToLoadTaxonomIds.Contains(si.TaxonomyID) // select ei; //IQueryable<EntityInfo> entityInfoQuery = from ed in AryaTools.Instance.InstanceData.Dc.EntityDatas // join ei in AryaTools.Instance.InstanceData.Dc.EntityInfos on ed.EntityID equals // ei.ID // join si in AryaTools.Instance.InstanceData.Dc.SkuInfos on ei.SkuID equals si.SkuID // where // ed.Active && si.Active // select ei; //clone the nodesToList collection to remove dependency AryaTools.Instance.Forms.AttributeView.LoadQuery(tabName, nodesToLoad.ToList()); break; case AryaView.SchemaView: //Wonder how control got here!!!? break; } break; } } else // load in separate tabs { var result = DialogResult.None; foreach (var tax in nodesToLoad) { var currentTaxonomy = tax; if (nodesToLoad.Count <= AryaTools.Instance.InstanceData.CurrentUserProjectsPreferences.TabsThreshold) { switch (CurrentView) { case AryaView.SchemaView: AryaTools.Instance.Forms.SchemaForm.LoadTab(new List <object> { currentTaxonomy }, null); break; default: switch (CurrentView) { case AryaView.SkuView: { var skuQuery = AryaTools.Instance.InstanceData.Dc.SkuInfos.Where( si => si.Active && si.Sku.SkuType == Framework.Data.AryaDb.Sku.ItemType.Product.ToString() && si.TaxonomyID == tax.ID).Select(si => si.Sku); AryaTools.Instance.Forms.SkuForm.LoadTab(skuQuery, tax, currentTaxonomy.TaxonomyData.NodeName, tax.ToString()); break; } case AryaView.AssetView: { var skuQuery = AryaTools.Instance.InstanceData.Dc.SkuInfos.Where( si => si.Active && si.Sku.SkuType == Framework.Data.AryaDb.Sku.ItemType.EnrichmentImage.ToString() && si.TaxonomyID == currentTaxonomy.ID).Select(si => si.Sku); AryaTools.Instance.Forms.SkuForm.LoadTab(skuQuery, currentTaxonomy, currentTaxonomy.TaxonomyData.NodeName, currentTaxonomy.ToString()); break; } case AryaView.AttributeView: { // TODO: Check attribute view over... var skuQuery = AryaTools.Instance.InstanceData.Dc.SkuInfos.Where( si => si.Active && si.Sku.SkuType == Framework.Data.AryaDb.Sku.ItemType.Product.ToString() && si.TaxonomyID == currentTaxonomy.ID).Select(si => si.Sku); AryaTools.Instance.Forms.AttributeView.LoadQuery(skuQuery, currentTaxonomy.TaxonomyData.NodeName); break; } case AryaView.SchemaView: //Wonder how control got here!!!? break; } //end of switch inner break; // Load only the first Node }//end of switch outer } //end: foreach node in the list of nodes to load else { var sModalText = String.Format( "You have chosen to open {0} nodes in separate tabs. This may take some time. Do you still want to open these nodes?", nodesToLoad.Count); Invoke( (MethodInvoker) delegate { result = MessageBox.Show(this, sModalText, "Alert", MessageBoxButtons.YesNo); }); if (result == DialogResult.No) { break; } else { foreach (var taxonomy in nodesToLoad) { currentTaxonomy = taxonomy; switch (CurrentView) { case AryaView.SkuView: { var skuQuery = AryaTools.Instance.InstanceData.Dc.SkuInfos.Where( si => si.Active && si.Sku.SkuType == Framework.Data.AryaDb.Sku.ItemType.Product.ToString() && si.TaxonomyID == currentTaxonomy.ID).Select(si => si.Sku); AryaTools.Instance.Forms.SkuForm.LoadTab(skuQuery, currentTaxonomy, currentTaxonomy.TaxonomyData.NodeName, currentTaxonomy.ToString()); break; } case AryaView.SchemaView: { AryaTools.Instance.Forms.SchemaForm.LoadTab(new List <object> { currentTaxonomy }, null); break; } } } } break; } } } //end: load in one tab vs. load in separate tabs }
private void ApplySkuLinkFilters(bool queryDatabase) { //Cannot use LinkedFrom and LinkedTo //Using Sku and Sku1 (repectively) instead var waitkey = FrmWaitScreen.ShowMessage("Applying Filter"); dgvSkuLinks.DataSource = null; dgvSkuLinks.Invalidate(); _filteredSkuLinks = null; lblLeftTaxonomy.Text = @"No Filter Applied"; lblRightTaxonomy.Text = @"No Filter Applied"; if ((LeftTaxonomyFilters == null || LeftTaxonomyFilters.Count == 0) && (RightTaxonomyFilters == null || RightTaxonomyFilters.Count == 0)) { FrmWaitScreen.HideMessage(waitkey); return; } var skuLinks = AryaTools.Instance.InstanceData.Dc.SkuLinks.Where(sl => sl.Active); if (LeftTaxonomyFilters != null && LeftTaxonomyFilters.Count > 0) { lblLeftTaxonomy.Text = LeftTaxonomyFilters.Count == 1 ? string.Format("Taxonomy is [{0}]", LeftTaxonomyFilters[0]) : string.Format( "Taxonomy is one of the {0} selected nodes", LeftTaxonomyFilters.Count); List <Guid> taxIds = LeftTaxonomyFilters.Select(tf => tf.ID).ToList(); if (LeftIncludeChildren) { LeftTaxonomyFilters.ForEach(tax => taxIds.AddRange(tax.AllChildren.Select(t => t.ID))); lblLeftTaxonomy.Text += @" and its child nodes"; } skuLinks = from sl in skuLinks //let tax = sl.LinkedFrom.Taxonomy.ID let tax = sl.Sku.SkuInfos.Where(si => si.Active).Select(si => si.TaxonomyID).FirstOrDefault() where taxIds.Contains(tax) select sl; } if (RightTaxonomyFilters != null && RightTaxonomyFilters.Count > 0) { lblRightTaxonomy.Text = RightTaxonomyFilters.Count == 1 ? string.Format("Taxonomy is [{0}]", RightTaxonomyFilters[0]) : string.Format( "Taxonomy is one of the {0} selected nodes", RightTaxonomyFilters.Count); List <Guid> taxIds = RightTaxonomyFilters.Select(tf => tf.ID).ToList(); if (RightIncludeChildren) { RightTaxonomyFilters.ForEach(tax => taxIds.AddRange(tax.AllChildren.Select(t => t.ID))); lblRightTaxonomy.Text += @" and its child nodes"; } skuLinks = from sl in skuLinks //let tax = sl.LinkedTo.Taxonomy.ID let tax = sl.Sku1.SkuInfos.Where(si => si.Active).Select(si => si.TaxonomyID).FirstOrDefault() where taxIds.Contains(tax) select sl; } if (!string.IsNullOrEmpty(txtFilterSkuLinkType.Text)) { skuLinks = from sl in skuLinks where sl.LinkType.Equals(txtFilterSkuLinkType.Text) select sl; } if (queryDatabase) { _filteredSkuLinks = (from sl in skuLinks select new FilteredSkuLink { LeftSku = sl.Sku, LeftTaxonomy = sl.Sku.Taxonomy, RightSku = sl.Sku1, RightTaxonomy = sl.Sku1.Taxonomy }).ToList(); dgvSkuLinks.DataSource = _filteredSkuLinks; dgvSkuLinks.Invalidate(); } FrmWaitScreen.HideMessage(waitkey); }