/// <summary>Gets the null-based row index of a specific property.
        /// </summary>
        /// <param name="propertyName">The name of the property to search (in the first column).</param>
        /// <param name="rowIndex">The null-based index of the row which contains the property (output).</param>
        /// <param name="dataAdvice">Data advice, i.e. a list of possible outcome, perhaps <c>null</c>.</param>
        /// <returns>A value indicating whether <paramref name="rowIndex"/> contains valid data.</returns>
        public bool TryGetRowIndexOfPropertyName(string propertyName, out int rowIndex, IExcelDataAdvice dataAdvice = null)
        {
            if (propertyName == null)
            {
                throw new ArgumentNullException("propertyName");
            }
            string idPropertyName = propertyName.ToIDString();

            for (int j = 0; j < m_RowCount; j++)
            {
                if (m_Data[j, 0] is String)
                {
                    string cellName = (string)m_Data[j, 0];

                    if (cellName.ToIDString() == idPropertyName)
                    {
                        rowIndex = j;
                        if (dataAdvice != null)
                        {
                            ExcelLowLevel.CreateDropdownList(m_Range, rowIndex, 0, dataAdvice.AsExcelDropDownListString());
                        }
                        m_SetOfUsedPropertyIndices.Add(rowIndex);
                        m_GuidedExcelDataQuery.SetData(rowIndex, 0, cellName);
                        m_GuidedExcelDataQuery.SetDataAdvice(rowIndex, 0, dataAdvice);
                        return(true);
                    }
                }
            }
            m_UnusedOptionalPropertyNames.Add(propertyName);
            m_GuidedExcelDataQuery.AddUnusedPropertyName(propertyName);
            rowIndex = -1;
            return(false);
        }
示例#2
0
        /// <summary>Gets the null-based row index of a specific property.
        /// </summary>
        /// <param name="propertyName">The name of the property to search (in the first column).</param>
        /// <param name="rowIndex">The null-based index of the row which contains the property (output).</param>
        /// <param name="dataAdvice">Data advice, i.e. a list of possible outcome, perhaps <c>null</c>.</param>
        /// <returns>A value indicating whether <paramref name="rowIndex"/> contains valid data.
        /// </returns>
        public bool TryGetRowIndexOfPropertyName(string propertyName, out int rowIndex, IExcelDataAdvice dataAdvice = null)
        {
            if (propertyName == null)
            {
                throw new ArgumentNullException("propertyName");
            }
            if (m_ExcelCellValue is String)
            {
                string cellValue = (string)m_ExcelCellValue;

                if (propertyName.ToIDString() == cellValue.ToIDString())
                {
                    if (dataAdvice != null)
                    {
                        m_Range.CreateDropdownList(0, 0, dataAdvice.AsExcelDropDownListString());
                    }
                    m_GuidedExcelDataQuery.SetDataAdvice(0, 0, dataAdvice);
                    m_GuidedExcelDataQuery.SetData(0, 0, cellValue);

                    rowIndex = 0;
                    return(true);
                }
            }
            m_GuidedExcelDataQuery.AddUnusedPropertyName(propertyName);
            rowIndex = -1;
            return(false);
        }
示例#3
0
        /// <summary>Gets the null-based row index of a specific property.
        /// </summary>
        /// <param name="propertyName">The name of the property to search (in the first column).</param>
        /// <param name="rowIndex">The null-based index of the row which contains the property (output).</param>
        /// <param name="dataAdvice">Data advice, i.e. a list of possible outcome, perhaps <c>null</c>.</param>
        /// <returns>A value indicating whether <paramref name="rowIndex"/> contains valid data.</returns>
        public bool TryGetRowIndexOfPropertyName(string propertyName, out int rowIndex, IExcelDataAdvice dataAdvice = null)
        {
            if (propertyName == null)
            {
                throw new ArgumentNullException("propertyName");
            }
            string idPropertyName = propertyName.ToIDString();

            for (rowIndex = 0; rowIndex < m_RowCount; rowIndex++)
            {
                string tablePropertyName = m_PropertyNameArray[0, rowIndex] as string;
                if ((tablePropertyName != null) && (tablePropertyName.Length > 0))
                {
                    tablePropertyName = tablePropertyName.ToIDString();
                    if (tablePropertyName == idPropertyName)
                    {
                        m_SetOfUsedPropertyIndices.Add(rowIndex);
                        m_GuidedExcelDataQuery.SetData(rowIndex, 0, propertyName);
                        m_GuidedExcelDataQuery.SetDataAdvice(rowIndex, 0, dataAdvice);
                        return(true);
                    }
                }
            }
            m_UnusedOptionalPropertyNames.Add(propertyName);
            m_GuidedExcelDataQuery.AddUnusedPropertyName(propertyName);
            rowIndex = -1;
            return(false);
        }
        /// <summary>Gets the null-based row index of a specific property.
        /// </summary>
        /// <param name="propertyName">The name of the property to search (in the first column).</param>
        /// <param name="rowIndex">The null-based index of the row which contains the property (output).</param>
        /// <param name="dataAdvice">Data advice, i.e. a list of possible outcome, perhaps <c>null</c>.</param>
        /// <returns>A value indicating whether <paramref name="rowIndex"/> contains valid data.</returns>
        public bool TryGetRowIndexOfPropertyName(string propertyName, out int rowIndex, IExcelDataAdvice dataAdvice = null)
        {
            if (propertyName == null)
            {
                throw new ArgumentNullException("propertyName");
            }
            string thisPropertyName;

            if (TryGetValue <string>(m_PropertyName, out thisPropertyName, (dataAdvice != null) ? dataAdvice.AsExcelDropDownListString() : null) == ExcelCellValueState.ProperValue)
            {
                if (propertyName.ToIDString() == thisPropertyName.ToIDString())
                {
                    m_GuidedExcelDataQuery.SetData(0, 0, propertyName);
                    m_GuidedExcelDataQuery.SetDataAdvice(0, 0, dataAdvice);
                    rowIndex = 0;
                    return(true);
                }
            }
            m_GuidedExcelDataQuery.AddUnusedPropertyName(propertyName);
            rowIndex = -1;
            return(false);
        }