/// <summary> /// 添加类别到表格中 /// </summary> /// <param name="categories">类别</param> public void AddCategoriesToCategoryGrid(List <UserSecurityCategory> categories) { if (m_gridCategory.EditTextBox != null) { m_gridCategory.OnCellEditEnd(null); } m_gridCategory.BeginUpdate(); int categoriesSize = categories.Count; for (int i = 0; i < categoriesSize; i++) { UserSecurityCategory category = categories[i]; GridRow row = new GridRow(); row.Grid = m_gridCategory; GridStringCell idCell = new GridStringCell(); idCell.Text = category.m_categoryID; row.AddCell(0, idCell); GridStringCell textCell = new GridStringCell(); textCell.AllowEdit = true; textCell.Text = category.m_name; row.AddCell(1, textCell); m_gridCategory.AddRow(row); if (i == 0) { m_gridCategory.OnCellEditBegin(textCell); } } m_gridCategory.EndUpdate(); m_gridCategory.Invalidate(); }
/// <summary> /// 添加成员到结果表格 /// </summary> /// <param name="staffs">成员</param> public void AddToResultGrid(List <StaffInfo> staffs) { Dictionary <String, String> existsIds = new Dictionary <String, String>(); List <GridRow> rows = m_gridResult.GetRows(); int rowSize = rows.Count; for (int i = 0; i < rowSize; i++) { GridRow row = rows[i]; String id = row.GetCell(0).GetString(); existsIds[id] = ""; } int staffsSize = staffs.Count; m_gridResult.BeginUpdate(); for (int i = 0; i < staffsSize; i++) { StaffInfo staff = staffs[i]; if (!existsIds.ContainsKey(staff.m_jobID)) { GridRow row = new GridRow(); m_gridResult.AddRow(row); row.AddCell(0, new GridStringCell(staff.m_jobID)); row.AddCell(1, new GridStringCell(staff.m_name)); existsIds[staff.m_jobID] = ""; } } m_gridResult.EndUpdate(); m_gridResult.Invalidate(); }
/// <summary> /// 添加信息 /// </summary> /// <param name="report">信息</param> public void AddExamToGrid(ExamInfo report) { List <GridRow> rows = m_gridExams.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow findRow = rows[i]; if (findRow.GetCell("colP1").GetString() == report.m_ID) { findRow.GetCell("colP2").SetString(report.m_title); findRow.GetCell("colP3").SetString(report.m_type); findRow.GetCell("colP4").SetString(report.m_interval); findRow.GetCell("colP5").SetString(report.m_answer); findRow.GetCell("colP6").SetString(report.m_createDate); return; } } GridRow row = new GridRow(); m_gridExams.AddRow(row); row.AddCell("colP1", new GridStringCell(report.m_ID)); row.AddCell("colP2", new GridStringCell(report.m_title)); row.AddCell("colP3", new GridStringCell(report.m_type)); row.AddCell("colP4", new GridStringCell(report.m_interval)); row.AddCell("colP5", new GridStringCell(report.m_answer)); row.AddCell("colP6", new GridStringCell(report.m_createDate)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 1; j < cellsSize; j++) { cells[j].AllowEdit = true; } }
/// <summary> /// 添加信息 /// </summary> /// <param name="git">信息</param> public void AddGitToGrid(GitInfo git) { List <GridRow> rows = m_gridGit.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow findRow = rows[i]; if (findRow.GetCell("colP1").GetString() == git.m_ID) { findRow.GetCell("colP2").SetString(git.m_name); findRow.GetCell("colP3").SetString(git.m_url); findRow.GetCell("colP4").SetString(git.m_createDate); return; } } GridRow row = new GridRow(); m_gridGit.AddRow(row); row.AddCell("colP1", new GridStringCell(git.m_ID)); row.AddCell("colP2", new GridStringCell(git.m_name)); row.AddCell("colP3", new GridStringCell(git.m_url)); row.AddCell("colP4", new GridStringCell(git.m_createDate)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 1; j < cellsSize; j++) { cells[j].AllowEdit = true; } }
/// <summary> /// 过滤查找 /// </summary> public void FilterSearch() { String sText = m_searchTextBox.Text.ToUpper(); m_grid.BeginUpdate(); m_grid.ClearRows(); int row = 0; CList <GSecurity> securities = SecurityService.FilterCode(sText); if (securities != null) { int rowCount = securities.size(); for (int i = 0; i < rowCount; i++) { GSecurity security = securities.get(i); GridRow gridRow = new GridRow(); m_grid.AddRow(gridRow); gridRow.AddCell(0, new GridStringCell(security.m_code)); gridRow.AddCell(1, new GridStringCell(security.m_name)); row++; } } securities.Dispose(); m_grid.EndUpdate(); }
/// <summary> /// 添加信息 /// </summary> /// <param name="card">信息</param> public void AddCardToGrid(BusinessCardInfo card) { List <GridRow> rows = m_gridBusinessCards.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow findRow = rows[i]; if (findRow.GetCell("colP1").GetString() == card.m_ID) { findRow.GetCell("colP2").SetString(card.m_name); findRow.GetCell("colP3").SetString(card.m_phone); findRow.GetCell("colP4").SetString(card.m_content); findRow.GetCell("colP5").SetString(card.m_createDate); return; } } GridRow row = new GridRow(); m_gridBusinessCards.AddRow(row); row.AddCell("colP1", new GridStringCell(card.m_ID)); row.AddCell("colP2", new GridStringCell(card.m_name)); row.AddCell("colP3", new GridStringCell(card.m_phone)); row.AddCell("colP4", new GridStringCell(card.m_content)); row.AddCell("colP5", new GridStringCell(card.m_createDate)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 1; j < cellsSize; j++) { cells[j].AllowEdit = true; } }
/// <summary> /// 添加信息 /// </summary> /// <param name="level">信息</param> public void AddLevelToGrid(LevelInfo level) { List <GridRow> rows = m_gridLevels.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow findRow = rows[i]; if (findRow.GetCell("colP1").GetString() == level.m_ID) { findRow.GetCell("colP2").SetString(level.m_date); findRow.GetCell("colP3").SetString(level.m_level); findRow.GetCell("colP4").SetString(level.m_level2); findRow.GetCell("colP5").SetString(level.m_level3); return; } } GridRow row = new GridRow(); m_gridLevels.AddRow(row); row.AddCell("colP1", new GridStringCell(level.m_ID)); row.AddCell("colP2", new GridStringCell(level.m_date)); row.AddCell("colP3", new GridStringCell(level.m_level)); row.AddCell("colP4", new GridStringCell(level.m_level2)); row.AddCell("colP5", new GridStringCell(level.m_level3)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 1; j < cellsSize; j++) { cells[j].AllowEdit = true; } }
/// <summary> /// 增加证券到表格中 /// </summary> /// <param name="securities">证券列表</param> public void AddSecuritiesToSecuritiesGrid(List <Security> securities) { Dictionary <String, String> existsCodes = new Dictionary <String, String>(); List <GridRow> rows = m_gridSecurities.GetRows(); int rowSize = rows.Count; for (int i = 0; i < rowSize; i++) { GridRow row = rows[i]; String code = row.GetCell(0).GetString(); existsCodes[code] = ""; } int securitiesSize = securities.Count; m_gridSecurities.BeginUpdate(); for (int i = 0; i < securitiesSize; i++) { Security security = securities[i]; if (!existsCodes.ContainsKey(security.m_code)) { GridRow row = new GridRow(); m_gridSecurities.AddRow(row); row.AddCell(0, new GridStringCell(security.m_code)); row.AddCell(1, new GridStringCell(security.m_name)); existsCodes[security.m_code] = ""; } } m_gridSecurities.EndUpdate(); m_gridSecurities.Invalidate(); }
/// <summary> /// 添加信息 /// </summary> /// <param name="server">信息</param> public void AddServerToGrid(ServerInfo server) { List <GridRow> rows = m_gridServers.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow findRow = rows[i]; if (findRow.GetCell("colP1").GetString() == server.m_ID) { findRow.GetCell("colP2").SetString(server.m_name); findRow.GetCell("colP3").SetString(server.m_IP); findRow.GetCell("colP4").SetString(server.m_userName); findRow.GetCell("colP5").SetString(server.m_password); findRow.GetCell("colP6").SetString(server.m_createDate); return; } } GridRow row = new GridRow(); m_gridServers.AddRow(row); row.AddCell("colP1", new GridStringCell(server.m_ID)); row.AddCell("colP2", new GridStringCell(server.m_name)); row.AddCell("colP3", new GridStringCell(server.m_IP)); row.AddCell("colP4", new GridStringCell(server.m_userName)); row.AddCell("colP5", new GridStringCell(server.m_password)); row.AddCell("colP6", new GridStringCell(server.m_createDate)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 1; j < cellsSize; j++) { cells[j].AllowEdit = true; } }
/// <summary> /// 添加嘉奖 /// </summary> /// <param name="award">嘉奖</param> public void AddAwardToGrid(AwardInfo award) { StaffService staffService = DataCenter.StaffService; StaffInfo staff = staffService.GetStaff(award.m_name); List <GridRow> rows = m_gridAwards.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow findRow = rows[i]; if (findRow.GetCell("colP1").GetString() == award.m_ID) { findRow.GetCell("colP2").SetString(award.m_name); findRow.GetCell("colP3").SetString(award.m_title); findRow.GetCell("colP4").SetString(award.m_createDate); return; } } GridRow row = new GridRow(); m_gridAwards.AddRow(row); row.AddCell("colP1", new GridStringCell(award.m_ID)); row.AddCell("colP2", new GridStringCell(award.m_name)); row.AddCell("colP3", new GridStringCell(award.m_title)); row.AddCell("colP4", new GridStringCell(award.m_createDate)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 1; j < cellsSize; j++) { cells[j].AllowEdit = true; } }
/// <summary> /// 添加信息 /// </summary> /// <param name="bsStock">信息</param> public void AddCodeToGrid(BSStockInfo bsStock) { List <GridRow> rows = m_gridBSStocks.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow findRow = rows[i]; if (findRow.GetCell("colP1").GetString() == bsStock.m_ID) { findRow.GetCell("colP2").SetString(bsStock.m_code); findRow.GetCell("colP3").SetString(bsStock.m_name); findRow.GetCell("colP4").SetString(bsStock.m_profit); findRow.GetCell("colP5").SetString(bsStock.m_createDate); return; } } GridRow row = new GridRow(); m_gridBSStocks.AddRow(row); row.AddCell("colP1", new GridStringCell(bsStock.m_ID)); row.AddCell("colP2", new GridStringCell(bsStock.m_code)); row.AddCell("colP3", new GridStringCell(bsStock.m_name)); row.AddCell("colP4", new GridStringCell(bsStock.m_profit)); row.AddCell("colP5", new GridStringCell(bsStock.m_createDate)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 1; j < cellsSize; j++) { cells[j].AllowEdit = true; } }
/// <summary> /// 绑定公告 /// </summary> /// <param name="id"></param> private void BindNotices(String id) { object data = NoticeDataHelper.GetNoticeById(id, "0", "100", "desc", ""); NoticeListRoot noticeRoot = JsonConvert.DeserializeObject <NoticeListRoot>(data.ToString()); List <NoticeListNodeBind> bindList = new List <NoticeListNodeBind>(); foreach (NoticeListNode noticeNode in noticeRoot.records) { NoticeListNodeBind bind = new NoticeListNodeBind(); bind.Copy(noticeNode); bindList.Add(bind); } m_gridAllStockNotices.ClearRows(); foreach (NoticeListNodeBind notice in bindList) { GridRow row = new GridRow(); m_gridAllStockNotices.AddRow(row); row.Tag = notice; row.AddCell("colN1", new GridStringCell(notice.Date)); row.AddCell("colN2", new GridStringCell(notice.Title)); row.AddCell("colN3", new GridStringCell(notice.url)); row.AddCell("colN4", new GridStringCell(notice.Id)); row.GetCell("colN1").Style = new GridCellStyle(); row.GetCell("colN1").Style.ForeColor = COLOR.ARGB(255, 255, 80); row.GetCell("colN2").Style = new GridCellStyle(); row.GetCell("colN2").Style.ForeColor = COLOR.ARGB(255, 80, 80); row.GetCell("colN3").Style = new GridCellStyle(); row.GetCell("colN3").Style.ForeColor = COLOR.ARGB(255, 80, 255); } m_gridAllStockNotices.Update(); m_gridAllStockNotices.Invalidate(); }
/// <summary> /// 绑定研报 /// </summary> /// <param name="id"></param> private void BindReports(String id) { object data = ReportDataHelper.GetReportByTreeNode("", "", id, "0", "100", "desc", "", ""); ReportListRoot reportRoot = JsonConvert.DeserializeObject <ReportListRoot>(data.ToString()); List <ReportListNodeBind> bindList = new List <ReportListNodeBind>(); foreach (ReportListNode noticeNode in reportRoot.records) { ReportListNodeBind bind = new ReportListNodeBind(); bind.Copy(noticeNode); bindList.Add(bind); } m_gridAllStockReports.ClearRows(); foreach (ReportListNodeBind report in bindList) { GridRow row = new GridRow(); m_gridAllStockReports.AddRow(row); row.Tag = report; row.AddCell("colN1", new GridStringCell(report.date)); row.AddCell("colN2", new GridStringCell(report.Title)); row.AddCell("colN3", new GridStringCell(report.Url)); row.AddCell("colN4", new GridStringCell(report.id)); row.GetCell("colN1").Style = new GridCellStyle(); row.GetCell("colN1").Style.ForeColor = COLOR.ARGB(255, 255, 80); row.GetCell("colN2").Style = new GridCellStyle(); row.GetCell("colN2").Style.ForeColor = COLOR.ARGB(255, 80, 80); row.GetCell("colN3").Style = new GridCellStyle(); row.GetCell("colN3").Style.ForeColor = COLOR.ARGB(255, 80, 255); } m_gridAllStockReports.Update(); m_gridAllStockReports.Invalidate(); }
/// <summary> /// 添加线索 /// </summary> /// <param name="clue">线索</param> public void AddClueToGrid(ClueInfo clue) { List <GridRow> rows = m_gridClues.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow findRow = rows[i]; if (findRow.GetCell("colP1").GetString() == clue.m_ID) { findRow.GetCell("colP2").SetString(clue.m_level); findRow.GetCell("colP3").SetString(clue.m_title); findRow.GetCell("colP4").SetString(clue.m_content); findRow.GetCell("colP5").SetString(clue.m_createDate); return; } } GridRow row = new GridRow(); m_gridClues.AddRow(row); row.AddCell("colP1", new GridStringCell(clue.m_ID)); row.AddCell("colP2", new GridStringCell(clue.m_level)); row.AddCell("colP3", new GridStringCell(clue.m_title)); row.AddCell("colP4", new GridStringCell(clue.m_content)); row.AddCell("colP5", new GridStringCell(clue.m_createDate)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 1; j < cellsSize; j++) { cells[j].AllowEdit = true; } }
/// <summary> /// 绑定新股名称表格 /// </summary> private void BindNewStockCalendar() { GridA gridNewStockCalendar = m_mainFrame.GetGrid("gridNewStockCalendar"); gridNewStockCalendar.GridLineColor = COLOR.EMPTY; gridNewStockCalendar.BackColor = COLOR.ARGB(0, 0, 0); gridNewStockCalendar.RowStyle = new GridRowStyle(); gridNewStockCalendar.RowStyle.BackColor = COLOR.ARGB(0, 0, 0); DataSet ds = NewStockDataHelper.GetNewStockCalendar(0); StringBuilder sb = new StringBuilder(); foreach (DataRow dr in ds.Tables[0].Rows) { GridRow row = new GridRow(); gridNewStockCalendar.AddRow(row); row.AddCell("colN1", new GridStringCell(dr[1].ToString())); row.AddCell("colN2", new GridStringCell(dr[2].ToString())); row.AddCell("colN3", new GridStringCell(dr[3].ToString())); row.AddCell("colN4", new GridStringCell(dr[4].ToString())); row.GetCell("colN1").Style = new GridCellStyle(); row.GetCell("colN1").Style.ForeColor = COLOR.ARGB(255, 80, 80); row.GetCell("colN2").Style = new GridCellStyle(); row.GetCell("colN2").Style.ForeColor = COLOR.ARGB(80, 255, 255); row.GetCell("colN3").Style = new GridCellStyle(); row.GetCell("colN3").Style.ForeColor = COLOR.ARGB(255, 80, 255); row.GetCell("colN4").Style = new GridCellStyle(); row.GetCell("colN4").Style.ForeColor = COLOR.ARGB(255, 255, 80); if (dr[3].ToString().IndexOf("网上申购日") != -1) { m_newStockList.Add(Convert.ToDateTime(dr[4]).ToString("yyyy-MM-dd") + " " + dr[2].ToString() + " " + dr[1].ToString() + "\r\n"); } } }
/// <summary> /// 绑定新闻 /// </summary> /// <param name="id"></param> private void BindStockNews(String id) { object data = StockNewsDataHelper.GetNewsById(id, "0", "100", "desc", ""); NewsListRoot newsRoot = JsonConvert.DeserializeObject <NewsListRoot>(data.ToString()); m_gridAllStockNews.ClearRows(); foreach (NewsListNode stockNew in newsRoot.records) { GridRow row = new GridRow(); m_gridAllStockNews.AddRow(row); row.Tag = stockNew; row.AddCell("colN1", new GridStringCell(stockNew.Date)); row.AddCell("colN2", new GridStringCell(stockNew.Title)); row.AddCell("colN3", new GridStringCell(stockNew.url)); row.AddCell("colN4", new GridStringCell(stockNew.Id)); row.GetCell("colN1").Style = new GridCellStyle(); row.GetCell("colN1").Style.ForeColor = COLOR.ARGB(255, 255, 80); row.GetCell("colN2").Style = new GridCellStyle(); row.GetCell("colN2").Style.ForeColor = COLOR.ARGB(255, 80, 80); row.GetCell("colN3").Style = new GridCellStyle(); row.GetCell("colN3").Style.ForeColor = COLOR.ARGB(255, 80, 255); } m_gridAllStockNews.Update(); m_gridAllStockNews.Invalidate(); }
/// <summary> /// 添加指标行 /// </summary> private void AddIndicatorRows() { List <SecurityFilterInfo> infos = new List <SecurityFilterInfo>(); m_task.GetSecurityInfos(infos); m_gridFilterResult.BeginUpdate(); int infosSize = infos.Count; for (int i = 0; i < infosSize; i++) { SecurityFilterInfo info = infos[i]; SecurityFilterResultRow row = new SecurityFilterResultRow(); row.Height = 30; row.Info = info; m_gridFilterResult.AddRow(row); SecurityFilterResultDoubleCell noCell = new SecurityFilterResultDoubleCell(); row.AddCell(0, noCell); SecurityFilterResultStringCell nameCell = new SecurityFilterResultStringCell(); nameCell.Text = info.Security.m_name; row.AddCell(1, nameCell); SecurityFilterResultDoubleCell closeCell = new SecurityFilterResultDoubleCell(); row.AddCell(2, closeCell); SecurityFilterResultDoubleCell diffCell = new SecurityFilterResultDoubleCell(); row.AddCell(3, diffCell); SecurityFilterResultDoubleCell volumeCell = new SecurityFilterResultDoubleCell(); row.AddCell(4, volumeCell); SecurityFilterResultDoubleCell highCell = new SecurityFilterResultDoubleCell(); row.AddCell(5, highCell); SecurityFilterResultDoubleCell lowCell = new SecurityFilterResultDoubleCell(); row.AddCell(6, lowCell); SecurityFilterResultDoubleCell buyCell = new SecurityFilterResultDoubleCell(); row.AddCell(7, buyCell); SecurityFilterResultDoubleCell sellCell = new SecurityFilterResultDoubleCell(); row.AddCell(8, sellCell); SecurityFilterResultDoubleCell diffRange = new SecurityFilterResultDoubleCell(); row.AddCell(9, diffRange); SecurityFilterResultDoubleCell openCell = new SecurityFilterResultDoubleCell(); row.AddCell(10, openCell); SecurityFilterResultStringCell codeCell = new SecurityFilterResultStringCell(); codeCell.Style.Font = new FONT("Arial", 14, false, false, false); codeCell.Text = info.Security.m_code; row.AddCell(11, codeCell); SecurityFilterResultDoubleCell lastCloseCell = new SecurityFilterResultDoubleCell(); row.AddCell(12, lastCloseCell); SecurityFilterResultDoubleCell amountCell = new SecurityFilterResultDoubleCell(); row.AddCell(13, amountCell); CIndicator indicator = m_task.Indicator; int index = 14; foreach (String name in indicator.MainVariables.Keys) { SecurityFilterResultDoubleCell indicatorCell = new SecurityFilterResultDoubleCell(); indicatorCell.FieldName = name; row.AddCell(index, indicatorCell); index++; } } m_gridFilterResult.EndUpdate(); }
/// <summary> /// 设置股票账户持仓信息 /// </summary> /// <param name="stockPositionResult"></param> private void SetSecurityPosition(String stockPositionResult) { m_dictSecurityPositions.Clear(); if (stockPositionResult == null || stockPositionResult.Length == 0) { return; } String[] lines = stockPositionResult.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (lines == null || lines.Length < 2) { return; } m_gridPositionAccount.BeginUpdate(); m_gridPositionAccount.ClearRows(); for (int i = 1; i < lines.Length; i++) { SecurityPosition position = SecurityPosition.ConvertToStockPosition(lines[i]); if (position != null) { m_dictSecurityPositions[position.m_stockCode] = position; GridRow row = new GridRow(); m_gridPositionAccount.AddRow(row); GridCell cell = new GridStringCell(position.m_stockCode); row.AddCell(0, cell); cell = new GridStringCell(position.m_stockName); row.AddCell(1, cell); cell = new GridDoubleCell(position.m_stockBalance); row.AddCell(2, cell); cell = new GridDoubleCell(position.m_availableBalance); row.AddCell(3, cell); cell = new GridDoubleCell(position.m_volume); row.AddCell(4, cell); cell = new GridDoubleCell(position.m_frozenVolume); row.AddCell(5, cell); cell = new GridDoubleCell(position.m_positionProfit); row.AddCell(6, cell); cell = new GridDoubleCell(position.m_positionCost); row.AddCell(7, cell); cell = new GridDoubleCell(position.m_positionProfitRatio); row.AddCell(8, cell); cell = new GridDoubleCell(position.m_marketPrice); row.AddCell(9, cell); cell = new GridDoubleCell(position.m_marketValue); row.AddCell(10, cell); cell = new GridDoubleCell(position.m_redemptionVolume); row.AddCell(11, cell); cell = new GridStringCell(position.m_marketName); row.AddCell(12, cell); cell = new GridStringCell(position.m_investorAccount); row.AddCell(13, cell); } } m_gridPositionAccount.EndUpdate(); m_gridPositionAccount.Invalidate(); }
/// <summary> /// 设置股票账户委托信息 /// </summary> /// <param name="commissionResult"></param> private void SetSecurityCommission(String commissionResult) { if (commissionResult == null || commissionResult.Length == 0) { return; } String[] lines = commissionResult.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (lines == null || lines.Length < 2) { return; } m_gridCommissionAccount.BeginUpdate(); m_gridCommissionAccount.ClearRows(); for (int i = 1; i < lines.Length; i++) { SecurityCommission commission = SecurityCommission.ConvertToSecurityCommission(lines[i]); if (commission != null) { GridRow row = new GridRow(); m_gridCommissionAccount.AddRow(row); GridCell cell = new GridStringCell(commission.m_orderDate); row.AddCell(0, cell); cell = new GridStringCell(commission.m_stockCode); row.AddCell(1, cell); cell = new GridStringCell(commission.m_stockName); row.AddCell(2, cell); cell = new GridStringCell(commission.m_operate); row.AddCell(3, cell); cell = new GridStringCell(commission.m_remark); row.AddCell(4, cell); cell = new GridDoubleCell(commission.m_orderVolume); row.AddCell(5, cell); cell = new GridDoubleCell(commission.m_tradeVolume); row.AddCell(6, cell); cell = new GridDoubleCell(commission.m_cancelVolume); row.AddCell(7, cell); cell = new GridDoubleCell(commission.m_orderPrice); row.AddCell(8, cell); cell = new GridStringCell(commission.m_orderType); row.AddCell(9, cell); cell = new GridDoubleCell(commission.m_tradeAvgPrice); row.AddCell(10, cell); cell = new GridStringCell(commission.m_orderSysID); row.AddCell(11, cell); } } m_gridCommissionAccount.EndUpdate(); m_gridCommissionAccount.Invalidate(); }
/// <summary> /// 设置股票账户成交信息 /// </summary> /// <param name="tradeResult"></param> private void SetSecurityTrade(String tradeResult) { if (tradeResult == null || tradeResult.Length == 0) { return; } String[] lines = tradeResult.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (lines == null || lines.Length < 2) { return; } m_gridTradeAccount.BeginUpdate(); m_gridTradeAccount.ClearRows(); for (int i = 1; i < lines.Length; i++) { SecurityTrade trade = SecurityTrade.ConvertToStockTrade(lines[i]); if (trade != null) { GridRow row = new GridRow(); m_gridTradeAccount.AddRow(row); GridCell cell = new GridStringCell(trade.m_tradeDate); row.AddCell(0, cell); cell = new GridStringCell(trade.m_stockCode); row.AddCell(1, cell); cell = new GridStringCell(trade.m_stockName); row.AddCell(2, cell); cell = new GridStringCell(trade.m_operate); row.AddCell(3, cell); cell = new GridDoubleCell(trade.m_tradeVolume); row.AddCell(4, cell); cell = new GridDoubleCell(trade.m_tradeAvgPrice); row.AddCell(5, cell); cell = new GridDoubleCell(trade.m_tradeAmount); row.AddCell(6, cell); cell = new GridStringCell(trade.m_orderSysID); row.AddCell(7, cell); cell = new GridStringCell(trade.m_orderTradeID); row.AddCell(8, cell); cell = new GridDoubleCell(trade.m_cancelVolume); row.AddCell(9, cell); cell = new GridDoubleCell(trade.m_stockBalance); row.AddCell(10, cell); } } m_gridTradeAccount.EndUpdate(); m_gridTradeAccount.Invalidate(); }
/// <summary> /// 绑定待选证券到表格 /// </summary> /// <param name="securities">证券列表</param> public void BindSecuritiesToSelectSecuritiesGrid(List <Security> securities) { m_gridSelectSecurities.BeginUpdate(); m_gridSelectSecurities.ClearRows(); int securitiesSize = securities.Count; for (int i = 0; i < securitiesSize; i++) { Security security = securities[i]; GridRow row = new GridRow(); m_gridSelectSecurities.AddRow(row); row.AddCell(0, new GridStringCell(security.m_code)); row.AddCell(1, new GridStringCell(security.m_name)); } m_gridSelectSecurities.EndUpdate(); m_gridSelectSecurities.Invalidate(); }
/// <summary> /// 绑定员工 /// </summary> public void BindStaffs() { m_gridStaffs.BeginUpdate(); List <StaffInfo> staffs = DataCenter.StaffService.GetAliveStaffs(); int staffsSize = staffs.Count; for (int i = 0; i < staffsSize; i++) { StaffInfo staff = staffs[i]; GridRow row = new GridRow(); m_gridStaffs.AddRow(row); row.AddCell(0, new GridStringCell(staff.m_jobID)); row.AddCell(1, new GridStringCell(staff.m_name)); } m_gridStaffs.EndUpdate(); m_gridStaffs.Invalidate(); }
/// <summary> /// 添加项目 /// </summary> /// <param name="project">项目</param> public void AddProjectToGrid(ProjectInfo project) { StaffService staffService = DataCenter.StaffService; List <GridRow> rows = m_gridProjects.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow findRow = rows[i]; if (findRow.GetCell("colP1").GetString() == project.m_pID) { findRow.GetCell("colP2").SetString(project.m_name); findRow.GetCell("colP3").SetString(project.m_jobIds); findRow.GetCell("colP4").SetString(staffService.GetNamesByJobsID(project.m_jobIds)); findRow.GetCell("colP5").SetString(project.m_center); findRow.GetCell("colP6").SetString(staffService.GetNamesByJobsID(project.m_center)); findRow.GetCell("colP7").SetString(project.m_state); findRow.GetCell("colP8").SetString(project.m_startDate); findRow.GetCell("colP9").SetString(project.m_endDate); return; } } GridRow row = new GridRow(); m_gridProjects.AddRow(row); row.AddCell("colP1", new GridStringCell(project.m_pID)); row.AddCell("colP2", new GridStringCell(project.m_name)); row.AddCell("colP3", new GridStringCell(project.m_jobIds)); row.AddCell("colP4", new GridStringCell(staffService.GetNamesByJobsID(project.m_jobIds))); row.AddCell("colP5", new GridStringCell(project.m_center)); row.AddCell("colP6", new GridStringCell(staffService.GetNamesByJobsID(project.m_center))); row.AddCell("colP7", new GridStringCell(project.m_state)); row.AddCell("colP8", new GridStringCell(project.m_startDate)); row.AddCell("colP9", new GridStringCell(project.m_endDate)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 1; j < cellsSize; j++) { if (cells[j].Column.Name != "colP3" && cells[j].Column.Name != "colP4" && cells[j].Column.Name != "colP5" && cells[j].Column.Name != "colP6") { cells[j].AllowEdit = true; } } }
/// <summary> /// 添加模板到表格控件中 /// </summary> /// <param name="serverInfos">服务器信息</param> private void AddServersToGrid(List <ServerInfo> serverInfos) { m_gridServers.BeginUpdate(); int serversInfosSize = serverInfos.Count; GridRow selectedRow = null; for (int i = 0; i < serversInfosSize; i++) { ServerInfo serverInfo = serverInfos[i]; GridRow row = new GridRow(); row.Grid = m_gridServers; GridStringCell idCell = new GridStringCell(); idCell.Grid = m_gridServers; idCell.Column = m_gridServers.GetColumn(0); idCell.Text = serverInfo.m_id; row.AddCell(0, idCell); GridStringCell ipCell = new GridStringCell(); ipCell.Grid = m_gridServers; ipCell.Column = m_gridServers.GetColumn(1); ipCell.Text = serverInfo.m_ip; row.AddCell(1, ipCell); GridStringCell portCell = new GridStringCell(); portCell.Grid = m_gridServers; portCell.Column = m_gridServers.GetColumn(2); portCell.Text = serverInfo.m_port.ToString(); row.AddCell(2, portCell); GridStringCell typeCell = new GridStringCell(); typeCell.Grid = m_gridServers; typeCell.Column = m_gridServers.GetColumn(3); typeCell.Text = serverInfo.m_type; row.AddCell(3, typeCell); m_gridServers.AddRow(row); selectedRow = row; } //选中行 if (selectedRow != null) { List <GridRow> selectedRows = new List <GridRow>(); selectedRows.Add(selectedRow); m_gridServers.SelectedRows = selectedRows; } m_gridServers.EndUpdate(); m_gridServers.VScrollBar.ScrollToEnd(); }
/// <summary> /// 添加员工 /// </summary> /// <param name="staff">员工</param> public void AddStaffToGrid(StaffInfo staff) { List <GridRow> rows = m_gridStaffs.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow findRow = rows[i]; if (findRow.GetCell("colS1").GetString() == staff.m_jobID) { findRow.GetCell("colS2").SetString(staff.m_name); findRow.GetCell("colS3").SetString(staff.m_sex); findRow.GetCell("colS4").SetString(staff.m_state); findRow.GetCell("colS5").SetString(staff.m_education); findRow.GetCell("colS6").SetString(staff.m_degree); findRow.GetCell("colS7").SetString(staff.m_birthDay); findRow.GetCell("colS8").SetString(staff.m_entryDay); findRow.GetCell("colS9").SetString(staff.m_canSelect); findRow.GetCell("colS10").SetString(staff.m_isManager); return; } } GridRow row = new GridRow(); m_gridStaffs.AddRow(row); row.AddCell("colS1", new GridStringCell(staff.m_jobID)); row.AddCell("colS2", new GridStringCell(staff.m_name)); row.AddCell("colS3", new GridStringCell(staff.m_sex)); row.AddCell("colS4", new GridStringCell(staff.m_state)); row.AddCell("colS5", new GridStringCell(staff.m_education)); row.AddCell("colS6", new GridStringCell(staff.m_degree)); row.AddCell("colS7", new GridStringCell(staff.m_birthDay)); row.AddCell("colS8", new GridStringCell(staff.m_entryDay)); row.AddCell("colS9", new GridStringCell(staff.m_canSelect)); row.AddCell("colS10", new GridStringCell(staff.m_isManager)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 1; j < cellsSize; j++) { cells[j].AllowEdit = true; } }
/// <summary> /// 添加数据 /// </summary> public void AddData(List <Expression> list, String str) { m_searchTable.BeginUpdate(); GridRow row = new GridRow(); m_searchTable.AddRow(row); String strEx = ""; for (int i = 0; i < list.Count; i++) { Expression expression = list[i]; strEx += expression.getExpression(); } GridCell cell1 = new GridCellExp(str); row.AddCell("colT1", cell1); GridCell cell = new GridCellExp(strEx); row.AddCell("colT2", cell); m_searchTable.EndUpdate(); m_searchTable.Invalidate(); }
/// <summary> /// 添加布局到表格控件中 /// </summary> /// <param name="layouts">布局列表</param> private void AddLayoutsToGrid(List <IndicatorLayout> layouts) { m_gridLayouts.BeginUpdate(); int layoutsSize = layouts.Count; for (int i = 0; i < layoutsSize; i++) { IndicatorLayout layout = layouts[i]; GridRow row = new GridRow(); row.Grid = m_gridLayouts; GridStringCell idCell = new GridStringCell(); idCell.Grid = m_gridLayouts; idCell.Column = m_gridLayouts.GetColumn(0); idCell.Text = layout.m_layoutID; row.AddCell(0, idCell); GridStringCell textCell = new GridStringCell(); textCell.Grid = m_gridLayouts; textCell.Column = m_gridLayouts.GetColumn(1); textCell.Text = layout.m_name; row.AddCell(1, textCell); m_gridLayouts.AddRow(row); } m_gridLayouts.EndUpdate(); }
/// <summary> /// 加载图标 /// </summary> private void LoadIcons() { String dir = DataCenter.GetAppPath() + "\\config\\icons\\"; m_gridIcons.ResourcePath = dir; List <String> files = new List <String>(); CFileA.GetFiles(dir, files); int filesSize = files.Count; int columnsSize = m_gridIcons.GetColumns().Count; m_gridIcons.BeginUpdate(); GridRow row = null; for (int i = 0; i < filesSize; i++) { int col = i; if (i >= columnsSize) { col = i % columnsSize; } if (col == 0) { row = new GridRow(); row.Height = 64; m_gridIcons.AddRow(row); } String file = files[i]; file = file.Substring(file.LastIndexOf('\\') + 1); GridIconCell iconCell = new GridIconCell(); iconCell.SetString(file); row.AddCell(col, iconCell); } m_gridIcons.EndUpdate(); m_gridIcons.Invalidate(); }
/// <summary> /// 添加宏到表格控件中 /// </summary> /// <param name="macros">布局列表</param> private void AddMacrosToGrid(List <Macro> macros) { m_gridMacros.BeginUpdate(); int macrosSize = macros.Count; for (int i = 0; i < macrosSize; i++) { Macro macro = macros[i]; GridRow row = new GridRow(); row.Grid = m_gridMacros; GridStringCell idCell = new GridStringCell(); idCell.Grid = m_gridMacros; idCell.Column = m_gridMacros.GetColumn(0); idCell.Text = macro.m_macroID; row.AddCell(0, idCell); GridStringCell textCell = new GridStringCell(); textCell.Grid = m_gridMacros; textCell.Column = m_gridMacros.GetColumn(1); textCell.Text = macro.m_name; row.AddCell(1, textCell); m_gridMacros.AddRow(row); } m_gridMacros.EndUpdate(); }
/// <summary> /// 添加模板到表格控件中 /// </summary> /// <param name="templates">模板列表</param> private void AddTemplatesToGrid(List <SecurityFilterTemplate> templates) { m_gridTemplate.BeginUpdate(); int templatesSize = templates.Count; for (int i = 0; i < templatesSize; i++) { SecurityFilterTemplate template = templates[i]; GridRow row = new GridRow(); row.Grid = m_gridTemplate; GridStringCell idCell = new GridStringCell(); idCell.Grid = m_gridTemplate; idCell.Column = m_gridTemplate.GetColumn(0); idCell.Text = template.m_templateID; row.AddCell(0, idCell); GridStringCell textCell = new GridStringCell(); textCell.Grid = m_gridTemplate; textCell.Column = m_gridTemplate.GetColumn(1); textCell.Text = template.m_name; row.AddCell(1, textCell); m_gridTemplate.AddRow(row); } m_gridTemplate.EndUpdate(); }