/// <summary> /// Creates the solution settings. /// </summary> /// <param name="cube">The cube.</param> /// <param name="SolutionId">The solution identifier.</param> /// <returns>Result.</returns> /// <exception cref="Exception"></exception> private static Result CreateSolutionSettings(CubeBase cube, Guid SolutionId) { try { SolutionSettingActions solAct = new SolutionSettingActions(cube); solAct.SolutionId = SolutionId; solAct.Name = "Serial Key"; solAct.Value = "Trial"; Result result = solAct.Create(); if (result.isError) { throw new Exception(result.Message); } return(new Result(false, string.Empty, solAct, cube.LogSystem)); } catch (Exception ex) { return(new Result(true, ex.Message, null, cube.LogSystem)); } }
/// <summary> /// Retrieves the solution settings. /// </summary> /// <param name="cube">The cube.</param> /// <param name="SolutionId">The solution identifier.</param> /// <returns>Result.</returns> /// <exception cref="Exception"></exception> private static Result retrieveSolutionSettings(CubeBase cube, Guid SolutionId) { try { SolutionSettingActions solAct = new SolutionSettingActions(cube); solAct.SolutionId = SolutionId; Result resultSolutionSettings = solAct.GetLicenseItem(); if (resultSolutionSettings.isError) { throw new Exception(resultSolutionSettings.Message); } if (resultSolutionSettings.BusinessObject != null) { Entity e = (Entity)resultSolutionSettings.BusinessObject; SolutionSettingActions ssa = new SolutionSettingActions(cube); if (e.Contains("mwns_name")) { ssa.Name = e["mwns_name"].ToString(); } if (e.Contains("mwns_value")) { ssa.Value = e["mwns_value"].ToString(); } return(new Result(false, string.Empty, ssa, cube.LogSystem)); } else { return(CreateSolutionSettings(cube, SolutionId)); } } catch (Exception ex) { return(new Result(true, ex.Message, null, cube.LogSystem)); } }