/// <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(); } }
/// <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() { 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() { 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() { 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() { 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() { 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() { 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() { 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() { 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() { 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() { 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() { CalendarService calendarService = DataCenter.CalendarService; EventInfo eventInfo = new EventInfo(); calendarService.AddEvent(GetSelectedDay(), eventInfo); AddEventToGrid(eventInfo); m_gridEvents.Update(); if (m_gridEvents.VScrollBar != null) { m_gridEvents.VScrollBar.ScrollToEnd(); } Native.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> 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> /// <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> /// <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="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> public override void OnAdd() { base.OnAdd(); if (m_gridTransaction == null) { m_latestData = new SecurityLatestData(); m_latestDataLV2 = new SecurityLatestDataLV2(); m_gridTransaction = new GridA(); m_gridTransaction.BackColor = COLOR.EMPTY; m_gridTransaction.BorderColor = COLOR.EMPTY; m_gridTransaction.GridLineColor = COLOR.EMPTY; m_gridTransaction.HeaderVisible = false; m_gridTransaction.SelectionMode = GridSelectionMode.SelectNone; AddControl(m_gridTransaction); GridColumn dateColumn = new GridColumn(); dateColumn.Width = 80; m_gridTransaction.AddColumn(dateColumn); GridColumn priceColumn = new GridColumn(); priceColumn.Width = 70; m_gridTransaction.AddColumn(priceColumn); GridColumn volumeColumn = new GridColumn(); volumeColumn.Width = 100; m_gridTransaction.AddColumn(volumeColumn); m_gridTransaction.Update(); } }
/// <summary> /// 执行秒表方法 /// </summary> /// <param name="timerID">秒表ID</param> public void OnTimer(int timerID) { if (m_timerID == timerID) { if (m_task != null) { int runningState = m_task.RunningState; if (runningState != m_runningState) { int size = m_task.GetSecurityInfosSize(); int matchCount = m_task.MatchCount; String title = "条件选股"; if (runningState == -1) { if (size > 0) { title += " 符合条件数:(" + matchCount.ToString() + "/" + size.ToString() + ")"; } } else if (runningState == 0) { title += "(正在下载数据...)"; } else { if (size > 0) { title += "(计算中,进度:" + runningState.ToString() + "/" + size.ToString() + ",符合数:" + matchCount.ToString() + ")"; } } if (runningState != m_runningState && runningState == -1) { List <GridColumn> columns = m_gridFilterResult.GetColumns(); GridColumn filterColumn = null; int columnsSize = columns.Count; for (int i = 0; i < columnsSize; i++) { if (columns[i].Name == "FILTER") { filterColumn = columns[i]; break; } } if (filterColumn != null) { m_gridFilterResult.SortColumn(m_gridFilterResult, filterColumn, GridColumnSortMode.Desc); m_gridFilterResult.Update(); } } m_window.Text = title; m_runningState = runningState; m_window.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(); }
/// <summary> /// 调用控件线程方法 /// </summary> /// <param name="args">参数</param> public void OnInvoke(object args) { CMessage message = (CMessage)args; List <Macro> macros = new List <Macro>(); MacroService.GetMacros(macros, message.m_body, message.m_bodyLength); int macrosSize = macros.Count; switch (message.m_functionID) { case MacroService.FUNCTIONID_MACRO_ADDMACROS: AddMacrosToGrid(macros); break; case MacroService.FUNCTIONID_MACRO_DELETEMACROS: { Dictionary <String, GridRow> mRowsMap = GetMacroRows(); for (int i = 0; i < macrosSize; i++) { Macro macro = macros[i]; if (mRowsMap.ContainsKey(macro.m_macroID)) { m_gridMacros.RemoveRow(mRowsMap[macro.m_macroID]); } } m_gridMacros.Update(); break; } case MacroService.FUNCTIONID_MACRO_UPDATEMACROS: { Dictionary <String, GridRow> mRowsMap = GetMacroRows(); for (int i = 0; i < macrosSize; i++) { Macro macro = macros[i]; if (mRowsMap.ContainsKey(macro.m_macroID)) { mRowsMap[macro.m_macroID].GetCell(1).Text = macro.m_name; } } break; } } m_window.Invalidate(); }
/// <summary> /// 调用控件线程方法 /// </summary> /// <param name="args">参数</param> public void OnInvoke(object args) { CMessage message = (CMessage)args; List <IndicatorLayout> layouts = new List <IndicatorLayout>(); IndicatorLayoutService.GetLayouts(layouts, message.m_body, message.m_bodyLength); int layoutsSize = layouts.Count; switch (message.m_functionID) { case IndicatorLayoutService.FUNCTIONID_INDICATORLAYOUT_ADDLAYOUTS: AddLayoutsToGrid(layouts); break; case IndicatorLayoutService.FUNCTIONID_INDICATORLAYOUT_DELETELAYOUTS: { Dictionary <String, GridRow> ilRowsMap = GetIndicatorLayoutsRows(); for (int i = 0; i < layoutsSize; i++) { IndicatorLayout layout = layouts[i]; if (ilRowsMap.ContainsKey(layout.m_layoutID)) { m_gridLayouts.RemoveRow(ilRowsMap[layout.m_layoutID]); } } m_gridLayouts.Update(); break; } case IndicatorLayoutService.FUNCTIONID_INDICATORLAYOUT_UPDATELAYOUTS: { Dictionary <String, GridRow> ilRowsMap = GetIndicatorLayoutsRows(); for (int i = 0; i < layoutsSize; i++) { IndicatorLayout layout = layouts[i]; if (ilRowsMap.ContainsKey(layout.m_layoutID)) { ilRowsMap[layout.m_layoutID].GetCell(1).Text = layout.m_name; } } break; } } m_window.Invalidate(); }
/// <summary> /// 调用控件线程方法 /// </summary> /// <param name="args">参数</param> public void OnInvoke(object args) { CMessage message = (CMessage)args; List <SecurityFilterTemplate> templates = new List <SecurityFilterTemplate>(); SecurityFilterService.GetTemplates(templates, message.m_body, message.m_bodyLength); int templatesSize = templates.Count; switch (message.m_functionID) { case SecurityFilterService.FUNCTIONID_SECURITYFILTER_ADDTEMPLATES: AddTemplatesToGrid(templates); break; case SecurityFilterService.FUNCTIONID_SECURITYFILTER_DELETETEMPLATES: { Dictionary <String, GridRow> templateRowsMap = GetTemplateRows(); for (int i = 0; i < templatesSize; i++) { SecurityFilterTemplate template = templates[i]; if (templateRowsMap.ContainsKey(template.m_templateID)) { m_gridTemplate.RemoveRow(templateRowsMap[template.m_templateID]); } } m_gridTemplate.Update(); break; } case SecurityFilterService.FUNCTIONID_SECURITYFILTER_UPDATETEMPLATES: { Dictionary <String, GridRow> templateRowsMap = GetTemplateRows(); for (int i = 0; i < templatesSize; i++) { SecurityFilterTemplate template = templates[i]; if (templateRowsMap.ContainsKey(template.m_templateID)) { templateRowsMap[template.m_templateID].GetCell(1).Text = template.m_name; } } break; } } m_window.Invalidate(); }
/// <summary> /// 单元格双击事件 /// </summary> /// <param name="sender">调用者</param> /// <param name="cell">单元格</param> /// <param name="mp">坐标</param> /// <param name="button">按钮</param> /// <param name="clicks">点击次数</param> /// <param name="delta">滚轮值</param> private void GridCellClick(object sender, GridCell cell, POINT mp, MouseButtonsA button, int clicks, int delta) { if (cell.Grid == m_tvIndicatorBrowser) { TreeNodeA tn = cell as TreeNodeA; if (tn.m_nodes.Count == 0) { NodeData nodeData = tn.Tag as NodeData; if (nodeData.IsCatalog) { IndicatorLeafDataPacket leafPacket = new IndicatorLeafDataPacket(nodeData.Id); ConnectManager.CreateInstance().Request(leafPacket); int tick = 0; while (leafPacket.ReserveFlag == 0 && tick < 50) { Thread.Sleep(100); tick++; } if (leafPacket.LeafNodeList.Count > 0) { List <NodeData> nodes = leafPacket.LeafNodeList; Dictionary <String, TreeNodeA> nodesMap = new Dictionary <String, TreeNodeA>(); int nodesSzie = nodes.Count; for (int i = 0; i < nodesSzie; i++) { NodeData node = nodes[i]; TreeNodeA subTn = new TreeNodeA(); subTn.Text = node.Name; subTn.Style = new GridCellStyle(); subTn.Style.ForeColor = COLOR.ARGB(255, 255, 80); subTn.Style.Font = new FONT("微软雅黑", 14, true, false, false); subTn.Name = node.Id; subTn.Tag = node; if (nodesMap.ContainsKey(node.ParentId)) { nodesMap[node.ParentId].AppendNode(subTn); nodesMap[node.Id] = subTn; } else { tn.AppendNode(subTn); nodesMap[node.Id] = subTn; } IndicatorEntityDataPacket entity = new IndicatorEntityDataPacket(node.Id); ConnectManager.CreateInstance().Request(entity); } tn.ExpendAll(); m_tvIndicatorBrowser.Update(); m_tvIndicatorBrowser.Invalidate(); } } else { StringBuilder sb = new StringBuilder(); CList <GSecurity> securities = SecurityService.FilterCode(m_txtIndicatorCode.Text); int codesSize = securities.size(); for (int i = 0; i < codesSize; i++) { sb.Append(securities.get(i).m_code); if (i != codesSize - 1) { sb.Append(","); } } m_gridIndicatorBrowser.ClearRows(); IndicatorRootData data = GetIndicatorData(nodeData.Id, "Stock", sb.ToString()); m_gridIndicatorBrowser.GetColumn("colN3").Text = data.categoryName; foreach (IndicatorItemData indicatorItem in data.items) { GridRow row = new GridRow(); m_gridIndicatorBrowser.AddRow(row); GridStringCell codeCell = new GridStringCell(indicatorItem.code); row.AddCell("colN1", codeCell); GSecurity security = new GSecurity(); SecurityService.GetSecurityByCode(indicatorItem.code, ref security); row.AddCell("colN2", new GridStringCell(security.m_name)); if (indicatorItem.type == 0) { GridStringCell valueCell = new GridStringCell(indicatorItem.text); row.AddCell("colN3", valueCell); } else if (indicatorItem.type == 1) { GridDoubleCell valueCell = new GridDoubleCell(indicatorItem.num); row.AddCell("colN3", valueCell); } row.GetCell("colN1").Style = new GridCellStyle(); row.GetCell("colN1").Style.ForeColor = COLOR.ARGB(255, 255, 80); row.GetCell("colN1").Style.Font = new FONT("微软雅黑", 14, true, false, false); row.GetCell("colN1").Style.Font = new FONT("微软雅黑", 14, true, false, false); row.GetCell("colN2").Style = new GridCellStyle(); row.GetCell("colN2").Style.ForeColor = COLOR.ARGB(255, 80, 80); row.GetCell("colN2").Style.Font = new FONT("微软雅黑", 14, true, false, false); row.GetCell("colN3").Style = new GridCellStyle(); row.GetCell("colN3").Style.ForeColor = COLOR.ARGB(80, 255, 255); row.GetCell("colN3").Style.Font = new FONT("微软雅黑", 14, true, false, false); } m_gridIndicatorBrowser.Update(); m_gridIndicatorBrowser.Invalidate(); } } } else if (cell.Grid == m_gridIndicatorBrowser) { if (clicks == 2) { m_mainFrame.SearchSecurity(cell.Row.GetCell("colN1").GetString()); } } }
/// <summary> /// 绑定所有的群组 /// </summary> private void BindGroups() { m_gridGroups.UseAnimation = true; List <GridRow> rows = m_gridGroups.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow row = rows[i]; if (row.EditButton != null) { m_gridGroups.RemoveControl(row.EditButton); row.EditButton = null; } m_gridGroups.RemoveRow(row); i--; rowsSize--; } m_gridGroups.Update(); GridRow firstRow = new GridRow(); m_gridGroups.AddRow(firstRow); GridStringCell cell1 = new GridStringCell(""); firstRow.AddCell("colG1", cell1); GridStringCell cell2 = new GridStringCell("全部"); firstRow.AddCell("colG2", cell2); GridStringCell cell3 = new GridStringCell(""); firstRow.AddCell("colG3", cell3); int groupsSize = m_chatGroups.Count; for (int i = 0; i < groupsSize; i++) { ChatGroup chatGroup = m_chatGroups[i]; GridRow cRow = new GridRow(); m_gridGroups.AddRow(cRow); ButtonA deleteButton = new ButtonA(); deleteButton.Height = cRow.Height; deleteButton.Name = "btnDelete"; deleteButton.Tag = chatGroup.Name; deleteButton.BackColor = COLOR.ARGB(255, 0, 0); deleteButton.Native = m_gridHosts.Native; deleteButton.Text = "删除"; cRow.EditButton = deleteButton; cRow.AllowEdit = true; GridStringCell cCell1 = new GridStringCell(chatGroup.Name); cRow.AddCell("colG1", cCell1); GridStringCell cCell2 = new GridStringCell(chatGroup.DisplayName); cRow.AddCell("colG2", cCell2); String strIDs = ""; int userIDsSize = chatGroup.UserIDs.Count; for (int j = 0; j < userIDsSize; j++) { strIDs += chatGroup.UserIDs[j]; if (j != userIDsSize - 1) { strIDs += ","; } } GridStringCell cCell3 = new GridStringCell(strIDs); cRow.AddCell("colG3", cCell3); ControlMouseEvent clickButtonEvent = new ControlMouseEvent(ClickEvent); deleteButton.RegisterEvent(clickButtonEvent, EVENTID.CLICK); } m_gridGroups.Update(); m_gridGroups.Invalidate(); }
/// <summary> /// 依据ID判断更新或者插入 /// </summary> /// <param name="jira">Jira对象</param> public void AddOrUpdate(Jira jira) { //设置样式 GridCellStyle gridStyle = new GridCellStyle(); gridStyle.BackColor = COLOR.DISABLEDCONTROL; List <GridRow> rows = m_gridDgvTable.m_rows; int size = rows.Count; //没有数据 if (size <= 0) { Addrows(jira); return; } bool isAddRow = true; for (int i = 0; i < size; i++) { //GridCellStyle gridStyle = new GridCellStyle(); //gridStyle.BackColor = COLOR.DISABLEDCONTR; GridRow row = rows[i]; String id = row.GetCell("colT1").Text; GridCellStyle gridStyle1 = new GridCellStyle(); gridStyle1.BackColor = COLOR.DISABLEDCONTROL; gridStyle1.ForeColor = COLOR.ARGB(255, 97, 0); row.GetCell("colT1").Style = gridStyle1; //根据ID来决定是插入还是更新 if (id == jira.JiraID) { isAddRow = false; GridCellStyle gridStyle2 = new GridCellStyle(); gridStyle2.BackColor = COLOR.DISABLEDCONTROL; gridStyle2.ForeColor = COLOR.ARGB(0, 255, 0); row.GetCell("colT2").Style = gridStyle2; row.GetCell("colT2").Text = jira.Title; row.GetCell("colT3").Text = jira.Creater; row.GetCell("colT4").Text = jira.Developer; int count = XmlHandle.Groups.Count; for (int m = 0; m < count; m++) { if (XmlHandle.Groups[m].Id == jira.GroupID) { GridCell cell5 = new GridCellExp(XmlHandle.Groups[m].Name); row.AddCell("colT5", cell5); GridCell cell6 = new GridCellExp(XmlHandle.Groups[m].Manager); row.AddCell("colT6", cell6); List <JCategory> categories = XmlHandle.Groups[m].Categories; int cateCount = categories.Count; for (int n = 0; n < cateCount; n++) { if (categories[n].Id == jira.CategoryID) { GridCell cell7 = new GridCellExp(categories[n].Name); row.AddCell("colT7", cell7); break; } } break; } } row.GetCell("colT8").Text = jira.DeveloperReceive ? "是" : "否"; row.GetCell("colT9").Text = jira.DeveloperPass ? "是" : "否"; row.GetCell("colT10").Text = jira.TestPass ? "是" : "否"; row.GetCell("colT11").Text = jira.ProductPass ? "是" : "否"; row.GetCell("colT12").Text = jira.WaitPublish ? "是" : "否"; row.GetCell("colT13").Text = jira.Published ? "是" : "否"; row.GetCell("colT14").Text = jira.CloseTask ? "是" : "否"; row.GetCell("colT15").Text = jira.Hurry; DateTime dt = DateTime.Now; String status = jira.EndDate.ToFileTime() > dt.ToFileTime() ? "(超时)" : "(正常)"; GridCell cell16 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString()); row.GetCell("colT16").Text = cell16.Text; GridCell cell17 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString()); row.GetCell("colT17").Text = cell17.Text; m_gridDgvTable.Update(); return; } } //新增 if (isAddRow) { Addrows(jira); return; } }
/// <summary> /// 获取表格 /// </summary> /// <param name="bytes">流</param> /// <param name="native">方法库</param> /// <returns>表格</returns> public GridA GetGrid(byte[] bytes, INativeBase native) { Binary br = new Binary(); br.Write(bytes, bytes.Length); GridA grid = new GridA(); grid.Native = native; grid.Name = br.ReadString(); int columnsSize = br.ReadInt(); for (int i = 0; i < columnsSize; i++) { GridColumn column = new GridColumn(); column.Name = br.ReadString(); column.ColumnType = br.ReadString(); grid.AddColumn(column); } grid.Update(); List <GridColumn> columns = grid.GetColumns(); int rowsCount = br.ReadInt(); for (int i = 0; i < rowsCount; i++) { GridRow row = new GridRow(); grid.AddRow(row); for (int j = 0; j < columnsSize; j++) { GridColumn column = columns[j]; string columnType = column.ColumnType.ToLower(); GridCell cell = null; if (columnType == "bool") { cell = new GridBoolCell(); row.AddCell(j, cell); cell.SetBool(br.ReadBool()); } else if (columnType == "double") { cell = new GridDoubleCell(); row.AddCell(j, cell); cell.SetDouble(br.ReadDouble()); } else if (columnType == "float") { cell = new GridFloatCell(); row.AddCell(j, cell); cell.SetFloat(br.ReadFloat()); } else if (columnType == "int") { cell = new GridIntCell(); row.AddCell(j, cell); cell.SetInt(br.ReadInt()); } else if (columnType == "long") { cell = new GridLongCell(); row.AddCell(j, cell); cell.SetLong((long)br.ReadDouble()); } else if (columnType == "string") { cell = new GridStringCell(); row.AddCell(j, cell); cell.SetString(br.ReadString()); } else { cell = new GridStringCell(); row.AddCell(j, cell); cell.SetString(br.ReadString()); } } } br.Close(); return(grid); }