/// <summary> /// Gets a column type appropriate for a .NET data table based off of the dashboard variable type selected by the user /// </summary> /// <param name="dashboardVariableType">The type of variable that is storing the recoded values</param> /// <returns>A string representing the type of a .NET DataColumn</returns> private string GetDestinationColumnType(DashboardVariableType dashboardVariableType) { switch (dashboardVariableType) { case DashboardVariableType.Numeric: return "System.Decimal"; case DashboardVariableType.Date: return "System.DateTime"; case DashboardVariableType.Text: return "System.String"; case DashboardVariableType.YesNo: return "System.Boolean"; case DashboardVariableType.None: throw new ApplicationException(SharedStrings.DASHBOARD_ERROR_INVALID_COLUMN_TYPE); default: return "System.String"; } }
/// <summary> /// Gets a column type appropriate for a .NET data table based off of the dashboard variable type selected by the user /// </summary> /// <param name="dashboardVariableType">The type of variable that is storing the recoded values</param> /// <returns>A string representing the type of a .NET DataColumn</returns> private ColumnDataType GetDestinationColumnType(DashboardVariableType dashboardVariableType) { switch (dashboardVariableType) { case DashboardVariableType.Numeric: return(ColumnDataType.Numeric); case DashboardVariableType.Date: return(ColumnDataType.DateTime); case DashboardVariableType.Text: return(ColumnDataType.Text); case DashboardVariableType.YesNo: return(ColumnDataType.Boolean); case DashboardVariableType.None: throw new Exception(); default: return(ColumnDataType.Text); } }
/// <summary> /// Gets a column type appropriate for a .NET data table based off of the dashboard variable type selected by the user /// </summary> /// <param name="dashboardVariableType">The type of variable that is storing the recoded values</param> /// <returns>A string representing the type of a .NET DataColumn</returns> protected string GetDestinationColumnType(DashboardVariableType dashboardVariableType) { switch (dashboardVariableType) { case DashboardVariableType.Numeric: return("System.Single"); case DashboardVariableType.Text: return("System.String"); case DashboardVariableType.YesNo: return("System.Byte"); case DashboardVariableType.Date: return("System.DateTime"); case DashboardVariableType.None: throw new ApplicationException(SharedStrings.DASHBOARD_ERROR_INVALID_COLUMN_TYPE); default: return("System.String"); } }
/// <summary> /// Constructor /// </summary> /// <param name="dashboardHelper">The dashboard helper to attach</param> /// <param name="friendlyRule">The human-readable version of the rule</param> /// <param name="sourceColumnName">The name of the column from which to read the values</param> /// <param name="destinationColumnName">The name of the column in which the recoded values will reside</param> /// <param name="variableType">The type of variable being created to hold the recoded values</param> /// <param name="recodeInputTable">The table containing the source and destination values that describe how the recode should take place</param> /// <param name="maintainSortOrder">Whether statistics run on the recoded variable should maintain the sort order specified in the recode dialog, if appropriate for that statistic command</param> public Rule_Recode(DashboardHelper dashboardHelper, string friendlyRule, string sourceColumnName, string sourceColumnType, string destinationColumnName, DashboardVariableType variableType, DataTable recodeInputTable, string elseValue, bool maintainSortOrder, bool shouldUseWildcards) { this.dashboardHelper = dashboardHelper; this.friendlyRule = friendlyRule; this.sourceColumnName = sourceColumnName; this.sourceColumnType = sourceColumnType; this.destinationColumnName = destinationColumnName; this.variableType = variableType; this.destinationColumnType = GetDestinationColumnType(variableType); this.recodeInputTable = recodeInputTable; this.shouldMaintainSortOrder = maintainSortOrder; this.shouldUseWildcards = shouldUseWildcards; if (this.variableType.Equals(DashboardVariableType.YesNo)) { string val = elseValue.ToLower(); if(val == "true" || val == "(+)" || val == dashboardHelper.Config.Settings.RepresentationOfYes.ToLower()) { this.elseValue = "true"; } else if (val == "false" || val == "(-)" || val == dashboardHelper.Config.Settings.RepresentationOfNo.ToLower()) { this.elseValue = "false"; } else { this.elseValue = string.Empty; } } else { this.elseValue = elseValue; } Construct(); }
/// <summary> /// Constructor /// </summary> /// <param name="dashboardHelper">The dashboard helper to attach</param> /// <param name="friendlyRule">The human-readable version of the rule</param> /// <param name="sourceColumnName">The name of the column from which to read the values</param> /// <param name="destinationColumnName">The name of the column in which the recoded values will reside</param> /// <param name="variableType">The type of variable being created to hold the recoded values</param> /// <param name="recodeInputTable">The table containing the sourceObject and destination values that describe how the recode should take place</param> /// <param name="maintainSortOrder">Whether statistics run on the recoded variable should maintain the sort order specified in the recode dialog, if appropriate for that statistic command</param> public Rule_Recode(DashboardHelper dashboardHelper, string friendlyRule, string sourceColumnName, string sourceColumnType, string destinationColumnName, DashboardVariableType variableType, DataTable recodeInputTable, string elseValue, bool maintainSortOrder, bool shouldUseWildcards) { this.dashboardHelper = dashboardHelper; this.friendlyRule = friendlyRule; this.sourceColumnName = sourceColumnName; this.sourceColumnType = sourceColumnType; this.destinationColumnName = destinationColumnName; this.variableType = variableType; this.destinationColumnType = GetDestinationColumnType(variableType); this.recodeInputTable = recodeInputTable; this.shouldMaintainSortOrder = maintainSortOrder; this.shouldUseWildcards = shouldUseWildcards; if (this.variableType.Equals(DashboardVariableType.YesNo)) { string val = elseValue.ToLower(); if (val == "true" || val == "(+)" || val == Ewav.Web.Config.ConfigDataSet.RepresentationOfYes.ToLower()) { this.elseValue = "true"; } else if (val == "false" || val == "(-)" || val == Ewav.Web.Config.ConfigDataSet.RepresentationOfNo.ToLower()) { this.elseValue = "false"; } else { this.elseValue = string.Empty; } } else { this.elseValue = elseValue; } Construct(); }
/// <summary> /// Gets a column type appropriate for a .NET data table based off of the dashboard variable type selected by the user /// </summary> /// <param name="dashboardVariableType">The type of variable that is storing the recoded values</param> /// <returns>A string representing the type of a .NET DataColumn</returns> protected string GetDestinationColumnType(DashboardVariableType dashboardVariableType) { switch (dashboardVariableType) { case DashboardVariableType.Numeric: return "System.Single"; case DashboardVariableType.Text: return "System.String"; case DashboardVariableType.YesNo: return "System.Byte"; case DashboardVariableType.Date: return "System.DateTime"; case DashboardVariableType.None: throw new ApplicationException(SharedStrings.DASHBOARD_ERROR_INVALID_COLUMN_TYPE); default: return "System.String"; } }