public static ALMDefectProfile SetALMDefectProfileWithDefaultValues(string name = null) { ALMDefectProfile newALMDefectProfile = new ALMDefectProfile(); if ((WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ALMDefectProfile>() != null) && (WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ALMDefectProfile>().Count > 0)) { newALMDefectProfile.ID = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ALMDefectProfile>().Max(x => x.ALMDefectProfilesSeq) + 1; } else { newALMDefectProfile.ID = 1; } if ((name != null) && (name != string.Empty)) { newALMDefectProfile.Name = name; } else { newALMDefectProfile.Name = "Template #" + newALMDefectProfile.ID; } newALMDefectProfile.IsDefault = true; newALMDefectProfile.ShowAllIterationsElements = false; newALMDefectProfile.UseLocalStoredStyling = false; newALMDefectProfile.Description = string.Empty; return(newALMDefectProfile); }
private void RefreshgrdDefectsFieldsHandler(object sender, RoutedEventArgs e) { ALMDefectProfile AlmDefectProfile = (ALMDefectProfile)grdDefectsProfiles.CurrentItem; { mALMDefectProfileFields = FetchDefectFields(AlmDefectProfile.AlmType); mALMDefectProfileFields.Where(z => z.Mandatory).ToList().ForEach(x => x.SelectedValue = string.Empty); mALMDefectProfileFieldsExisted = new ObservableList <ExternalItemFieldBase>(); foreach (ExternalItemFieldBase aLMDefectProfileField in mALMDefectProfileFields) { ExternalItemFieldBase aLMDefectProfileFieldExisted = (ExternalItemFieldBase)aLMDefectProfileField.CreateCopy(); if (!string.IsNullOrEmpty(aLMDefectProfileField.ExternalID)) { aLMDefectProfileFieldExisted.ExternalID = string.Copy(aLMDefectProfileField.ExternalID); } ExternalItemFieldBase field = AlmDefectProfile.ALMDefectProfileFields.Where(x => x.ID == aLMDefectProfileField.ID).FirstOrDefault(); if (field != null) { aLMDefectProfileFieldExisted.SelectedValue = field.SelectedValue; } aLMDefectProfileFieldExisted.PossibleValues = aLMDefectProfileField.PossibleValues; mALMDefectProfileFieldsExisted.Add(aLMDefectProfileFieldExisted); } AlmDefectProfile.ALMDefectProfileFields = mALMDefectProfileFieldsExisted; } }
private void FetchgrdDefectsFieldsHandler(object sender, RoutedEventArgs e) { ALMDefectProfile AlmDefectProfile = (ALMDefectProfile)grdDefectsProfiles.CurrentItem; AlmDefectProfile.ALMDefectProfileFields = FetchDefectFields(AlmDefectProfile.AlmType); grdDefectsFields.DataSourceList = AlmDefectProfile.ALMDefectProfileFields; }
private void AddDefectsProfile(object sender, RoutedEventArgs e) { ALMDefectProfile newALMDefectProfile = new ALMDefectProfile(); newALMDefectProfile.ToUpdate = true; if (mALMDefectProfiles.Count == 0) { newALMDefectProfile.IsDefault = true; newALMDefectProfile.ID = 1; } else { newALMDefectProfile.ID = mALMDefectProfiles.Select(x => x.ID).Max() + 1; newALMDefectProfile.IsDefault = false; } newALMDefectProfile.Name = "Some Name " + (newALMDefectProfile.ID + 1).ToString(); newALMDefectProfile.Description = "Some Description " + (newALMDefectProfile.ID + 1).ToString(); ALMConfig AlmConfig = ALMCore.GetDefaultAlmConfig(); newALMDefectProfile.AlmType = AlmConfig.AlmType; mALMDefectProfiles.Add(newALMDefectProfile); newALMDefectProfile.ALMDefectProfileFields = FetchDefectFields(newALMDefectProfile.AlmType); newALMDefectProfile.ALMDefectProfileFields.Where(z => z.Mandatory).ToList().ForEach(x => x.SelectedValue = string.Empty); grdDefectsProfiles.Grid.SelectionChanged += grdDefectsProfiles_SelectionChanged; grdDefectsProfiles.DataSourceList = mALMDefectProfiles; grdDefectsFields.DataSourceList = newALMDefectProfile.ALMDefectProfileFields; grdDefectsProfiles.Grid.SelectedItem = newALMDefectProfile; }
public override void Execute(ReportInfo RI) { if ((WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList != null) && (WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Count > 0)) { Dictionary <Guid, Dictionary <string, string> > defectsForOpening = new Dictionary <Guid, Dictionary <string, string> >(); ObservableList <ALMDefectProfile> ALMDefectProfiles = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ALMDefectProfile>(); ALMDefectProfile defaultALMDefectProfile = new ALMDefectProfile(); if ((ALMDefectProfiles != null) && (ALMDefectProfiles.Count > 0)) { defaultALMDefectProfile = ALMDefectProfiles.Where(z => z.ID == SelectedDefectsProfileID).ToList().FirstOrDefault(); if (defaultALMDefectProfile == null) { defaultALMDefectProfile = ALMDefectProfiles.Where(z => z.IsDefault).ToList().FirstOrDefault(); if (defaultALMDefectProfile == null) { defaultALMDefectProfile = ALMDefectProfiles.FirstOrDefault(); } } } if (DefectsOpeningModeForMarked) { foreach (DefectSuggestion defectSuggestion in WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Where(x => x.AutomatedOpeningFlag == true).ToList()) { Dictionary <string, string> currentALMDefectFieldsValues = defaultALMDefectProfile.ALMDefectProfileFields.Where(z => (z.SelectedValue != null && z.SelectedValue != string.Empty) || z.ExternalID == "description" || z.ExternalID == "Summary" || z.ExternalID == "name").ToDictionary(x => x.ExternalID, x => x.SelectedValue != null ? x.SelectedValue.Replace("&", "&") : x.SelectedValue = string.Empty) .ToDictionary(w => w.Key, w => w.Key == "description" ? defectSuggestion.Description : w.Value) .ToDictionary(w => w.Key, w => w.Key == "Summary" ? defectSuggestion.Summary : w.Value) .ToDictionary(w => w.Key, w => w.Key == "name" ? defectSuggestion.Summary : w.Value); defectsForOpening.Add(defectSuggestion.DefectSuggestionGuid, currentALMDefectFieldsValues); } } else if (DefectsOpeningModeForAll) { foreach (DefectSuggestion defectSuggestion in WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList) { Dictionary <string, string> currentALMDefectFieldsValues = defaultALMDefectProfile.ALMDefectProfileFields.Where(z => (z.SelectedValue != null && z.SelectedValue != string.Empty) || z.ExternalID == "description" || z.ExternalID == "Summary" || z.ExternalID == "name").ToDictionary(x => x.ExternalID, x => x.SelectedValue != null ? x.SelectedValue.Replace("&", "&") : x.SelectedValue = string.Empty) .ToDictionary(w => w.Key, w => w.Key == "description" ? defectSuggestion.Description : w.Value) .ToDictionary(w => w.Key, w => w.Key == "Summary" ? defectSuggestion.Summary : w.Value) .ToDictionary(w => w.Key, w => w.Key == "name" ? defectSuggestion.Summary : w.Value); defectsForOpening.Add(defectSuggestion.DefectSuggestionGuid, currentALMDefectFieldsValues); } } else { return; } var defectFields = defaultALMDefectProfile.ALMDefectProfileFields.Where(a => a.Mandatory || a.ToUpdate).ToList(); RepositoryItemHelper.RepositoryItemFactory.CreateNewALMDefects(defectsForOpening, defectFields); } }
private void AddDefectsProfile(object sender, RoutedEventArgs e) { Mouse.OverrideCursor = Cursors.Wait; ALMDefectProfile newALMDefectProfile = new ALMDefectProfile(); newALMDefectProfile.ToUpdate = true; if (mALMDefectProfiles.Count == 0) { newALMDefectProfile.IsDefault = true; newALMDefectProfile.ID = 1; } else { newALMDefectProfile.ID = mALMDefectProfiles.Select(x => x.ID).Max() + 1; newALMDefectProfile.IsDefault = false; } newALMDefectProfile.Name = "Some Name " + (newALMDefectProfile.ID + 1).ToString(); newALMDefectProfile.Description = "Some Description " + (newALMDefectProfile.ID + 1).ToString(); mALMDefectProfiles.Add(newALMDefectProfile); // mALMDefectProfileFields.ToList().ForEach(x => newALMDefectProfile.ALMDefectProfileFields.Add((ExternalItemFieldBase)x.CreateCopy())); mALMDefectProfileFieldsExisted = new ObservableList <ExternalItemFieldBase>(); foreach (ExternalItemFieldBase aLMDefectProfileField in mALMDefectProfileFields) { ExternalItemFieldBase aLMDefectProfileFieldExisted = (ExternalItemFieldBase)aLMDefectProfileField.CreateCopy(); if (!string.IsNullOrEmpty(aLMDefectProfileField.ExternalID)) { aLMDefectProfileFieldExisted.ExternalID = string.Copy(aLMDefectProfileField.ExternalID); } aLMDefectProfileFieldExisted.PossibleValues = aLMDefectProfileField.PossibleValues; mALMDefectProfileFieldsExisted.Add(aLMDefectProfileFieldExisted); } newALMDefectProfile.ALMDefectProfileFields = mALMDefectProfileFieldsExisted; grdDefectsProfiles.DataSourceList = mALMDefectProfiles; grdDefectsFields.DataSourceList = newALMDefectProfile.ALMDefectProfileFields; Mouse.OverrideCursor = null; }
public override void Execute(ReportInfo RI) { if ((App.RunsetExecutor.DefectSuggestionsList != null) && (App.RunsetExecutor.DefectSuggestionsList.Count > 0)) { Dictionary <Guid, Dictionary <string, string> > defectsForOpening = new Dictionary <Guid, Dictionary <string, string> >(); ObservableList <ALMDefectProfile> ALMDefectProfiles = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ALMDefectProfile>(); ALMDefectProfile defaultALMDefectProfile = new ALMDefectProfile(); if ((ALMDefectProfiles != null) && (ALMDefectProfiles.Count > 0)) { defaultALMDefectProfile = ALMDefectProfiles.Where(z => z.ID == SelectedDefectsProfileID).ToList().FirstOrDefault(); if (defaultALMDefectProfile == null) { defaultALMDefectProfile = ALMDefectProfiles.Where(z => z.IsDefault).ToList().FirstOrDefault(); if (defaultALMDefectProfile == null) { defaultALMDefectProfile = ALMDefectProfiles.FirstOrDefault(); } } } if (DefectsOpeningModeForMarked) { foreach (DefectSuggestion defectSuggestion in App.RunsetExecutor.DefectSuggestionsList.Where(x => x.AutomatedOpeningFlag == true).ToList()) { Dictionary <string, string> currentALMDefectFieldsValues = defaultALMDefectProfile.ALMDefectProfileFields.Where(z => (z.SelectedValue != null && z.SelectedValue != string.Empty) || z.ExternalID == "description" || z.ExternalID == "Summary" || z.ExternalID == "name").ToDictionary(x => x.ExternalID, x => x.SelectedValue != null ? x.SelectedValue.Replace("&", "&") : x.SelectedValue = string.Empty) .ToDictionary(w => w.Key, w => w.Key == "description" ? defectSuggestion.Description : w.Value) .ToDictionary(w => w.Key, w => w.Key == "Summary" ? defectSuggestion.Summary : w.Value) .ToDictionary(w => w.Key, w => w.Key == "name" ? defectSuggestion.Summary : w.Value); defectsForOpening.Add(defectSuggestion.DefectSuggestionGuid, currentALMDefectFieldsValues); } } else if (DefectsOpeningModeForAll) { foreach (DefectSuggestion defectSuggestion in App.RunsetExecutor.DefectSuggestionsList) { Dictionary <string, string> currentALMDefectFieldsValues = defaultALMDefectProfile.ALMDefectProfileFields.Where(z => (z.SelectedValue != null && z.SelectedValue != string.Empty) || z.ExternalID == "description" || z.ExternalID == "Summary" || z.ExternalID == "name").ToDictionary(x => x.ExternalID, x => x.SelectedValue != null ? x.SelectedValue.Replace("&", "&") : x.SelectedValue = string.Empty) .ToDictionary(w => w.Key, w => w.Key == "description" ? defectSuggestion.Description : w.Value) .ToDictionary(w => w.Key, w => w.Key == "Summary" ? defectSuggestion.Summary : w.Value) .ToDictionary(w => w.Key, w => w.Key == "name" ? defectSuggestion.Summary : w.Value); defectsForOpening.Add(defectSuggestion.DefectSuggestionGuid, currentALMDefectFieldsValues); } } else { return; } Dictionary <Guid, string> defectsOpeningResults; if ((defectsForOpening != null) && (defectsForOpening.Count > 0)) { defectsOpeningResults = ALMIntegration.Instance.CreateNewALMDefects(defectsForOpening); } else { return; } if ((defectsOpeningResults != null) && (defectsOpeningResults.Count > 0)) { foreach (KeyValuePair <Guid, string> defectOpeningResult in defectsOpeningResults) { if ((defectOpeningResult.Value != null) && (defectOpeningResult.Value != "0")) { App.RunsetExecutor.DefectSuggestionsList.Where(x => x.DefectSuggestionGuid == defectOpeningResult.Key).ToList().ForEach(z => { z.ALMDefectID = defectOpeningResult.Value; z.IsOpenDefectFlagEnabled = false; }); } } } } }
public override void Execute(ReportInfo RI) { if ((WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList != null) && (WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Count > 0)) { Dictionary <Guid, Dictionary <string, string> > defectsForOpening = new Dictionary <Guid, Dictionary <string, string> >(); ObservableList <ALMDefectProfile> ALMDefectProfiles = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ALMDefectProfile>(); ALMDefectProfile defaultALMDefectProfile = new ALMDefectProfile(); if ((ALMDefectProfiles != null) && (ALMDefectProfiles.Count > 0)) { defaultALMDefectProfile = ALMDefectProfiles.Where(z => z.ID == SelectedDefectsProfileID).ToList().FirstOrDefault(); if (defaultALMDefectProfile == null) { defaultALMDefectProfile = ALMDefectProfiles.Where(z => z.IsDefault).ToList().FirstOrDefault(); if (defaultALMDefectProfile == null) { defaultALMDefectProfile = ALMDefectProfiles.FirstOrDefault(); } } } if (DefectsOpeningModeForMarked) { foreach (DefectSuggestion defectSuggestion in WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.Where(x => x.AutomatedOpeningFlag == true).ToList()) { Dictionary <string, string> currentALMDefectFieldsValues = new Dictionary <string, string>(); try { currentALMDefectFieldsValues = defaultALMDefectProfile.ALMDefectProfileFields.Where(z => (z.SelectedValue != null && z.SelectedValue != string.Empty) || z.ExternalID == "description" || z.ExternalID == "Summary" || z.ExternalID == "name").ToDictionary(x => x.ExternalID, x => x.SelectedValue != null ? x.SelectedValue.Replace("&", "&") : x.SelectedValue = string.Empty) .ToDictionary(w => w.Key, w => w.Key == "description" ? defectSuggestion.ErrorDetails : w.Value) .ToDictionary(w => w.Key, w => w.Key == "Summary" ? defectSuggestion.Summary : w.Value) .ToDictionary(w => w.Key, w => w.Key == "name" ? defectSuggestion.Summary : w.Value); } catch (Exception ex) { currentALMDefectFieldsValues.Add("Summary", defectSuggestion.Summary); currentALMDefectFieldsValues.Add("description", defectSuggestion.ErrorDetails); } currentALMDefectFieldsValues.Add("screenshots", String.Join(",", defectSuggestion.ScreenshotFileNames)); currentALMDefectFieldsValues.Add("ActivityGroupExternalID", defectSuggestion.ActivityGroupExternalID); currentALMDefectFieldsValues.Add("ActivityExternalID", defectSuggestion.ActivityExternalID); currentALMDefectFieldsValues.Add("BFExternalID1", defectSuggestion.BFExternalID.Item1); currentALMDefectFieldsValues.Add("BFExternalID2", defectSuggestion.BFExternalID.Item2); defectsForOpening.Add(defectSuggestion.DefectSuggestionGuid, currentALMDefectFieldsValues); } } else if (DefectsOpeningModeForAll) { foreach (DefectSuggestion defectSuggestion in WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList) { Dictionary <string, string> currentALMDefectFieldsValues = new Dictionary <string, string>(); try { currentALMDefectFieldsValues = defaultALMDefectProfile.ALMDefectProfileFields.Where(z => (z.SelectedValue != null && z.SelectedValue != string.Empty) || z.ExternalID == "description" || z.ExternalID == "Summary" || z.ExternalID == "name").ToDictionary(x => x.ExternalID, x => x.SelectedValue != null ? x.SelectedValue.Replace("&", "&") : x.SelectedValue = string.Empty) .ToDictionary(w => w.Key, w => w.Key == "description" ? defectSuggestion.ErrorDetails : w.Value) .ToDictionary(w => w.Key, w => w.Key == "Summary" ? defectSuggestion.Summary : w.Value) .ToDictionary(w => w.Key, w => w.Key == "name" ? defectSuggestion.Summary : w.Value); } catch (Exception ex) { currentALMDefectFieldsValues.Add("Summary", defectSuggestion.Summary); currentALMDefectFieldsValues.Add("description", defectSuggestion.ErrorDetails); } currentALMDefectFieldsValues.Add("screenshots", String.Join(",", defectSuggestion.ScreenshotFileNames)); currentALMDefectFieldsValues.Add("ActivityGroupExternalID", defectSuggestion.ActivityGroupExternalID); currentALMDefectFieldsValues.Add("ActivityExternalID", defectSuggestion.ActivityExternalID); currentALMDefectFieldsValues.Add("BFExternalID1", defectSuggestion.BFExternalID.Item1); currentALMDefectFieldsValues.Add("BFExternalID2", defectSuggestion.BFExternalID.Item2); defectsForOpening.Add(defectSuggestion.DefectSuggestionGuid, currentALMDefectFieldsValues); } } else { return; } var defectFields = defaultALMDefectProfile.ALMDefectProfileFields.Where(a => a.Mandatory || a.ToUpdate).ToList(); //update alm type to open defect RepositoryItemHelper.RepositoryItemFactory.CreateNewALMDefects(defectsForOpening, defectFields, defaultALMDefectProfile.AlmType); } }