public static CheckBoxCellType CreateCheckboxCellType(string strTextTrue, string strTextFalse) { CheckBoxCellType chkCellType = new CheckBoxCellType(); chkCellType.TextTrue = strTextTrue; chkCellType.TextFalse = strTextFalse; return(chkCellType); }
private string GetHeader(int columnIndex) { CheckBoxCellType checkbox = this.bsprData.ActiveSheet.ColumnHeader.Cells[0, columnIndex].CellType as CheckBoxCellType; if (checkbox == null) { return(string.Empty); } return(checkbox.Caption); }
private void NotifyUserMsgDlg_Load(object sender, EventArgs e) { FpSpread_Info.Columns.Count = 10; FpSpread_Info.ColumnHeader.RowCount = 1; FpSpread_Info.ColumnHeader.Cells[0, 0].Text = "SessionID"; FpSpread_Info.ColumnHeader.Cells[0, 0].Tag = "SessionID"; FpSpread_Info.ColumnHeader.Cells[0, 1].Text = "LineID"; FpSpread_Info.ColumnHeader.Cells[0, 1].Tag = "LineID"; FpSpread_Info.ColumnHeader.Cells[0, 2].Text = "选择"; FpSpread_Info.ColumnHeader.Cells[0, 2].Tag = "SelectTag"; FpSpread_Info.ColumnHeader.Cells[0, 3].Text = "线路名称"; FpSpread_Info.ColumnHeader.Cells[0, 3].Tag = "LineName"; FpSpread_Info.ColumnHeader.Cells[0, 4].Text = "标段名称"; FpSpread_Info.ColumnHeader.Cells[0, 4].Tag = "SegmentName"; FpSpread_Info.ColumnHeader.Cells[0, 5].Text = "单位名称"; FpSpread_Info.ColumnHeader.Cells[0, 5].Tag = "CompanyName"; FpSpread_Info.ColumnHeader.Cells[0, 6].Text = "试验室名称"; FpSpread_Info.ColumnHeader.Cells[0, 6].Tag = "TestRoomName"; FpSpread_Info.ColumnHeader.Cells[0, 7].Text = "用户名"; FpSpread_Info.ColumnHeader.Cells[0, 7].Tag = "UserName"; FpSpread_Info.ColumnHeader.Cells[0, 8].Text = "最后活动时间"; FpSpread_Info.ColumnHeader.Cells[0, 8].Tag = "LastActiveTime"; FpSpread_Info.ColumnHeader.Cells[0, 9].Text = "登录时间"; FpSpread_Info.ColumnHeader.Cells[0, 9].Tag = "LoginTime"; FpSpread_Info.Columns[0].Width = 10; FpSpread_Info.Columns[1].Width = 10; FpSpread_Info.Columns[2].Width = 40; FpSpread_Info.Columns[3].Width = 100; FpSpread_Info.Columns[4].Width = 60; FpSpread_Info.Columns[5].Width = 100; FpSpread_Info.Columns[6].Width = 80; FpSpread_Info.Columns[7].Width = 80; FpSpread_Info.Columns[8].Width = 120; FpSpread_Info.Columns[9].Width = 120; FpSpread_Info.Columns[0].Visible = false; FpSpread_Info.Columns[1].Visible = false; FarPoint.Win.Spread.CellType.DateTimeCellType datetime = new FarPoint.Win.Spread.CellType.DateTimeCellType(); datetime.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.LongDateWithTime; FpSpread_Info.Columns[8].CellType = datetime; FpSpread_Info.Columns[9].CellType = datetime; CheckBoxCellType checkBox = new CheckBoxCellType(); FpSpread_Info.Columns[2].CellType = checkBox; DataOnlineUser = LineHelperClient.GetOnlineUserList(); BindLines(); //BindData(); }
private void BindData() { try { ProgressScreen.Current.ShowSplashScreen(); ProgressScreen.Current.SetStatus = "正在获取数据..."; String type = ""; if (toolStripComboBox1.SelectedIndex == 0) { type = "1"; } else if (toolStripComboBox1.SelectedIndex == 1) { type = "2"; } DataTable Data = PXJZReportDataList.GetWitnessRateInfos(type); if (Data != null) { FpSpread_Info.DataSource = Data; FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); FpSpread_Info.Rows.Count = Data.Rows.Count; if (Data.Rows.Count > 0) { for (int i = 0; i < Data.Rows.Count; i++) { FpSpread_Info.Rows[i].HorizontalAlignment = CellHorizontalAlignment.Center; CheckBoxCellType checkBox = new CheckBoxCellType(); checkBox.Caption = "启用"; if (Data.Rows[i][2].ToString() == "0") { checkBox.ThreeState = false; } else { checkBox.ThreeState = true; } FpSpread_Info.Cells[i, 2].CellType = checkBox; } FpSpread_Info.Columns[0].Width = 100; FpSpread_Info.Columns[0].Locked = true; FpSpread_Info.Columns[1].Width = 400; FpSpread_Info.Columns[1].Locked = true; FpSpread_Info.Columns[2].Width = 100; FpSpread_Info.Columns[3].Width = 100; ProgressScreen.Current.CloseSplashScreen(); } else { this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } } else { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } this.Activate(); if (Data == null) { totalCount.Text = string.Format("共 {0} 条记录", 0); } else { totalCount.Text = string.Format("共 {0} 条记录", Data.Rows.Count); } } catch (Exception ex) { throw ex; } }
public static CheckBoxCellType CreateCheckboxCellType() { CheckBoxCellType chkCellType = new CheckBoxCellType(); return(chkCellType); }
/// <summary> /// farpoint数据绑定 /// </summary> private void bindFpTunnelHChuanInfo() { // 清空HashTabl(必须实装) _htSelIdxs.Clear(); //清空Farpoint FarPointOperate.farPointClear(fpDayReportHChuan, _rowDetailStartIndex, _rowsCount); _checkCount = 0; chkSelAll.Checked = false; // ※分页必须 _iRecordCount = TunnelHChuanBLL.selectTunnelHChuan().Tables[0].Rows.Count; // ※分页必须 dataPager1.PageControlInit(_iRecordCount); var iStartIndex = dataPager1.getStartIndex(); var iEndIndex = dataPager1.getEndIndex(); _ds = TunnelHChuanBLL.selectTunnelHChuan(iStartIndex, iEndIndex); _rowsCount = _ds.Tables[0].Rows.Count; //重绘Farpoint FarPointOperate.farPointReAdd(fpDayReportHChuan, _rowDetailStartIndex, _rowsCount); if (_rowsCount > 0) { var ckbxcell = new CheckBoxCellType(); //取消三选 ckbxcell.ThreeState = false; for (var i = 0; i < _ds.Tables[0].Rows.Count; i++) { var index = 0; fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, index].CellType = ckbxcell; //主运顺槽 var tunnelID1 = Convert.ToInt32(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_ID1]); //辅运顺槽 var tunnelID2 = Convert.ToInt32(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_ID2]); var tmpTunnelID = (tunnelID1 == 0 ? (tunnelID2 == 0 ? 0 : tunnelID2) : tunnelID1); //矿井名称 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.NAME_HCHUAN].ToString(); ; //关联巷道1 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_ID1].ToString(); ; //关联巷道2 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_ID2].ToString(); ; //x1 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_X1].ToString(); //y1 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_Y1].ToString(); //z1 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_Z1].ToString(); //x2 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_X2].ToString(); //y2 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_Y2].ToString(); //z2 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_Z2].ToString(); //azimuth fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_AZIMUTH].ToString(); //队别 if (int.TryParse(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TEAM_NAME_ID].ToString(), out tmpInt)) { fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = Team.Find(tmpInt).TeamName; tmpInt = 0; } //开工日期 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.START_DATE].ToString() .Substring(0, _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.START_DATE].ToString().IndexOf(' ')); //是否回采完毕 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = Convert.ToInt32(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.IS_FINISH].ToString()) == 1 ? Const.MSG_YES : Const.MSG_NO; //停工日期 if (Convert.ToInt32(_ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.IS_FINISH].ToString()) == 1) { fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.STOP_DATE].ToString() .Substring(0, _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.STOP_DATE].ToString().IndexOf(' ')); } else { ++index; } //工作制式 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.WORK_STYLE].ToString(); //班次 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.WORK_TIME].ToString(); //状态 fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.TUNNEL_STATE].ToString(); //bid fpDayReportHChuan.Sheets[0].Cells[_rowDetailStartIndex + i, ++index].Text = _ds.Tables[0].Rows[i][TunnelHChuanDbConstNames.ID].ToString(); fpDayReportHChuan.Sheets[0].Columns[_BIDIndex].Visible = false; } } //设置按钮可操作性 setButtenEnable(); }
private bool FillFarpointCellsWithDataset(DataSet ds) { if (ds == null) { return(false); } var cnt = ds.Tables[0].Rows.Count; if (cnt < 1) { return(false); } _dataCnt = cnt; //根据farpoint中的行数动态添加应该添加的行 //int nAddRows = cnt - fpRules.Sheets[0].Rows.Count + DATA_START_IDX; //if (nAddRows > 0) //{ // fpRules.Sheets[0].Rows.Add(fpRules.Sheets[0].Rows.Count, nAddRows); //} //根据数据条数重新设置Farpoint单元格行数 fpRules.Sheets[0].Rows.Count = _dataCnt + DATA_START_IDX; //MARK FIELD for (var i = 0; i < cnt; i++) { var chkBox = new CheckBoxCellType(); //选择 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 0].CellType = chkBox; //规则编码 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 1].Text = ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.RULE_CODE].ToString(); fpRules.Sheets[0].Cells[DATA_START_IDX + i, 1].Locked = true; //规则类别 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 2].Text = ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.RULE_TYPE].ToString(); fpRules.Sheets[0].Cells[DATA_START_IDX + i, 2].Locked = true; //预警类型 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 3].Text = ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.WARNING_TYPE].ToString(); fpRules.Sheets[0].Cells[DATA_START_IDX + i, 3].Locked = true; //预警级别 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 4].Text = ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.WARNING_LEVEL].ToString(); fpRules.Sheets[0].Cells[DATA_START_IDX + i, 4].Locked = true; //适用位置 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 5].Text = ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.SUITABLE_LOCATION].ToString(); fpRules.Sheets[0].Cells[DATA_START_IDX + i, 5].Locked = true; //规则描述 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 6].Text = ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.RULE_DESCRIPTION].ToString(); fpRules.Sheets[0].Cells[DATA_START_IDX + i, 6].HorizontalAlignment = CellHorizontalAlignment.Left; fpRules.Sheets[0].Cells[DATA_START_IDX + i, 6].Locked = true; //指标类型 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 7].Text = ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.INDICATOR_TYPE].ToString(); fpRules.Sheets[0].Cells[DATA_START_IDX + i, 7].Locked = true; //比较符 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 8].Text = ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.OPERATOR].ToString(); fpRules.Sheets[0].Cells[DATA_START_IDX + i, 8].Locked = true; //修改日期 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 9].Text = Convert.ToDateTime(ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.MODIFY_DATE]).ToString(); fpRules.Sheets[0].Cells[DATA_START_IDX + i, 9].Locked = true; //备注 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 10].Text = ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.REMARKS].ToString(); fpRules.Sheets[0].Cells[DATA_START_IDX + i, 10].Locked = true; //规则ID fpRules.Sheets[0].Cells[DATA_START_IDX + i, 11].Text = ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.RULE_ID].ToString(); //绑定的单一规则 fpRules.Sheets[0].Cells[DATA_START_IDX + i, 12].Text = ds.Tables[0].Rows[i][PreWarningRulesDbConstNames.BINDING_SINGLERULES].ToString(); fpRules.Sheets[0].Cells[DATA_START_IDX + i, 12].Locked = true; } LibAutoResizeFarpoint.AutoFitWidthAndHeight(fpRules, DATA_START_IDX, 1); return(true); }
public static ICellType CreateCellType(string CellType) { ICellType Result = null; switch (CellType.ToLower()) { case "文本": Result = new TextCellType(); break; case "数字": Result = new NumberCellType(); break; case "百分号": Result = new PercentCellType(); break; case "图片": Result = new ImageCellType(); break; case "超链接": Result = new HyperLinkCellType(); break; case "货币": Result = new CurrencyCellType(); break; case "日期时间": Result = new DateTimeCellType(); break; case "复选框": Result = new CheckBoxCellType(); break; case "上下标": Result = new RichTextCellType(); break; case "条形码": Result = new BarCodeCellType(); break; case "下拉框": Result = new DownListCellType(); break; case "掩码": Result = new MaskCellType(); break; case "删除线": Result = new DeleteLineCellType(); break; default: Result = new TextCellType(); break; } return(Result); }
/// <summary> /// 加载瓦斯浓度探头数据信息 /// </summary> private void loadGasConcentrationProbeDataInfo() { Invoke(new MethodInvoker(delegate { // 修改按钮设为不可用(必须实装) _btnQuery.Text = "查询中..."; _btnQuery.Enabled = false; btnUpdate.Enabled = false; // 删除按钮设为不可用(必须实装) btnDelete.Enabled = false; // 全选/全不选checkbox设为未选中(必须实装) _chkSelAll.Checked = false; _lblNoData.Visible = true; _lblNoData.Text = "查询数据中..."; dataPager1.Enabled = false; })); // 清空HashTabl(必须实装) _htSelIdxs.Clear(); // 删除farpoint明细部(必须实装) // 解决修改、删除某条数据后,重新load的时候,选择列checkbox不恢复成默认(不选择)的BUG // 解决删除全部数据后,再添加一行,报错的BUG Invoke(new MethodInvoker(delegate { if (fpGasConcentrationProbeDataInfo.Sheets[0].Rows.Count != _iRowDetailStartIndex) { fpGasConcentrationProbeDataInfo.Sheets[0].Rows.Remove(_iRowDetailStartIndex, _iRowCount); } else { _iRowCount = 0; } })); var dtTimeStart = _dateTimeStart.Value; var dtTimeEnd = _dateTimeEnd.Value; // 根据探头编号和开始结束时间,获取特定探头和特定时间段内的【瓦斯浓度探头数据】(必须实装) var iRecordCount = GasConcentrationProbeData.SelectAllGasConcentrationProbeDataByProbeIdAndTime(_probeId, dtTimeStart, dtTimeEnd).Length; var iStartIndex = 0; var iEndIndex = 0; Invoke(new MethodInvoker(delegate { if (iRecordCount > 0) { _gbPage.Enabled = true; } else { _gbPage.Enabled = false; } // 调用分页控件初始化方法(必须实装) dataPager1.PageControlInit(iRecordCount); // 获取要检索数据的开始位置和结束位置 (必须实装) iStartIndex = dataPager1.getStartIndex(); iEndIndex = dataPager1.getEndIndex(); })); //// 获取开始位置和结束位置之间的数据(必须实装) //// 说明:如果画面当前显示的件数是10,那么init时开始位置为1,结束位置为10,点击下一页后,开始位置变为11,结束位置变为20 var datas = GasConcentrationProbeData.SlicedSelectAllGasConcentrationProbeDataByProbeIdAndTime( iStartIndex, iEndIndex, _probeId, dtTimeStart, dtTimeEnd); // 当前检索件数(必须实装) var iSelCnt = datas.Length; Invoke(new MethodInvoker(delegate { // 重新设定farpoint显示行数 (必须实装) fpGasConcentrationProbeDataInfo.Sheets[0].Rows.Count = _iRowDetailStartIndex + iSelCnt; })); // 检索件数 > 0 的场合 if (iSelCnt > 0) { // 设置处理标识位 _iDisposeFlag = Const.DISPOSE_FLAG_ONE; // 当前检索件数(必须实装) _iRowCount = iSelCnt; // 循环结果集 for (var i = 0; i < iSelCnt; i++) { var index = 0; // 选择 Invoke(new MethodInvoker(delegate { var objCheckCell = new CheckBoxCellType(); fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, index].CellType = objCheckCell; // 探头数据编号 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].ProbeDataId.ToString(); // 探头编号 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].Probe.ProbeId; // 探头数值 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].ProbeValue.ToString(); // 记录时间 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].RecordTime.ToString("yyyy-MMMM-dd hh:mm:ss"); // 记录类型 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].RecordType; // 探头信息取得 //DataSet dsProbe = ProbeManageBLL.selectProbeManageInfoByProbeId(strProbeId); if (datas[i].Probe != null) { // 探头名称 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].Probe.ProbeName; // 探头类型 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].Probe.ProbeType.ProbeTypeName; // 探头描述 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].Probe.ProbeDescription; // 矿井名称 if (datas[i].Probe.Tunnel != null) { fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].Probe.Tunnel.WorkingFace.MiningArea.Horizontal.Mine.MineName; // 水平 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].Probe.Tunnel.WorkingFace.MiningArea.Horizontal.HorizontalName; // 采区 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].Probe.Tunnel.WorkingFace.MiningArea.MiningAreaName; // 工作面 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].Probe.Tunnel.WorkingFace.WorkingFaceName; // 巷道名称 fpGasConcentrationProbeDataInfo.Sheets[0].Cells[_iRowDetailStartIndex + i, ++index].Text = datas[i].Probe.Tunnel.TunnelName; } } })); } } else { // 显示无数据提示信息 Invoke(new MethodInvoker(delegate { _lblNoData.Text = "提示:无数据!"; _lblNoData.Visible = true; })); } Invoke(new MethodInvoker(delegate { _lblNoData.Visible = false; _lblNoData.Text = "查询数据中..."; _btnQuery.Text = "查询"; _btnQuery.Enabled = true; dataPager1.Enabled = true; })); }