Beispiel #1
0
 /// <summary>
 /// 添加数值主键
 /// </summary>
 /// <param name="num">数值</param>
 /// <param name="newRow">数据行</param>
 private FCDataRow addKey(double num)
 {
     if (m_keys.size() == 0 || num > m_keys.get(m_keys.size() - 1))
     {
         m_keys.push_back(num);
         FCDataRow newRow = new FCDataRow(m_colsCapacity, m_colsStep);
         m_rows.push_back(newRow);
         return(newRow);
     }
     else
     {
         int begin = 0;
         int end   = m_keys.size() - 1;
         int sub   = end - begin;
         while (sub > 1)
         {
             int    half = begin + sub / 2;
             double hf   = m_keys.get(half);
             if (hf > num)
             {
                 end = half;
             }
             else if (hf < num)
             {
                 begin = half;
             }
             sub = end - begin;
         }
         if (num < m_keys.get(begin))
         {
             m_keys.insert(begin, num);
             FCDataRow newRow = new FCDataRow(m_colsCapacity, m_colsStep);
             m_rows.insert(begin, newRow);
             return(newRow);
         }
         else if (num > m_keys.get(end))
         {
             m_keys.insert(end + 1, num);
             FCDataRow newRow = new FCDataRow(m_colsCapacity, m_colsStep);
             m_rows.insert(end + 1, newRow);
             return(newRow);
         }
         else
         {
             m_keys.insert(begin + 1, num);
             FCDataRow newRow = new FCDataRow(m_colsCapacity, m_colsStep);
             m_rows.insert(begin + 1, newRow);
             return(newRow);
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 过滤查找
        /// </summary>
        public void filterSearch()
        {
            String sText = m_searchTextBox.Text.ToUpper();

            m_grid.beginUpdate();
            m_grid.clearRows();
            int row = 0;
            CList <Security> securities = SecurityService.FilterCode(sText);

            if (securities != null)
            {
                int rowCount = securities.size();
                for (int i = 0; i < rowCount; i++)
                {
                    Security  security = securities.get(i);
                    FCGridRow gridRow  = new FCGridRow();
                    m_grid.addRow(gridRow);
                    gridRow.addCell(0, new FCGridStringCell(security.m_code));
                    gridRow.addCell(1, new FCGridStringCell(security.m_name));
                    row++;
                }
            }
            securities.delete();
            m_grid.endUpdate();
        }
Beispiel #3
0
 /// <summary>
 /// 清除数据
 /// </summary>
 public virtual void clear()
 {
     if (m_keys != null)
     {
         m_keys.clear();
     }
     if (m_rows != null)
     {
         for (int i = 0; i < m_rows.size(); i++)
         {
             FCDataRow row = m_rows.get(i);
             if (row != null)
             {
                 row.delete();
             }
         }
         m_rows.clear();
     }
 }
Beispiel #4
0
 /// <summary>
 /// 填充空间
 /// </summary>
 /// <param name="columns">列名</param>
 public void fillEmpty(int columns)
 {
     if (m_values != null)
     {
         int size = m_values.size();
         if (size >= 0)
         {
             for (int i = size; i < columns; i++)
             {
                 m_values.insert(i, double.NaN);
             }
         }
     }
 }
Beispiel #5
0
 /// <summary>
 /// 添加列
 /// </summary>
 /// <param name="colName">列名</param>
 public virtual void addColumn(int colName)
 {
     int[] column = new int[] { colName, m_columns.size() };
     if (m_columns.size() == 0)
     {
         m_columns.push_back(column);
     }
     else
     {
         int begin = 0;
         int end   = m_columns.size() - 1;
         int sub   = end - begin;
         while (sub > 1)
         {
             int half = begin + sub / 2;
             int hf   = m_columns.get(half)[0];
             if (hf > colName)
             {
                 end = half;
             }
             else if (hf < colName)
             {
                 begin = half;
             }
             sub = end - begin;
         }
         if (colName < m_columns.get(begin)[0])
         {
             m_columns.insert(begin, column);
             fillEmpty();
             return;
         }
         else if (colName > m_columns.get(end)[0])
         {
             m_columns.insert(end + 1, column);
             fillEmpty();
             return;
         }
         else
         {
             m_columns.insert(begin + 1, column);
             fillEmpty();
             return;
         }
     }
 }