/// <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="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="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> public void Add() { RemoteInfo remote = new RemoteInfo(); remote.m_ID = DataCenter.RemoteService.GetNewID(); DataCenter.RemoteService.Save(remote); AddRemoteToGrid(remote); m_gridRemotes.Update(); if (m_gridRemotes.VScrollBar != null) { m_gridRemotes.VScrollBar.ScrollToEnd(); } m_gridRemotes.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { ProjectInfo project = new ProjectInfo(); project.m_pID = DataCenter.ProjectService.GetNewPID(); DataCenter.ProjectService.Save(project); AddProjectToGrid(project); m_gridProjects.Update(); if (m_gridProjects.VScrollBar != null) { m_gridProjects.VScrollBar.ScrollToEnd(); } m_gridProjects.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { GitInfo git = new GitInfo(); git.m_ID = DataCenter.GitService.GetNewID(); DataCenter.GitService.Save(git); AddGitToGrid(git); m_gridGit.Update(); if (m_gridGit.VScrollBar != null) { m_gridGit.VScrollBar.ScrollToEnd(); } m_gridGit.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { ExamInfo exam = new ExamInfo(); exam.m_ID = DataCenter.ExamService.GetNewID(); DataCenter.ExamService.Save(exam); AddExamToGrid(exam); m_gridExams.Update(); if (m_gridExams.VScrollBar != null) { m_gridExams.VScrollBar.ScrollToEnd(); } m_gridExams.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { MasterInfo master = new MasterInfo(); master.m_ID = DataCenter.MasterService.GetNewID(); DataCenter.MasterService.Save(master); AddMasterToGrid(master); m_gridMasters.Update(); if (m_gridMasters.VScrollBar != null) { m_gridMasters.VScrollBar.ScrollToEnd(); } m_gridMasters.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { ClueInfo clue = new ClueInfo(); clue.m_ID = DataCenter.ClueService.GetNewID(); DataCenter.ClueService.Save(clue); AddClueToGrid(clue); m_gridClues.Update(); if (m_gridClues.VScrollBar != null) { m_gridClues.VScrollBar.ScrollToEnd(); } m_gridClues.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { LevelInfo level = new LevelInfo(); level.m_ID = DataCenter.LevelService.GetNewID(); DataCenter.LevelService.Save(level); AddLevelToGrid(level); m_gridLevels.Update(); if (m_gridLevels.VScrollBar != null) { m_gridLevels.VScrollBar.ScrollToEnd(); } m_gridLevels.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { BusinessCardInfo card = new BusinessCardInfo(); card.m_ID = DataCenter.BusinessCardService.GetNewID(); DataCenter.BusinessCardService.Save(card); AddCardToGrid(card); m_gridBusinessCards.Update(); if (m_gridBusinessCards.VScrollBar != null) { m_gridBusinessCards.VScrollBar.ScrollToEnd(); } m_gridBusinessCards.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { StaffInfo staff = new StaffInfo(); staff.m_jobID = DataCenter.StaffService.GetNewJobID(); DataCenter.StaffService.Save(staff); AddStaffToGrid(staff); m_gridStaffs.Update(); if (m_gridStaffs.VScrollBar != null) { m_gridStaffs.VScrollBar.ScrollToEnd(); } m_gridStaffs.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { OpinionInfo opinion = new OpinionInfo(); opinion.m_ID = DataCenter.OpinionService.GetNewID(); DataCenter.OpinionService.Save(opinion); AddOpinionToGrid(opinion); m_gridOpinions.Update(); if (m_gridOpinions.VScrollBar != null) { m_gridOpinions.VScrollBar.ScrollToEnd(); } m_gridOpinions.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { ServerInfo server = new ServerInfo(); server.m_ID = DataCenter.ServerService.GetNewID(); DataCenter.ServerService.Save(server); AddServerToGrid(server); m_gridServers.Update(); if (m_gridServers.VScrollBar != null) { m_gridServers.VScrollBar.ScrollToEnd(); } m_gridServers.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { BSStockInfo bsStock = new BSStockInfo(); bsStock.m_ID = DataCenter.BSStockService.GetNewID(); DataCenter.BSStockService.Save(bsStock); AddCodeToGrid(bsStock); m_gridBSStocks.Update(); if (m_gridBSStocks.VScrollBar != null) { m_gridBSStocks.VScrollBar.ScrollToEnd(); } m_gridBSStocks.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { FollowInfo follow = new FollowInfo(); follow.m_ID = DataCenter.FollowService.GetNewID(); DataCenter.FollowService.Save(follow); AddFollowToGrid(follow); m_gridFollows.Update(); if (m_gridFollows.VScrollBar != null) { m_gridFollows.VScrollBar.ScrollToEnd(); } m_gridFollows.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { DialogInfo dialog = new DialogInfo(); dialog.m_ID = DataCenter.DialogService.GetNewID(); dialog.m_date = DateTime.Now.ToString("yyyyMMdd"); DataCenter.DialogService.Save(dialog); AddDialogToGrid(dialog); m_gridDialogs.Update(); if (m_gridDialogs.VScrollBar != null) { m_gridDialogs.VScrollBar.ScrollToEnd(); } m_gridDialogs.Invalidate(); }
/// <summary> /// 添加 /// </summary> public void Add() { AwardService awardService = DataCenter.AwardService; AwardInfo award = new AwardInfo(); award.m_ID = awardService.GetNewID(); awardService.Save(award); AddAwardToGrid(award); m_gridAwards.Update(); if (m_gridAwards.VScrollBar != null) { m_gridAwards.VScrollBar.ScrollToEnd(); } m_gridAwards.Invalidate(); }
/// <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 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> /// 加载XML /// </summary> /// <param name="xmlPath">XML路径</param> public override void Load(String xmlPath) { LoadFile(xmlPath, null); DataCenter.MainUI = this; ControlA control = Native.GetControls()[0]; control.BackColor = COLOR.CONTROL; RegisterEvents(control); m_jiras.Clear(); //从服务端拿取数据 m_jiras = XmlHandle.GetJiras(); this.m_gridDgvTable = GetGrid("dgvTable"); //注册事件,这样可以在一个自定义方法里监听 m_gridDgvTable.RegisterEvent(new ControlTimerEvent(TimerEvent), EVENTID.TIMER); m_timerID = ControlA.GetNewTimerID(); m_gridDgvTable.StartTimer(m_timerID, 1000); int size = m_jiras.Count; for (int i = 0; i < size; i++) { Jira jira = m_jiras[i]; AddOrUpdate(jira);//添加一行 } //刷新界面 m_gridDgvTable.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="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> 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="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> private void BindEvents() { m_gridEvents.CellEditMode = GridCellEditMode.DoubleClick; List <EventInfo> events = DataCenter.CalendarService.GetEvents(GetSelectedDay()); int eventsSize = events.Count; m_gridEvents.ClearRows(); m_gridEvents.BeginUpdate(); for (int i = 0; i < eventsSize; i++) { EventInfo eventInfo = events[i]; AddEventToGrid(eventInfo); } m_gridEvents.EndUpdate(); m_gridEvents.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="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> private void SetHostGridRowVisible() { ChatGroup chatGroup = null; int chatGroupsSize = m_chatGroups.Count; for (int i = 0; i < chatGroupsSize; i++) { if (m_chatGroups[i].Name == m_currentGroupName) { chatGroup = m_chatGroups[i]; break; } } List <GridRow> rows = m_gridHosts.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow row = rows[i]; if (m_currentGroupName == "") { row.Visible = true; } else { if (chatGroup != null) { if (chatGroup.UserIDs.Contains(row.GetCell("colP3").GetString())) { row.Visible = true; } else { row.Visible = false; } } else { row.Visible = true; } } } m_gridHosts.Update(); m_gridHosts.Invalidate(); }