Example #1
0
        private void ShowColumnName()
        {
            shtQueryList.RowCount = 0;

            for (int i = 0; i < m_SheetViewData.ColumnCount; i++)
            {
                if (m_SheetViewData.Columns[i].Visible == true)
                {
                    int iRowCount = shtQueryList.RowCount++;
                    shtQueryList.Cells[iRowCount, (int)eCol.ColumnName].Text  = m_SheetViewData.ColumnHeader.Cells[0, i].Text;
                    shtQueryList.Cells[iRowCount, (int)eCol.ColumnIndex].Text = i.ToString();

                    ICellType cellType = m_SheetViewData.GetCellType(0, i);

                    if (cellType is NumberCellType)
                    {
                        shtQueryList.Cells[iRowCount, (int)eCol.ColumnType].Value = eColumnType.Number;
                        shtQueryList.Cells[iRowCount, (int)eCol.Sign].Value       = eSign.Between.ToString();
                        shtQueryList.Cells[iRowCount, (int)eCol.Value1].CellType  = CtrlUtil.CreateNumberCellType();
                        shtQueryList.Cells[iRowCount, (int)eCol.Value2].CellType  = CtrlUtil.CreateNumberCellType();
                    }
                    else if (cellType is DateTimeCellType)
                    {
                        shtQueryList.Cells[iRowCount, (int)eCol.ColumnType].Value = eColumnType.DateTime;
                        shtQueryList.Cells[iRowCount, (int)eCol.Sign].Value       = eSign.Between.ToString();
                        shtQueryList.Cells[iRowCount, (int)eCol.Value1].CellType  = CtrlUtil.CreateDateTimeCellType();
                        shtQueryList.Cells[iRowCount, (int)eCol.Value2].CellType  = CtrlUtil.CreateDateTimeCellType();
                    }
                    //else
                    //{
                    //    shtQueryList.Cells[iRowCount, (int)eCol.ColumnType].Value = eColumnType.String;
                    //    shtQueryList.Cells[iRowCount, (int)eCol.Sign].Value = eSign.Like.ToString();
                    //    shtQueryList.Cells[iRowCount, (int)eCol.Value1].CellType = CtrlUtil.CreateTextCellType();
                    //    shtQueryList.Cells[iRowCount, (int)eCol.Value2].Locked = true;
                    //    shtQueryList.Cells[iRowCount, (int)eCol.Value2].BackColor = Color.LightGray;
                    //}
                    else if (m_SheetViewData.ColumnHeader.Cells[0, i].Text != DataDefine.MASTER_NO_FIELD_NAME)
                    {
                        shtQueryList.Cells[iRowCount, (int)eCol.ColumnType].Value = eColumnType.String;
                        shtQueryList.Cells[iRowCount, (int)eCol.Sign].Value       = eSign.Like.ToString();
                        shtQueryList.Cells[iRowCount, (int)eCol.Value1].CellType  = CtrlUtil.CreateTextCellType();
                        shtQueryList.Cells[iRowCount, (int)eCol.Value2].Locked    = true;
                        shtQueryList.Cells[iRowCount, (int)eCol.Value2].BackColor = Color.LightGray;
                    }

                    // Add by Pongthorn S. @ 2012-05-18
                    if (m_SheetViewData.ColumnHeader.Cells[0, i].Text == DataDefine.MASTER_NO_FIELD_NAME)
                    {
                        shtQueryList.Cells[iRowCount, (int)eCol.ColumnType].Value = eColumnType.String;
                        shtQueryList.Cells[iRowCount, (int)eCol.Sign].Value       = eSign.Between.ToString();
                        shtQueryList.Cells[iRowCount, (int)eCol.Value1].CellType  = CtrlUtil.CreateTextCellType();
                        shtQueryList.Cells[iRowCount, (int)eCol.Value2].CellType  = CtrlUtil.CreateTextCellType();
                    }
                }
            }
        }