コード例 #1
0
        public static ColumnData.ColumnDataInfo[] ToColumnDataInfo <T>(Boolean sortByName)
        {
            Type enumType = typeof(T);

            if (!enumType.IsEnum)
            {
                throw new InvalidOperationException("This type is not an enumeration");
            }
            String[] enumNames = Enum.GetNames(enumType);
            if (sortByName)
            {
                Array.Sort(enumNames);
            }
            List <ColumnData.ColumnDataInfo> listColumnDataInfo = new List <ColumnData.ColumnDataInfo>();
            Enum enumValue;

            ColumnData.ColumnDataInfo columnDataInfo;
            foreach (String enumName in enumNames)
            {
                enumValue = (Enum)Enum.Parse(enumType, enumName);
                {
                    columnDataInfo              = new ColumnData.ColumnDataInfo();
                    columnDataInfo.DataType     = ColumnData.GetDataType(enumValue);
                    columnDataInfo.TypeIsString = ColumnData.IsDataTypeString(enumValue);
                    columnDataInfo.Name         = ColumnData.GetName(enumValue);
                    listColumnDataInfo.Add(columnDataInfo);
                }
            }
            return(listColumnDataInfo.ToArray());
        }
コード例 #2
0
        private void onFieldSelected(object sender, EventArgs e)
        {
            ColumnData.ColumnDataInfo column = (ColumnData.ColumnDataInfo)guiFieldCbo.SelectedItem;
            Boolean isString = column.TypeIsString;

            guiPatternTxt.Enabled    = isString;
            guiPatternTxt.Text       = guiPatternTxt.Enabled ? m_searchCriteria.criteria : "";
            guiPatternTipBtn.Enabled = isString;
            guiComparisonCbo.Enabled = !isString;
            if (guiComparisonCbo.Enabled)
            {
                guiComparisonCbo.SelectedItem = guiComparisonCbo.Items[m_searchCriteria.comparisonSymbol];
            }
            else
            {
                guiComparisonCbo.Text = "";
            }
            guiComparisonTxt.Enabled = guiComparisonCbo.Enabled;
            guiComparisonTxt.Text    = guiComparisonTxt.Enabled ? m_searchCriteria.criteria : "";
        }
コード例 #3
0
        private void onOk(object sender, EventArgs e)
        {
            ColumnData.ColumnDataInfo column = (ColumnData.ColumnDataInfo)guiFieldCbo.SelectedItem;
            Boolean isString = column.TypeIsString;

            if (isString)
            {
                m_searchCriteria.comparisonSymbol = (guiPatternTxt.Text.Length == 0)
                                                  ? 2  // =
                                                  : 5; // Like
                m_searchCriteria.criteria = guiPatternTxt.Text;
                m_searchCriteria.subQuery = column.Name
                                            + " "
                                            + m_searchCriteria.getComparatorSymbol()
                                            + " "
                                            + DB.QueryParameterCharacter + column.Name;
                m_searchCriteria.sqlParameter = column.Name;
                m_searchCriteria.sqlValue     = guiPatternTxt.Text;
            }
            else
            {
                if (guiComparisonTxt.Text.Length == 0)
                {
                    MessageBox.Show("You must enter a comparison value");
                    guiComparisonTxt.Focus();
                    return;
                }
                m_searchCriteria.comparisonSymbol = guiComparisonCbo.SelectedIndex;
                m_searchCriteria.criteria         = guiComparisonTxt.Text;
                m_searchCriteria.subQuery         = column.Name
                                                    + " "
                                                    + m_searchCriteria.getComparatorSymbol()
                                                    + " "
                                                    + DB.QueryParameterCharacter + column.Name;
                m_searchCriteria.sqlParameter = column.Name;
                m_searchCriteria.sqlValue     = guiComparisonTxt.Text;
            }
            m_searchCriteria.column = column.Name;
            this.Close();
        }