protected void AddOptions(ListControl list, ListParameterSettings customParameterSettings, ParameterInfo parameterSettings) { // add options from both if necessary if (customParameterSettings.Command.Length > 0) { var connectionString = default(string); if (customParameterSettings.ConnectionId < 0) { // get report set connection var objReportSetController = new ReportSetController(); var objReportSetInfo = objReportSetController.GetReportSet(parameterSettings.ReportSetId); connectionString = objReportSetInfo.ReportSetConnectionString; } else { var objConnectionInfo = ConnectionController.GetConnection(customParameterSettings.ConnectionId); connectionString = objConnectionInfo.ConnectionString; } SQLUtil.AddOptionsFromQuery(list, ReplaceOptionTokens(customParameterSettings.Command), connectionString, customParameterSettings.Default, customParameterSettings.CommandCacheTimeout); } if (customParameterSettings.List.Length > 0) { SQLUtil.AddOptionsFromList(list, customParameterSettings.List, customParameterSettings.Default); } }
/// <summary> /// Метод для підключення до бази даних /// </summary> private JObject Connection() { Dictionary <string, string> values = new Dictionary <string, string>(); values.Add("bd_name", connectionController.Database); values.Add("table_name", connectionController.Table); try { return(jsonParseController.ParseJSON(connectionController.GetConnection(values))); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(new JObject()); }