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 bool SetDefaultAlmConfig(eALMType AlmType) { //set default on the solution foreach (ALMConfig alm in WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.DefaultAlm).ToList()) { alm.DefaultAlm = false; } ALMConfig almConfig = ALMCore.GetCurrentAlmConfig(AlmType); almConfig.DefaultAlm = true; //set default on almcore foreach (ALMConfig alm in ALMCore.AlmConfigs.Where(x => x.DefaultAlm).ToList()) { alm.DefaultAlm = false; } ALMConfig DefaultAlm = ALMCore.AlmConfigs.FirstOrDefault(x => x.AlmType == AlmType); if (DefaultAlm == null) { DefaultAlm = new ALMConfig(); DefaultAlm.AlmType = AlmType; ALMCore.AlmConfigs.Add(DefaultAlm); } DefaultAlm.DefaultAlm = true; return(true); }
private object UpdateALMType(eALMType almType) { ALMCore almCore = null; ALMConfig CurrentAlmConfigurations = ALMCore.GetCurrentAlmConfig(almType); ALMCore.DefaultAlmConfig = CurrentAlmConfigurations; //Set ALMRepo switch (almType) { case eALMType.Jira: almCore = new JiraCore(); break; case eALMType.ZephyrEnterprise: almCore = new ZephyrEntCore(); break; case eALMType.Octane: almCore = new OctaneCore(); break; default: Reporter.ToLog(eLogLevel.ERROR, $"Invalid ALM Type - {almType}"); break; } return(almCore); }
private void LoadALMDetailsFromJSON(GingerExecConfig gingerExecConfig) { foreach (AlmDetails almDetails in gingerExecConfig.AlmsDetails) { ALMIntegration.eALMType almTypeToConfigure; if (Enum.TryParse <ALMIntegration.eALMType>(almDetails.ALMType, out almTypeToConfigure)) { try { ALMConfig solutionAlmConfig = WorkSpace.Instance.Solution.ALMConfigs.FirstOrDefault(x => x.AlmType == almTypeToConfigure); if (solutionAlmConfig == null) { //ADD solutionAlmConfig = new ALMConfig() { AlmType = almTypeToConfigure }; WorkSpace.Instance.Solution.ALMConfigs.Add(solutionAlmConfig); } ALMUserConfig userProfileAlmConfig = WorkSpace.Instance.UserProfile.ALMUserConfigs.FirstOrDefault(x => x.AlmType == almTypeToConfigure); if (userProfileAlmConfig == null) { //ADD userProfileAlmConfig = new ALMUserConfig() { AlmType = almTypeToConfigure }; WorkSpace.Instance.UserProfile.ALMUserConfigs.Add(userProfileAlmConfig); } if (almDetails.ALMSubType != null) { solutionAlmConfig.JiraTestingALM = (ALMIntegration.eTestingALMType)Enum.Parse(typeof(ALMIntegration.eTestingALMType), almDetails.ALMSubType); } if (almDetails.ServerURL != null) { solutionAlmConfig.ALMServerURL = almDetails.ServerURL; userProfileAlmConfig.ALMServerURL = almDetails.ServerURL; } if (almDetails.User != null) { solutionAlmConfig.ALMUserName = almDetails.User; userProfileAlmConfig.ALMUserName = almDetails.User; } if (almDetails.Password != null) { if (almDetails.PasswordEncrypted) { string pass = EncryptionHandler.DecryptwithKey(almDetails.Password); solutionAlmConfig.ALMPassword = pass; userProfileAlmConfig.ALMPassword = pass; } else { solutionAlmConfig.ALMPassword = almDetails.Password; userProfileAlmConfig.ALMPassword = almDetails.Password; } } if (almDetails.Domain != null) { solutionAlmConfig.ALMDomain = almDetails.Domain; } if (almDetails.Project != null) { solutionAlmConfig.ALMProjectName = almDetails.Project; } if (almDetails.ProjectKey != null) { solutionAlmConfig.ALMProjectKey = almDetails.ProjectKey; } if (almDetails.ConfigPackageFolderPath != null) { solutionAlmConfig.ALMConfigPackageFolderPath = almDetails.ConfigPackageFolderPath; userProfileAlmConfig.ALMConfigPackageFolderPath = almDetails.ConfigPackageFolderPath; } if (almDetails.UseRest != null) { solutionAlmConfig.UseRest = (bool)almDetails.UseRest; } if (almDetails.IsDefault != null) { if (almDetails.IsDefault == true) { //clear previous default ALMConfig currentDefAlm = WorkSpace.Instance.Solution.ALMConfigs.Where(x => x.DefaultAlm == true).FirstOrDefault(); currentDefAlm.DefaultAlm = false; } solutionAlmConfig.DefaultAlm = (bool)almDetails.IsDefault; } } catch (Exception ex) { throw new Exception(string.Format("Failed to load the ALM type: '{0}' details, due to error: '{1}'", almDetails.ALMType, ex.Message), ex); } } else { throw new Exception(string.Format("Failed to find the ALM type: '{0}'", almDetails.ALMType)); } } }