/// <summary> /// Event raised when dependent catalogs are loaded (CC, AssignedTo) /// </summary> private void _catalogues_DependentCataloguesLoadedCompleted(object sender, EventArgs e) { MyLogger.Write("Start!", "_catalogues_DependentCataloguesLoadedCompleted", LoggingCategory.General); this.ccCatalogListCompleted = true; try { //wait until component are filled if (cmbComponent.SelectedValue != null) { string component = cmbComponent.SelectedValue.ToString(); Utils.PopulateContactListForComponent(component, lstCC, cataloguesPerUser.catalogueCC); #region build a list of assignedTo persons for the bug status user control List <string> assignedToList = new List <string>(); foreach (string key in cataloguesPerUser.catalogueAssignedTo.Keys) { if (key == BusinessEntities.Dependencies.NoComponentDependency) { foreach (string item in cataloguesPerUser.catalogueAssignedTo.GetValues(key)) { assignedToList.Add(item); } allowAddingPersonsToCcList = false; break; } } bool isFirst = true; if (assignedToList.Count == 0) { foreach (string key in cataloguesPerUser.catalogueAssignedTo.Keys) { if (key == component) { allowAddingPersonsToCcList = true; if (cataloguesPerUser.catalogueAssignedTo.GetValues(key) != null) { foreach (string item in cataloguesPerUser.catalogueAssignedTo.GetValues(key)) { if (!isFirst) { allowAddingPersonsToCcList = false; assignedToList.Add(item); } else { isFirst = false; } } } break; } } } //for (int i = 0; i < cataloguesPerUser.catalogueAssignedTo.Count; i++) //{ // assignedToList.Add(cataloguesPerUser.catalogueAssignedTo[i].ToString()); //} if (assignedToList.Count == 0 && bugToUpdate.AssignedTo != null) { assignedToList.Add(bugToUpdate.AssignedTo); } //for (int i = 0; i < lstCC.Items.Count ; i++) //{ // listCC.Add(lstCC.Items[i].ToString ()); //} #endregion if (this.ccBugListCompleted && !this.ccCompleted) { this.ccCompleted = true; //complete cc list with ccBugList this.CompleteCcList(bugToUpdate); } if (ucBugStatus == null) { ucBugStatus = new UCBugStatus(cataloguesPerUser.catalogueResolution, bugToUpdate, assignedToList, this); ucBugStatus.Location = new Point(5, 10); grpSel.Controls.Add(ucBugStatus); } cmbComponent.Enabled = true; txtAssignedTo.Enabled = true; cmbVersion.Enabled = true; lstCC.Enabled = true; btnSave.Enabled = true; } } catch (Exception ex) { MyLogger.Write(ex, "EditBug._catalogues_DependentCataloguesLoadedCompleted", LoggingCategory.Exception); } finally { this.gettingProductDependentCatalogsStarted = false; _catalogues.DependentCataloguesLoadedCompleted -= new EventHandler(this._catalogues_DependentCataloguesLoadedCompleted); } }
/// <summary> /// Event raised when dependent catalogs are loaded (CC, AssignedTo) /// </summary> private void _catalogues_DependentCataloguesLoadedCompleted(object sender, EventArgs e) { MyLogger.Write("Start!", "_catalogues_DependentCataloguesLoadedCompleted", LoggingCategory.General); this.ccCatalogListCompleted = true; try { //wait until component are filled if (cmbComponent.SelectedValue != null) { string component = cmbComponent.SelectedValue.ToString(); Utils.PopulateContactListForComponent(component, lstCC, cataloguesPerUser.catalogueCC); #region build a list of assignedTo persons for the bug status user control List<string> assignedToList = new List<string>(); foreach (string key in cataloguesPerUser.catalogueAssignedTo.Keys) { if (key == BusinessEntities.Dependencies.NoComponentDependency) { foreach (string item in cataloguesPerUser.catalogueAssignedTo.GetValues(key)) { assignedToList.Add(item); } allowAddingPersonsToCcList = false; break; } } bool isFirst = true; if (assignedToList.Count == 0) { foreach (string key in cataloguesPerUser.catalogueAssignedTo.Keys) { if (key == component) { allowAddingPersonsToCcList = true; if (cataloguesPerUser.catalogueAssignedTo.GetValues(key) != null) { foreach (string item in cataloguesPerUser.catalogueAssignedTo.GetValues(key)) { if (!isFirst) { allowAddingPersonsToCcList = false; assignedToList.Add(item); } else isFirst = false; } } break; } } } //for (int i = 0; i < cataloguesPerUser.catalogueAssignedTo.Count; i++) //{ // assignedToList.Add(cataloguesPerUser.catalogueAssignedTo[i].ToString()); //} if (assignedToList.Count == 0 && bugToUpdate.AssignedTo != null) assignedToList.Add(bugToUpdate.AssignedTo); //for (int i = 0; i < lstCC.Items.Count ; i++) //{ // listCC.Add(lstCC.Items[i].ToString ()); //} #endregion if (this.ccBugListCompleted && !this.ccCompleted) { this.ccCompleted = true; //complete cc list with ccBugList this.CompleteCcList(bugToUpdate); } if (ucBugStatus == null) { ucBugStatus = new UCBugStatus(cataloguesPerUser.catalogueResolution, bugToUpdate, assignedToList, this); ucBugStatus.Location = new Point(5, 10); grpSel.Controls.Add(ucBugStatus); } cmbComponent.Enabled = true; txtAssignedTo.Enabled = true; cmbVersion.Enabled = true; lstCC.Enabled = true; btnSave.Enabled = true; } } catch (Exception ex) { MyLogger.Write(ex, "EditBug._catalogues_DependentCataloguesLoadedCompleted", LoggingCategory.Exception); } finally { this.gettingProductDependentCatalogsStarted = false; _catalogues.DependentCataloguesLoadedCompleted -= new EventHandler(this._catalogues_DependentCataloguesLoadedCompleted); } }