public static GridRow BindVtmGridData(Vtm source) { var row = new GridRow { IdentityValue = source.VtmId }; row.AddCell(source.DrugName); row.AddCell(source.DmdRoute.Route); row.AddCell(source.DmdSupplier.SupplierName); row.AddCell(source.BrandName); if (source.IsLicensed) { row.AddCell("Yes"); } else { row.AddCell("No", cellCss: "text-danger"); } if (source.IsLicensed) { row.AddActionIcon("fa fa-ban text-danger", "Licensed proudct can not be modified"); return(row); } row.AddActionIcon("fa fa-edit text-success", "Click to view/edit"); row.AddActionIcon("fa fa-trash text-danger", "Click to remove this item"); return(row); }
/// <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; } }
public static GridRow BindGridData(IntegrationOrder source) { var row = new GridRow { IdentityValue = source.Id }; row.AddCell(source.Name); row.AddCell(source.AllocatedIsolatorId.ToString()); row.AddCell(source.BookedInDate == null ? "" : ((DateTime)source.BookedInDate).ToString("dd/MM/yyyy")); row.AddCell(((OrderProgressEnum)source.OrderLastProgressId).ToString()); //row.AddCell(source.ExternalBarcode); //row.AddCell(source.ExternalOrderId); row.AddCell(source.RequiredDate == null ? "" : ((DateTime)source.RequiredDate).ToString("dd/MM/yyyy")); row.AddCell(source.ScheduledDate == null ? "" : ((DateTime)source.ScheduledDate).ToString("dd/MM/yyyy")); row.AddActionIcon("fa fa-edit text-success", "Click to view/edit"); row.AddActionIcon("fa fa-info-circle text-success compareVersion", "Compare version"); //if(!source.IntegrationOrderProgress.Name.Contains("Decline", StringComparison.OrdinalIgnoreCase)) if (source.OrderLastProgressId == null) { row.AddActionIcon("fa fa-check text-success", "Click to authorize request"); row.AddActionIcon("fa fa-times text-danger", "Click to decline request"); row.AddActionIcon("fa fa-commenting-o text-default", "Click to call for supervisor"); row.AddActionIcon("fa fa-object-group text-default", "Click to classify order"); } return(row); }
/// <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)); UserSecurityDoubleCell closeCell = new UserSecurityDoubleCell(); closeCell.UserSecurityList = this; row.AddCell(2, closeCell); UserSecurityDoubleCell diffCell = new UserSecurityDoubleCell(); diffCell.UserSecurityList = this; row.AddCell(3, diffCell); UserSecurityDoubleCell diffRangeCell = new UserSecurityDoubleCell(); diffRangeCell.UserSecurityList = this; row.AddCell(4, diffRangeCell); existsCodes[security.m_code] = ""; } } existsCodes.Clear(); m_gridSecurities.EndUpdate(); m_gridSecurities.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(); }
public static GridRow BindGridData(UserViewModel source, bool isTrustAdmin) { var row = new GridRow { IdentityValue = source.TempId }; row.AddCell(source.Email); row.AddCell(source.FirstName); row.AddCell(source.Surname); row.AddCell(source.MobileNumber); row.AddActionIcon("fa fa-edit text-success", "Click to view/edit"); row.AddActionIcon("fa fa-trash text-danger", "Click to delete"); //if (isPharmixAdmin) // row.AddActionIcon("fa fa-cog text-info manageModules", "Manage Modules", "/User/ManageModule/"+source.TempId); //else if (isTrustAdmin) { row.AddActionIcon("fa fa-user-secret changePassword", "Click to change password"); row.AddActionIcon("fa fa-cog text-info manageRoles", "Manage Roles", "/User/ManageUserRole/" + source.TempId); } return(row); }
/// <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(); }
/// <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(); }
public static GridRow BindGridData(Business_Subscription source) { var row = new GridRow { IdentityValue = source.Id }; row.AddCell(source.StartDate.ToString("dd/MM/yyyy")); row.AddCell(source.EndDate.ToString("dd/MM/yyyy")); row.AddCell(source.Currency + "" + source.PaidAmount.ToString("#,##0.00")); row.AddCell(source.PaymentReceived ? "Paid" : "Pendinng"); row.AddCell(source.PaymentReceipt); row.AddCell(Convert.ToDateTime(source.PaymentReceivedDate).ToString("dd/MM/yyyy")); row.AddCell(source.PaymentVia); return(row); }
public static GridRow BindGridData(Patient source) { var row = new GridRow { IdentityValue = source.Id }; row.AddCell(source.FirstName); row.AddCell(source.Surname); row.AddCell(source.DateOfBirth == null ? "N/A" : source.DateOfBirth.Value.ToString("dd/MM/yyyy")); row.AddCell(source.Gender == null ? "N/A" : source.Gender.Name); row.AddCell(source.EmailAddress); row.AddCell(source.MobileNumber); row.AddCell(source.NhsNumber); row.AddCell(source.PasNumber); row.AddActionIcon("fa fa-pencil-square text-priamry", "View/edit", "/patient/detail?patientid=" + source.Id + ""); return(row); }
/// <summary> /// 添加信息 /// </summary> /// <param name="remote">信息</param> public void AddRemoteToGrid(RemoteInfo remote) { List <GridRow> rows = m_gridRemotes.m_rows; int rowsSize = rows.Count; for (int i = 0; i < rowsSize; i++) { GridRow findRow = rows[i]; if (findRow.GetCell("colP1").GetString() == remote.m_ID) { findRow.GetCell("colP2").SetString(remote.m_name); findRow.GetCell("colP3").SetString(remote.m_IP); findRow.GetCell("colP4").SetString(remote.m_port); findRow.GetCell("colP5").SetString(remote.m_userName); findRow.GetCell("colP6").SetString(remote.m_password); findRow.GetCell("colP7").SetString(remote.m_remarks); findRow.GetCell("colP8").SetString(remote.m_createDate); return; } } GridRow row = new GridRow(); m_gridRemotes.AddRow(row); row.AddCell("colP1", new GridStringCell(remote.m_ID)); row.AddCell("colP2", new GridStringCell(remote.m_name)); row.AddCell("colP3", new GridStringCell(remote.m_IP)); row.AddCell("colP4", new GridStringCell(remote.m_port)); row.AddCell("colP5", new GridStringCell(remote.m_userName)); row.AddCell("colP6", new GridStringCell(remote.m_password)); row.AddCell("colP7", new GridStringCell(remote.m_remarks)); row.AddCell("colP8", new GridStringCell(remote.m_createDate)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 1; j < cellsSize; j++) { cells[j].AllowEdit = true; } }
public static GridRow BindGridData(BusinessDetails source) { var row = new GridRow { IdentityValue = source.Id }; row.AddCell(source.BusinessName); row.AddCell(source.ContactPerson); row.AddCell(source.ContactEmail); row.AddCell(source.ContactPhone); row.AddCell(source.City); row.AddCell(source.Postcode); row.AddActionIcon("fa fa-edit text-success", "Click to view/edit"); row.AddActionIcon("fa fa-trash text-danger", "Click to delete"); row.AddActionIcon("fa fa-cog text-info", "Click to add/update business user"); return(row); }
private void AddRow() { //---test solution A // create a row with empty cells, at the end. //IGridRow row = DynDataGridVM.CreateRowWithCells(); //---test solution B IGridRow gridRow = new GridRow(DynDataGridVM.DynDataGrid); // add the row to the dataGrid DynDataGridVM.DynDataGrid.AddRow(gridRow); // create cells corresponding to the columns foreach (IGridColumn col in DynDataGridVM.DynDataGrid.ListColumn) { // create the cell, matching the type defined in the column IGridCell cell = DynDataGridVM.Factory.CreateCell(DynDataGridVM.DynDataGrid, col, gridRow); gridRow.AddCell(cell); } // add the dataGrid row to the VM DynDataGridVM.AddRow(gridRow); }
/// <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="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> private void BindStaffs() { m_gridStaffs.CellEditMode = GridCellEditMode.DoubleClick; List <StaffInfo> staffs = DataCenter.StaffService.GetAliveStaffs(); int staffsSize = staffs.Count; Dictionary <String, DimensionInfo> dimensionsMap = new Dictionary <String, DimensionInfo>(); List <DimensionInfo> dimensions = DataCenter.DimensionService.m_dimensions; int dimensionsSize = dimensions.Count; for (int i = 0; i < dimensionsSize; i++) { DimensionInfo dimension = dimensions[i]; if (dimension.m_jobID != null && dimension.m_jobID.Length > 0) { dimensionsMap[dimension.m_jobID] = dimension; } } m_gridStaffs.ClearRows(); m_gridStaffs.BeginUpdate(); for (int i = 0; i < staffsSize; i++) { StaffInfo staff = staffs[i]; DimensionInfo dimension = null; if (dimensionsMap.ContainsKey(staff.m_jobID)) { dimension = dimensionsMap[staff.m_jobID]; } else { dimension = new DimensionInfo(); dimension.m_business = 100; dimension.m_EQ = 100; dimension.m_IQ = 100; dimension.m_knowledge = 100; dimension.m_lead = 100; dimension.m_technology = 100; dimension.m_jobID = staff.m_jobID; } GridRow row = new GridRow(); m_gridStaffs.AddRow(row); row.AddCell("colF1", new GridStringCell(staff.m_jobID)); row.AddCell("colF2", new GridStringCell(staff.m_name)); row.AddCell("colF3", new GridIntCell(dimension.m_business)); row.AddCell("colF4", new GridIntCell(dimension.m_EQ)); row.AddCell("colF5", new GridIntCell(dimension.m_knowledge)); row.AddCell("colF6", new GridIntCell(dimension.m_IQ)); row.AddCell("colF7", new GridIntCell(dimension.m_lead)); row.AddCell("colF8", new GridIntCell(dimension.m_technology)); int avg = (dimension.m_business + dimension.m_EQ + dimension.m_knowledge + dimension.m_IQ + dimension.m_lead + dimension.m_technology) / 6; row.AddCell("colF9", new GridIntCell(avg)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 2; j < cellsSize - 1; j++) { cells[j].AllowEdit = true; } } m_gridStaffs.EndUpdate(); m_gridStaffs.Invalidate(); dimensionsMap.Clear(); }
/// <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> public GridExtend() { ShowHScrollBar = true; ShowVScrollBar = true; RowStyle.HoveredBackColor = Color.Empty; AddColumn(new GridColumn("colP1", "股票代码", 100)); AddColumn(new GridColumn("colP2", "股票名称", 100)); AddColumn(new GridColumn("colP3", "最新价", 90)); AddColumn(new GridColumn("colP4", "涨跌额", 90)); AddColumn(new GridColumn("colP5", "涨跌幅", 90)); AddColumn(new GridColumn("colP6", "最高价", 90)); AddColumn(new GridColumn("colP7", "最低价", 90)); AddColumn(new GridColumn("colP8", "开盘价", 90)); AddColumn(new GridColumn("colP9", "成交量", 120)); AddColumn(new GridColumn("colP10", "成交额", 110)); AddColumn(new GridColumn("colP11", "买一价", 90)); AddColumn(new GridColumn("colP12", "买一量", 110)); AddColumn(new GridColumn("colP13", "卖一价", 90)); AddColumn(new GridColumn("colP14", "卖一量", 110)); GetColumn("colP9").CellAlign = HorizontalAlign.Left; GetColumn("colP10").CellAlign = HorizontalAlign.Left; GetColumn("colP12").CellAlign = HorizontalAlign.Left; GetColumn("colP14").CellAlign = HorizontalAlign.Left; BeginUpdate(); //绑定数据 foreach (Security security in SecurityService.codedMaps.Values) { GridRow row = new GridRow(); AddRow(row); row.Height = 30; row.AddCell("colP1", new GridStringCell(security.m_code)); row.AddCell("colP2", new GridStringCell(security.m_name)); row.AddCell("colP3", new GridDoubleCell()); row.AddCell("colP4", new GridDoubleCell()); row.AddCell("colP5", new GridPercentCell()); row.AddCell("colP6", new GridDoubleCell()); row.AddCell("colP7", new GridDoubleCell()); row.AddCell("colP8", new GridDoubleCell()); row.AddCell("colP9", new GridLongCell()); row.AddCell("colP10", new GridLongCell()); row.AddCell("colP11", new GridDoubleCell()); row.AddCell("colP12", new GridLongCell()); row.AddCell("colP13", new GridDoubleCell()); row.AddCell("colP14", new GridLongCell()); rowsMap[security.m_code] = row; for (int i = 0; i < row.Cells.Count; i++) { GridCellStyle cellStyle = new GridCellStyle(); if (i > 1) { cellStyle.Align = HorizontalAlign.Right; } cellStyle.TextColor = Color.FromArgb(255, 255, 255); cellStyle.Font = new Font("微软雅黑", 12); row.Cells[i].Style = cellStyle; } } EndUpdate(); SecurityService.m_listener = this; SecurityService.Start(); System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer(); timer.Tick += new EventHandler(timer_Tick); timer.Interval = 300; timer.Enabled = true; }
/// <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> private void BindStaffs() { m_gridPersonals.CellEditMode = GridCellEditMode.DoubleClick; List <StaffInfo> staffs = DataCenter.StaffService.m_staffs; int staffsSize = staffs.Count; Dictionary <String, PersonalInfo> personalsMap = new Dictionary <String, PersonalInfo>(); List <PersonalInfo> personals = DataCenter.PersonalService.m_personals; int personalsSize = personals.Count; for (int i = 0; i < personalsSize; i++) { PersonalInfo personal = personals[i]; if (personal.m_jobID != null && personal.m_jobID.Length > 0) { personalsMap[personal.m_jobID] = personal; } } m_gridPersonals.ClearRows(); m_gridPersonals.BeginUpdate(); for (int i = 0; i < staffsSize; i++) { StaffInfo staff = staffs[i]; PersonalInfo personal = null; if (personalsMap.ContainsKey(staff.m_jobID)) { personal = personalsMap[staff.m_jobID]; } else { personal = new PersonalInfo(); } GridRow row = new GridRow(); m_gridPersonals.AddRow(row); row.AddCell("colS1", new GridStringCell(staff.m_jobID)); row.AddCell("colS2", new GridStringCell(staff.m_name)); row.AddCell("colS3", new GridStringCell(personal.m_marry)); row.AddCell("colS4", new GridStringCell(personal.m_loan)); row.AddCell("colS5", new GridStringCell(personal.m_house)); row.AddCell("colS6", new GridStringCell(personal.m_parent)); row.AddCell("colS7", new GridStringCell(personal.m_body)); row.AddCell("colS8", new GridStringCell(personal.m_sb)); row.AddCell("colS9", new GridStringCell(personal.m_eat)); row.AddCell("colS10", new GridStringCell(personal.m_teach)); row.AddCell("colS11", new GridStringCell(personal.m_pay)); row.AddCell("colS12", new GridStringCell(personal.m_dress)); row.AddCell("colS13", new GridStringCell(personal.m_cross)); row.AddCell("colS14", new GridStringCell(personal.m_game)); row.AddCell("colS15", new GridStringCell(personal.m_sports)); row.AddCell("colS16", new GridStringCell(personal.m_pet)); row.AddCell("colS17", new GridStringCell(personal.m_lead)); row.AddCell("colS18", new GridStringCell(personal.m_gay)); row.AddCell("colS19", new GridStringCell(personal.m_preference)); row.AddCell("colS20", new GridStringCell(personal.m_oldWork)); row.AddCell("colS21", new GridStringCell(personal.m_drink)); row.AddCell("colS22", new GridStringCell(personal.m_smoke)); List <GridCell> cells = row.GetCells(); int cellsSize = cells.Count; for (int j = 2; j < cellsSize; j++) { cells[j].AllowEdit = true; } } m_gridPersonals.EndUpdate(); m_gridPersonals.Invalidate(); personalsMap.Clear(); }
/// <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); }
/// <summary> /// 插入行数据 /// </summary> /// <param name="jira">Jira对象</param> public void Addrows(Jira jira) { m_gridDgvTable.BeginUpdate(); //设置样式 GridCellStyle gridStyle = new GridCellStyle(); gridStyle.BackColor = COLOR.DISABLEDCONTROL; GridRow row = new GridRow(); m_gridDgvTable.AddRow(row); //设置边框线的颜色 m_gridDgvTable.GridLineColor = COLOR.EMPTY; m_gridDgvTable.HeaderHeight = 35; m_gridDgvTable.BackColor = COLOR.ARGB(31, 29, 40); row.Tag = jira; //设置行高 row.Height = 35; GridCell cell1 = new GridCellExp(jira.JiraID); row.AddCell("colT1", cell1); GridCellStyle gridStyle1 = new GridCellStyle(); gridStyle1.BackColor = COLOR.DISABLEDCONTROL; gridStyle1.ForeColor = COLOR.ARGB(255, 255, 255); cell1.Style = gridStyle1; GridCell cell2 = new GridCellExp(jira.Title); row.AddCell("colT2", cell2); GridCellStyle gridStyle2 = new GridCellStyle(); gridStyle2.BackColor = COLOR.DISABLEDCONTROL; gridStyle2.ForeColor = COLOR.ARGB(45, 142, 45); cell2.Style = gridStyle2; GridCell cell3 = new GridCellExp(jira.Creater); row.AddCell("colT3", cell3); GridCell cell4 = new GridCellExp(jira.Developer); row.AddCell("colT4", cell4); GridCellStyle gridStyle3 = new GridCellStyle(); gridStyle3.BackColor = COLOR.DISABLEDCONTROL; gridStyle3.ForeColor = COLOR.ARGB(47, 145, 145); cell3.Style = gridStyle3; cell4.Style = gridStyle3; int count = XmlHandle.Groups.Count; for (int j = 0; j < count; j++) { JGroup group = XmlHandle.Groups[j]; if (group.Id == jira.GroupID) { GridCell cell5 = new GridCellExp(group.Name); row.AddCell("colT5", cell5); GridCellStyle gridStyle5 = new GridCellStyle(); gridStyle5.BackColor = COLOR.DISABLEDCONTROL; gridStyle5.ForeColor = COLOR.ARGB(47, 145, 145); cell5.Style = gridStyle5; GridCell cell6 = new GridCellExp(group.Manager); row.AddCell("colT6", cell6); GridCellStyle gridStyle6 = new GridCellStyle(); gridStyle6.BackColor = COLOR.DISABLEDCONTROL; gridStyle6.ForeColor = COLOR.ARGB(255, 153, 153); cell6.Style = gridStyle6; List <JCategory> categories = group.Categories; int categoriesCount = categories.Count; for (int n = 0; n < categoriesCount; n++) { if (categories[n].Id == jira.CategoryID) { GridCell cell7 = new GridCellExp(categories[n].Name); row.AddCell("colT7", cell7); GridCellStyle gridStyle7 = new GridCellStyle(); gridStyle7.BackColor = COLOR.DISABLEDCONTROL; gridStyle7.ForeColor = COLOR.ARGB(45, 142, 45); cell7.Style = gridStyle7; break; } } break; } } String str = jira.DeveloperReceive ? "是" : "否"; GridCell cell8 = new GridCellExp(str); GridCellStyle gridStyle8 = new GridCellStyle(); gridStyle8.ForeColor = COLOR.ARGB(255, 255, 255); if (str == "是") { gridStyle8.BackColor = COLOR.ARGB(93, 146, 202); } else { gridStyle8.BackColor = COLOR.ARGB(163, 5, 50); } cell8.Style = gridStyle8; row.AddCell("colT8", cell8); String str1 = jira.DeveloperPass ? "是" : "否"; GridCell cell9 = new GridCellExp(str1); GridCellStyle gridStyle9 = new GridCellStyle(); gridStyle9.ForeColor = COLOR.ARGB(255, 255, 255); if (str1 == "是") { gridStyle9.BackColor = COLOR.ARGB(93, 146, 202); } else { gridStyle9.BackColor = COLOR.ARGB(163, 5, 50); } cell9.Style = gridStyle9; row.AddCell("colT9", cell9); String str2 = jira.TestPass ? "是" : "否"; GridCell cell10 = new GridCellExp(str2); GridCellStyle gridStyle10 = new GridCellStyle(); gridStyle10.ForeColor = COLOR.ARGB(255, 255, 255); if (str2 == "是") { gridStyle10.BackColor = COLOR.ARGB(93, 146, 202); } else { gridStyle10.BackColor = COLOR.ARGB(163, 5, 50); } cell10.Style = gridStyle10; row.AddCell("colT10", cell10); String str3 = jira.ProductPass ? "是" : "否"; GridCell cell11 = new GridCellExp(str3); GridCellStyle gridStyle11 = new GridCellStyle(); gridStyle11.ForeColor = COLOR.ARGB(255, 255, 255); if (str3 == "是") { gridStyle11.BackColor = COLOR.ARGB(93, 146, 202); } else { gridStyle11.BackColor = COLOR.ARGB(163, 5, 50); } cell11.Style = gridStyle11; row.AddCell("colT11", cell11); String str4 = jira.WaitPublish ? "是" : "否"; GridCell cell12 = new GridCellExp(str4); GridCellStyle gridStyle12 = new GridCellStyle(); gridStyle12.ForeColor = COLOR.ARGB(255, 255, 255); if (str4 == "是") { gridStyle12.BackColor = COLOR.ARGB(93, 146, 202); } else { gridStyle12.BackColor = COLOR.ARGB(163, 5, 50); } cell12.Style = gridStyle12; row.AddCell("colT12", cell12); String str5 = jira.Published ? "是" : "否"; GridCell cell13 = new GridCellExp(str5); GridCellStyle gridStyle13 = new GridCellStyle(); gridStyle13.ForeColor = COLOR.ARGB(255, 255, 255); if (str5 == "是") { gridStyle13.BackColor = COLOR.ARGB(93, 146, 202); } else { gridStyle13.BackColor = COLOR.ARGB(163, 5, 50); } cell13.Style = gridStyle13; row.AddCell("colT13", cell13); String str6 = jira.CloseTask ? "是" : "否"; GridCell cell14 = new GridCellExp(str6); GridCellStyle gridStyle14 = new GridCellStyle(); gridStyle14.ForeColor = COLOR.ARGB(255, 255, 255); if (str6 == "是") { gridStyle14.BackColor = COLOR.ARGB(93, 146, 202); } else { gridStyle14.BackColor = COLOR.ARGB(163, 5, 50); } cell14.Style = gridStyle14; row.AddCell("colT14", cell14); GridCell cell15 = new GridCellExp(jira.Hurry); GridCellStyle gridStyle15 = new GridCellStyle(); gridStyle15.BackColor = COLOR.ARGB(0, 0, 0); if (jira.Hurry == "紧急") { gridStyle15.ForeColor = COLOR.ARGB(255, 0, 0); } else { gridStyle15.ForeColor = COLOR.ARGB(255, 255, 0); } cell15.Style = gridStyle15; row.AddCell("colT15", cell15); GridCellStyle gridStyle16 = new GridCellStyle(); gridStyle16.BackColor = COLOR.DISABLEDCONTROL; gridStyle16.ForeColor = COLOR.ARGB(255, 255, 0); DateTime dt1 = DateTime.Now; String status = jira.EndDate.ToFileTime() > dt1.ToFileTime() ? "(超时)" : "(正常)"; GridCell cells16 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString()); row.AddCell("colT16", cells16); cells16.Tag = jira.StartDate; GridCell cells17 = new GridCellExp(status + jira.StartDate.ToLongDateString().ToString()); row.AddCell("colT17", cells17); cells16.Style = gridStyle16; cells17.Style = gridStyle16; cells17.Tag = jira.EndDate; m_gridDgvTable.EndUpdate(); }
/// <summary> /// 调用控件线程方法 /// </summary> /// <param name="args">参数</param> public override void OnInvoke(object args) { base.OnInvoke(args); if (args != null) { CMessage message = (CMessage)args; if (message.m_requestID == m_requestID) { //分时数据 if (message.m_functionID == QuoteService.FUNCTIONID_QUOTE_PUSHLATESTDATA) { LatestDataInfo dataInfo = new LatestDataInfo(); List <SecurityLatestData> datas = new List <SecurityLatestData>(); QuoteService.GetLatestDatas(ref dataInfo, datas, message.m_body, message.m_bodyLength); SecurityLatestData latestData = datas[0]; if (latestData != null && latestData.m_securityCode == m_securityCode && !latestData.Equal(m_latestData)) { m_latestData = latestData; //设置保留小数的位数 int digit = 2; if (m_latestData.m_securityCode.StartsWith("1") || m_latestData.m_securityCode.StartsWith("5")) { digit = 3; } m_chart.Digit = digit; m_chart.RefreshData(); } } //LV2分时数据 else if (message.m_functionID == QuoteService.FUNCTIONID_QUOTE_PUSHLATESTDATALV2) { LatestDataInfoLV2 dataInfo = new LatestDataInfoLV2(); List <SecurityLatestDataLV2> datas = new List <SecurityLatestDataLV2>(); QuoteService.GetLatestDatasLV2(ref dataInfo, datas, message.m_body, message.m_bodyLength); SecurityLatestDataLV2 latestDataLV2 = datas[0]; if (latestDataLV2 != null && latestDataLV2.m_securityCode == m_securityCode && !latestDataLV2.Equal(m_latestDataLV2)) { m_latestDataLV2 = latestDataLV2; } } //成交数据 else if (message.m_functionID == QuoteService.FUNCTIONID_QUOTE_PUSHTRANSACTIONDATA) { String securityCode = ""; List <TransactionData> transactionDatas = new List <TransactionData>(); QuoteService.GetTransactionDatas(ref securityCode, transactionDatas, message.m_body, message.m_bodyLength); int transactionDatasSize = transactionDatas.Count; for (int i = 0; i < transactionDatasSize; i++) { TransactionData transactionData = transactionDatas[i]; DateTime date = m_chart.Chart.ConvertNumToDate(transactionData.m_date); GridRow row = new GridRow(); m_gridTransaction.InsertRow(0, row); TransactionDateCell dateCell = new TransactionDateCell(); dateCell.Text = date.ToString("HH:mm:ss"); row.AddCell(0, dateCell); GridCellStyle dateCellStyle = new GridCellStyle(); dateCellStyle.BackColor = COLOR.EMPTY; dateCellStyle.Font = new FONT("SimSun", 14, true, false, false); dateCellStyle.ForeColor = CDraw.PCOLORS_FORECOLOR2; dateCell.Style = dateCellStyle; TransactionDataDoubleCell priceCell = new TransactionDataDoubleCell(); priceCell.Digit = 2; priceCell.SetDouble(transactionData.m_price); row.AddCell(1, priceCell); GridCellStyle priceCellStyle = new GridCellStyle(); priceCellStyle.BackColor = COLOR.EMPTY; priceCellStyle.Font = new FONT("SimSun", 14, true, false, false); priceCellStyle.ForeColor = CDraw.GetPriceColor(transactionData.m_price, m_latestData.m_lastClose); priceCell.Style = priceCellStyle; TransactionDataDoubleCell volumeCell = new TransactionDataDoubleCell(); volumeCell.SetDouble(transactionData.m_volume); row.AddCell(2, volumeCell); GridCellStyle volumeCellStyle = new GridCellStyle(); volumeCellStyle.BackColor = COLOR.EMPTY; volumeCellStyle.Font = new FONT("SimSun", 14, true, false, false); if (transactionData.m_type == 0) { volumeCellStyle.ForeColor = CDraw.PCOLORS_FORECOLOR; } else if (transactionData.m_type == 1) { volumeCellStyle.ForeColor = CDraw.PCOLORS_UPCOLOR; } else { volumeCellStyle.ForeColor = CDraw.PCOLORS_DOWNCOLOR; } volumeCell.Style = volumeCellStyle; } m_gridTransaction.Update(); } } Invalidate(); } }
/// <summary> /// 调用主线程返方法 /// </summary> /// <param name="sender">调用者</param> /// <param name="args">参数</param> public void Invoke(object sender, object args) { CMessage message = args as CMessage; if (message != null) { if (message.m_serviceID == ChatService.SERVICEID_CHAT) { if (message.m_functionID == ChatService.FUNCTIONID_SENDALL) { ChatData chatData = new ChatData(); ChatService.GetChatData(chatData, message.m_body, message.m_bodyLength); CIndicator indicator = CFunctionEx.CreateIndicator2("", chatData, this); indicator.Clear(); indicator.Dispose(); } else if (message.m_functionID == ChatService.FUNCTIONID_GETHOSTS) { List <ChatHostInfo> datas = new List <ChatHostInfo>(); int type = 0; ChatService.GetHostInfos(datas, ref type, message.m_body, message.m_bodyLength); if (type != 2) { int datasSize = datas.Count; for (int i = 0; i < datasSize; i++) { ChatHostInfo hostInfo = datas[i]; List <GridRow> rows = m_gridHosts.m_rows; int rowsSize = rows.Count; bool containsRow = false; for (int j = 0; j < rowsSize; j++) { GridRow oldRow = rows[j]; if (oldRow.GetCell("colP1").GetString() == hostInfo.m_ip && oldRow.GetCell("colP2").GetInt() == hostInfo.m_serverPort) { containsRow = true; } } if (!containsRow) { if (hostInfo.m_type == 1) { String key = hostInfo.m_ip + ":" + hostInfo.m_serverPort; ChatService newServerService = DataCenter.GetClientChatService(key); if (newServerService == null) { newServerService = new ChatService(); newServerService.ServerIP = hostInfo.m_ip; newServerService.ServerPort = hostInfo.m_serverPort; newServerService.ToServer = true; BaseService.AddService(newServerService); DataCenter.AddClientChatService(key, newServerService); } } else { GridRow row = new GridRow(); m_gridHosts.AddRow(row); row.AddCell("colP1", new GridStringCell(hostInfo.m_ip)); row.AddCell("colP2", new GridIntCell(hostInfo.m_serverPort)); if (hostInfo.m_type == 1) { row.AddCell("colP3", new GridStringCell("--")); row.AddCell("colP4", new GridStringCell("--")); } else { row.AddCell("colP3", new GridStringCell(hostInfo.m_userID)); row.AddCell("colP4", new GridStringCell(hostInfo.m_userName)); } row.AddCell("colP5", new GridStringCell(hostInfo.m_type == 1 ? "服务器" : "客户端")); } } } } else { Dictionary <String, String> removeHosts = new Dictionary <String, String>(); foreach (ChatHostInfo hostInfo in datas) { removeHosts[hostInfo.ToString()] = ""; } List <GridRow> rows = m_gridHosts.m_rows; int rowsSize = rows.Count; if (rowsSize > 0) { for (int i = 0; i < rowsSize; i++) { GridRow row = rows[i]; String key = row.GetCell("colP1").GetString() + ":" + row.GetCell("colP2").GetString(); if (removeHosts.ContainsKey(key)) { m_gridHosts.RemoveRow(row); i--; rowsSize--; } } } } SetHostGridRowVisible(); } else if (message.m_functionID == ChatService.FUNCTIONID_SEND) { ChatData chatData = new ChatData(); ChatService.GetChatData(chatData, message.m_body, message.m_bodyLength); CIndicator indicator = CFunctionEx.CreateIndicator2("", chatData, this); indicator.Clear(); indicator.Dispose(); } } } String newStr = args as String; if (newStr != null) { if (newStr == "showchat") { FlashWindow(m_mainForm.Handle, true); SetForegroundWindow(m_mainForm.Handle); } else if (newStr == "shake") { m_mainForm.Play(); } else if (newStr.StartsWith("how:")) { String text = newStr.Substring(4); Barrage barrage = new Barrage(); barrage.Text = text; barrage.Mode = 1; m_barrageForm.BarrageDiv.AddBarrage(barrage); } else { TextBoxA txtReceive = GetTextBox("txtReceive"); txtReceive.Text += newStr; txtReceive.Invalidate(); if (txtReceive.VScrollBar != null && txtReceive.VScrollBar.Visible) { txtReceive.VScrollBar.ScrollToEnd(); txtReceive.Update(); txtReceive.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) { TreeNodeA tn = cell as TreeNodeA; if (tn.m_nodes.Count == 0) { if (tn.Tag == null) { try { MacroDataType type = (MacroDataType)Enum.Parse(typeof(MacroDataType), m_cbMacIndustry.Text); DataTable dt = MongoRetriver.GetDescendantDataByService(tn.Name, type); foreach (DataRow row in dt.Rows) { if (row[0].ToString().Length > 0 && row[3].ToString().Length > 0) { TreeNodeA node = new TreeNodeA(); node.Tag = "2"; node.Style = new GridCellStyle(); node.Style.ForeColor = COLOR.ARGB(255, 255, 80); node.Style.Font = new FONT("微软雅黑", 14, true, false, false); node.Text = row["STR_MACRONAME"].ToString(); node.Name = row[0].ToString(); tn.AppendNode(node); } } tn.Tag = "1"; m_tvMacIndustry.Update(); } catch (Exception ex) { } } else if (tn.Tag.ToString() == "2") { m_gridMacIndustry.ClearRows(); m_fundCurve.Clear(); FundCurveData data = new FundCurveData(); XAxisPointData xdata = new XAxisPointData(); Dictionary <String, YAxisCurveData> yDatas = new Dictionary <String, YAxisCurveData>(); YAxisStyle ySyle = new YAxisStyle(); YAxisStyle ySyle1 = new YAxisStyle(); YAxisStyle ySyle2 = new YAxisStyle(); XAxisStyle xStyle = new XAxisStyle(); xStyle.XAxisType = XAxisType.Date; data.ChartTitle = "每日进展"; xStyle.XAxisTitle = "时间"; data.BackgroundColor = Color.Black; DataTable dt = GetMacIndustyData(tn.Name, m_cbMacIndustry.Text); YAxisCurveData yData = new YAxisCurveData(); yData.YPointValues = new List <double>(); yData.LineWidth = 3; yData.Text = xdata.Text; yData.ShowCycle = true; data.LstYAxisPointDatas.Add(yData); foreach (DataRow dr in dt.Rows) { if (dr[0].ToString().Length > 0 && dr[1].ToString().Length > 0) { GridRow row = new GridRow(); m_gridMacIndustry.AddRow(row); DateTime date = Convert.ToDateTime(dr[0]); row.AddCell("colN1", new GridStringCell(date.ToString("yyyy-MM-dd"))); row.AddCell("colN2", new GridStringCell(dr[1].ToString())); 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("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); } } int rowsSize = dt.Rows.Count; for (int i = rowsSize - 1; i >= 0; i--) { DataRow dr = dt.Rows[i]; if (dr[0].ToString().Length > 0 && dr[1].ToString().Length > 0) { GridRow row = new GridRow(); m_gridMacIndustry.AddRow(row); DateTime date = Convert.ToDateTime(dr[0]); xdata.Value = date.Year * 10000 + date.Month * 100 + date.Day; xdata.Text = date.ToString("yyyyMMdd"); data.LstXAxisPointDatas.Add(xdata); yData.YPointValues.Add(CStr.ConvertStrToDouble(dr[1].ToString())); } } data.XAxisStyle = xStyle; ySyle.YAxisTitleAlign = YAxisTitleAlign.Middle; ySyle1.YAxisTitleAlign = YAxisTitleAlign.Middle; ySyle2.YAxisTitleAlign = YAxisTitleAlign.Middle; xStyle.XAxisTitleAlign = XAxisTitleAlign.Center; data.LstYAxisStyle.Add(ySyle); data.LstYAxisStyle.Add(ySyle1); data.LstYAxisStyle.Add(ySyle2); m_fundCurve.FundCurveData = data; m_gridMacIndustry.Update(); m_gridMacIndustry.Invalidate(); } } }