Пример #1
0
        /// <summary>
        /// 从表格中删除证券
        /// </summary>
        /// <param name="securities">证券列表</param>
        public void RemoveSecuritiesFromSecuritiesGrid(List <Security> securities)
        {
            Dictionary <String, Security> existsCodes = new Dictionary <String, Security>();
            int securitiesSize = securities.Count;

            for (int i = 0; i < securitiesSize; i++)
            {
                Security security = securities[i];
                existsCodes[security.m_code] = security;
            }
            int rowSize = m_gridSecurities.GetRows().Count;

            m_gridSecurities.BeginUpdate();
            for (int i = 0; i < rowSize; i++)
            {
                GridRow  row      = m_gridSecurities.GetRow(i);
                Security security = new Security();
                if (m_securityService.GetSecurityByCode(row.GetCell(0).GetString(), ref security))
                {
                    if (existsCodes.ContainsKey(security.m_code))
                    {
                        m_gridSecurities.RemoveRow(row);
                        i--;
                        rowSize--;
                    }
                }
            }
            m_gridSecurities.EndUpdate();
            m_gridSecurities.Invalidate();
        }
Пример #2
0
        /// <summary>
        /// 从表格中删除员工
        /// </summary>
        /// <param name="staffs">员工列表</param>
        public void RemoveFromResultGrid(List <StaffInfo> staffs)
        {
            Dictionary <String, StaffInfo> existsIds = new Dictionary <String, StaffInfo>();
            int staffsSize = staffs.Count;

            for (int i = 0; i < staffsSize; i++)
            {
                StaffInfo staff = staffs[i];
                existsIds[staff.m_jobID] = staff;
            }
            int rowSize = m_gridResult.GetRows().Count;

            m_gridResult.BeginUpdate();
            for (int i = 0; i < rowSize; i++)
            {
                GridRow   row       = m_gridResult.GetRow(i);
                StaffInfo staffInfo = DataCenter.StaffService.GetStaff(row.GetCell(0).GetString());
                if (existsIds.ContainsKey(staffInfo.m_jobID))
                {
                    m_gridResult.RemoveRow(row);
                    i--;
                    rowSize--;
                }
            }
            m_gridResult.EndUpdate();
            m_gridResult.Invalidate();
        }
Пример #3
0
        /// <summary>
        /// 从表格中移除类别
        /// </summary>
        /// <param name="categories">类别</param>
        public void RemoveCategoriesFromCategoryGrid(List <UserSecurityCategory> categories)
        {
            if (m_gridCategory.EditTextBox != null)
            {
                m_gridCategory.OnCellEditEnd(null);
            }
            m_gridCategory.BeginUpdate();
            Dictionary <String, String> removeKeys = new Dictionary <String, String>();
            int categoriesSize = categories.Count;

            for (int i = 0; i < categoriesSize; i++)
            {
                UserSecurityCategory category = categories[i];
                removeKeys[category.m_categoryID] = "";
            }
            int rowSize = m_gridCategory.GetRows().Count;

            for (int i = 0; i < rowSize; i++)
            {
                GridRow row        = m_gridCategory.GetRow(i);
                String  categoryID = row.GetCell(0).GetString();
                if (removeKeys.ContainsKey(categoryID))
                {
                    m_gridCategory.RemoveRow(row);
                    row.ClearCells();
                    row.Dispose();
                    rowSize--;
                    i--;
                }
            }
            removeKeys.Clear();
            m_gridCategory.EndUpdate();
            m_gridCategory.Invalidate();
        }
Пример #4
0
        /// <summary>
        /// 删除服务器
        /// </summary>
        private void DeleteServer()
        {
            List <GridRow> selectedRows     = m_gridServers.SelectedRows;
            int            selectedRowsSize = selectedRows.Count;

            if (selectedRowsSize > 0)
            {
                GridRow row = selectedRows[0];
                m_serverService.DeleteServer(row.GetCell(0).Text);
                m_gridServers.RemoveRow(row);
                row.Dispose();
                List <GridRow> rows     = m_gridServers.GetRows();
                int            rowsSize = rows.Count;
                if (rowsSize > 0)
                {
                    selectedRows = new List <GridRow>();
                    selectedRows.Add(m_gridServers.GetRow(rowsSize - 1));
                    m_gridServers.SelectedRows = selectedRows;
                }
                m_gridServers.Update();
                m_gridServers.Update();
                BindServersToComboBox();
                m_window.Invalidate();
            }
        }
Пример #5
0
 /// <summary>
 /// 执行秒表方法
 /// </summary>
 /// <param name="timerID">秒表ID</param>
 public void OnTimer(int timerID)
 {
     if (m_timerID == timerID)
     {
         int     scrollY = m_gridSecurities.VScrollBar.Pos;
         POINT   fPoint  = new POINT(0, m_gridSecurities.HeaderHeight + 1 + scrollY);
         POINT   ePoint  = new POINT(0, m_gridSecurities.Height - 10 + scrollY);
         GridRow fRow    = m_gridSecurities.GetRow(fPoint);
         GridRow eRow    = m_gridSecurities.GetRow(ePoint);
         while (eRow == null && ePoint.y > 0)
         {
             ePoint.y -= 10;
             eRow      = m_gridSecurities.GetRow(ePoint);
         }
         if (fRow != null && eRow != null)
         {
             List <String> requestCodes = new List <String>();
             for (int i = fRow.Index; i <= eRow.Index; i++)
             {
                 requestCodes.Add(m_gridSecurities.GetRow(i).GetCell(0).Text);
             }
             int    requestCodesSize = requestCodes.Count;
             String strCodes         = "";
             for (int i = 0; i < requestCodesSize; i++)
             {
                 strCodes += requestCodes[i];
                 if (i != requestCodesSize)
                 {
                     strCodes += ",";
                 }
             }
             LatestDataInfo dataInfo = new LatestDataInfo();
             dataInfo.m_codes      = strCodes;
             dataInfo.m_formatType = 1;
             m_quoteService.GetLatestDatas(m_latestDataRequestID, dataInfo);
             requestCodes.Clear();
         }
     }
 }