private void Update(int Row, int Column) { int RowViewportIndex = FpSpread.GetActiveRowViewportIndex(); int ColumnViewportIndex = FpSpread.GetActiveColumnViewportIndex(); Rectangle rect = FpSpread.GetCellRectangle(RowViewportIndex, ColumnViewportIndex, Row, Column); FpSpread.Invalidate(rect); }
private void Button_Query_Click(object sender, EventArgs e) { ProgressScreen.Current.ShowSplashScreen(); ProgressScreen.Current.SetStatus = "正在获取数据..."; FpSpread_Info.OperationMode = OperationMode.ReadOnly; DateTime StartDate = DateTime.Parse(string.Format("{0}-{1}-{2} 00:00:00", DateTimePicker_Start.Value.Year, DateTimePicker_Start.Value.Month, DateTimePicker_Start.Value.Day)); DateTime EndDate = DateTime.Parse(string.Format("{0}-{1}-{2} 23:59:59", DateTimePicker_End.Value.Year, DateTimePicker_End.Value.Month, DateTimePicker_End.Value.Day)); string BGBH = txtBGBH.Text.Trim(); DataTable Data = PXJZReportDataList.GetPXReportRelation(PXTestRoomCode, ModuleID, StartDate, EndDate, BGBH); if (Data != null) { //BizComponents.TextCellType text = new BizComponents.TextCellType(); //text.ReadOnly = false; 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; for (int j = 0; j < FpSpread_Info.ColumnHeader.Columns.Count; j++) { String v = Data.Rows[i][j].ToString(); FpSpread_Info.Cells[i, j].Value = v; FpSpread_Info.Cells[i, j].Locked = false; //FpSpread_Info.Cells[i, j].CellType = text; } } } else { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } } else { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } ProgressScreen.Current.CloseSplashScreen(); this.Activate(); if (Data == null) { TotalCount.Text = string.Format("共 {0} 条记录", 0); } else { TotalCount.Text = string.Format("共 {0} 条记录", Data.Rows.Count); } }
private void PreviewDataDialog_Load(object sender, EventArgs e) { DataTable Data = new DataTable(); this.Source.DataAdapter = this.DataAdapter; if (this.Source is ArrayTableData) { Data = this.Source.GetDataSource(); } else if (this.Source is DbTableData) { String Command = (this.Source as DbTableData).GetQueryCommand(); String sql_Command = string.Format("select Top 50 * from ({0}) as a", Command); Data = (this.Source as DbTableData).DataAdapter.ExecuteCommand(sql_Command); } else if (this.Source is JoinTableData) { String Command = (this.Source as JoinTableData).GetQueryCommand(); String sql_Command = string.Format("select Top 50 * from ({0}) as a", Command); Data = (this.Source as JoinTableData).DataAdapter.ExecuteCommand(sql_Command); } if (Data.Rows.Count > 0) { FpSpread spread = fpSpread_DataView.ContainingViews[fpSpread_DataView.ContainingViews.Length - 1].Owner; spread.ShowRow(spread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); } fpSpread_DataView.Columns.Count = Data.Columns.Count; fpSpread_DataView.Rows.Count = Data.Rows.Count; int i, j; foreach (System.Data.DataColumn Column in Data.Columns) { i = Data.Columns.IndexOf(Column); fpSpread_DataView.Columns[i].VerticalAlignment = CellVerticalAlignment.Center; fpSpread_DataView.Columns[i].Label = Column.ColumnName; fpSpread_DataView.Columns[i].Width = 200; foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); fpSpread_DataView.Rows[j].HorizontalAlignment = CellHorizontalAlignment.Center; fpSpread_DataView.Cells[j, i].Value = Row[Column.ColumnName].ToString(); } } }
private void Bind() { DataTable Data = LoginDataList.GetOperateLogList(segment, company, testroom, StartDate, EndDate, tb_username.Text.Trim(), pagerControl1.PageIndex, pagesize, 0); pagerControl1.DrawControl(count, pagesize); if (Data != null) { 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++) { DataRow Row = Data.Rows[i]; FpSpread_Info.Rows[i].Tag = Row["ID"].ToString(); } for (int i = 0; i < Data.Rows.Count; i++) { FpSpread_Info.Rows[i].Tag = Data.Rows[i]["ID"].ToString(); FpSpread_Info.Rows[i].HorizontalAlignment = CellHorizontalAlignment.Center; for (int j = 0; j < FpSpread_Info.ColumnHeader.Columns.Count; j++) { FpSpread_Info.Cells[i, j].Value = Data.Rows[i][FpSpread_Info.ColumnHeader.Cells[0, j].Text].ToString(); } } } else { pagerControl1.DrawControl(count, pagesize); ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } } else { pagerControl1.DrawControl(count, pagesize); ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } ProgressScreen.Current.CloseSplashScreen(); this.Activate(); }
/// <summary> /// 显示联接表 /// </summary> private void ShowJoinTableData() { DataTable Schema = TableData.GetSchema(); //绑定数据时保证显示第一行,以免报错“System.ArgumentOutOfRangeException: Invalid low bound argument” if (FpSpread_Panel.Rows.Count > 0) { FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); } FpSpread_Panel.Reset(); FpSpread_Panel.RowHeaderVisible = false; FpSpread_Panel.RowCount = Schema.Rows.Count; FpSpread_Panel.ColumnCount = Schema.Columns.Count; Graphics g = FpSpread.CreateGraphics(); FarPoint.Win.Spread.CellType.TextCellType CellType = new FarPoint.Win.Spread.CellType.TextCellType(); CellType.Multiline = true; CellType.WordWrap = true; for (int k = 0; k < Schema.Columns.Count; k++) { FpSpread_Panel.Columns[k].CellType = CellType; FpSpread_Panel.Columns[k].VerticalAlignment = CellVerticalAlignment.Center; FpSpread_Panel.Columns[k].HorizontalAlignment = CellHorizontalAlignment.Center; FpSpread_Panel.Columns[k].Tag = Schema.Columns[k].ColumnName; FpSpread_Panel.ColumnHeader.Columns[k].Label = string.Concat(Schema.Columns[k].ColumnName, "(", TableData.GetDataTypeAbbr(k), ")"); FpSpread_Panel.ColumnHeader.Columns[k].Width = 250; } g.Dispose(); foreach (DataRow Row in Schema.Rows) { int RowIndex = Schema.Rows.IndexOf(Row); foreach (System.Data.DataColumn Col in Schema.Columns) { int ColIndex = Schema.Columns.IndexOf(Col); FpSpread_Panel.Cells[RowIndex, ColIndex].Value = Row[Col.ColumnName].ToString(); } } AutoColumnsWidth(FpSpread_Panel, AutoSizeFlags.Contents, 150); }
private void QuerySponsorModifyDialog_Load(object sender, EventArgs e) { DataTable Data = ProjectHelperClient.GetTestRoomCodeView(); if (Data != null) { FpSpread FpSpread = fpSpread1; SheetView FpSpread_Info = fpSpread1_Sheet; FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); FpSpread_Info.Columns.Count = 8; FpSpread_Info.Columns[0].Width = 100; FpSpread_Info.Columns[1].Width = 100; FpSpread_Info.Columns[2].Width = 100; FpSpread_Info.Columns[3].Width = 100; FpSpread_Info.Columns[4].Width = 100; FpSpread_Info.Columns[5].Width = 100; FpSpread_Info.Columns[6].Width = 100; FpSpread_Info.Columns[7].Width = 100; FpSpread_Info.Rows.Count = Data.Rows.Count; int i, j; foreach (System.Data.DataColumn Column in Data.Columns) { i = Data.Columns.IndexOf(Column); FpSpread_Info.Columns[i].VerticalAlignment = CellVerticalAlignment.Center; FpSpread_Info.Columns[i].Label = Column.ColumnName; foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].HorizontalAlignment = CellHorizontalAlignment.Center; FpSpread_Info.Cells[j, i].Value = Row[Column.ColumnName].ToString(); } } } }
private void Button_Query_Click(object sender, EventArgs e) { ProgressScreen.Current.ShowSplashScreen(); ProgressScreen.Current.SetStatus = "正在获取数据..."; String segment = ""; String company = ""; String testroom = ""; String SelectedState = cb_state.SelectedItem.ToString(); if (ComboBox_Segments.SelectedItem is Prjsct) { segment = (ComboBox_Segments.SelectedItem as Prjsct).PrjsctCode; } if (ComboBox_Company.SelectedItem is Orginfo) { company = (ComboBox_Company.SelectedItem as Orginfo).DepCode; } if (ComboBox_TestRooms.SelectedItem is PrjFolder) { testroom = (ComboBox_TestRooms.SelectedItem as PrjFolder).FolderCode; } DateTime start = DateTime.Parse(string.Format("{0}-{1}-{2} 00:00:00", StartDateTimePicker.Value.Year, StartDateTimePicker.Value.Month, StartDateTimePicker.Value.Day)); DateTime end = DateTime.Parse(string.Format("{0}-{1}-{2} 00:00:00", EndDateTimePicker.Value.Year, EndDateTimePicker.Value.Month, EndDateTimePicker.Value.Day)); DataTable Data = DocumentHelperClient.GetRequestChangeList(segment, company, testroom, start, end, SelectedState, tb_content.Text.Trim(), tb_user.Text.Trim()); if (Data != null) { FpSpread FpSpread = fpSpread1; SheetView FpSpread_Info = fpSpread1_Sheet; FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); FpSpread_Info.Columns.Count = 12; FpSpread_Info.Columns[0].Width = 60; FpSpread_Info.Columns[1].Width = 60; FpSpread_Info.Columns[2].Width = 80; FpSpread_Info.Columns[3].Width = 80; FpSpread_Info.Columns[4].Width = 240; FpSpread_Info.Columns[5].Width = 160; FpSpread_Info.Columns[6].Width = 80; FpSpread_Info.Columns[7].Width = 50; FpSpread_Info.Columns[8].Width = 120; FpSpread_Info.Columns[9].Width = 300; FpSpread_Info.Columns[10].Width = 300; FpSpread_Info.Columns[0, FpSpread_Info.Columns.Count - 1].VerticalAlignment = CellVerticalAlignment.Center; TextCellType text = new TextCellType(); text.Multiline = true; text.WordWrap = true; FpSpread_Info.Columns[0, 2].CellType = text; FpSpread_Info.Rows.Count = Data.Rows.Count; if (Data.Rows.Count > 0) { FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].Height = 20; FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].Locked = true; FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].HorizontalAlignment = CellHorizontalAlignment.Center; } int i, j; foreach (System.Data.DataColumn Column in Data.Columns) { if (Column.ColumnName == "ID" || Column.ColumnName == "DataID" || Column.ColumnName == "ModuleID") { continue; } i = Data.Columns.IndexOf(Column); FpSpread_Info.Columns[i - 3].VerticalAlignment = CellVerticalAlignment.Center; FpSpread_Info.Columns[i - 3].Label = Column.ColumnName; foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].HorizontalAlignment = CellHorizontalAlignment.Center; FpSpread_Info.Cells[j, i - 3].Value = Row[Column.ColumnName].ToString(); } } foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].Tag = Row["ID"].ToString() + "," + Row["DataID"].ToString() + "," + Row["ModuleID"].ToString();// Row["ID"].ToString(); } if (Data.Rows.Count == 0) { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } } else { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } ProgressScreen.Current.CloseSplashScreen(); this.Activate(); }
private void BindDayList() { DateTime StartDate = DateTime.Parse(string.Format("{0}-{1}-{2} 00:00:00", DateTimePicker_Start.Value.Year, DateTimePicker_Start.Value.Month, DateTimePicker_Start.Value.Day)); DateTime EndDate = DateTime.Parse(string.Format("{0}-{1}-{2} 00:00:00", DateTimePicker_End.Value.Year, DateTimePicker_End.Value.Month, DateTimePicker_End.Value.Day)); DateTimePicker_End.Value = EndDate; ProgressScreen.Current.ShowSplashScreen(); ProgressScreen.Current.SetStatus = "正在获取数据..."; String testroom = TestRoomCode;// Yqun.Common.ContextCache.ApplicationContext.Current.InTestRoom.Code; EndDate = EndDate.AddDays(1); var TemperatureType = Convert.ToInt32(ComboTemperature.SelectedValue); DataTable Data = ModuleHelperClient.GetTemperatureList(testroom, StartDate, EndDate, TemperatureType); if (Data != null) { FarPoint.Win.Spread.CellType.TextCellType text = new FarPoint.Win.Spread.CellType.TextCellType(); FpSpread_Info.Columns[2].Width = 100; FpSpread_Info.Columns[3].Width = 100; FpSpread_Info.Columns[4].Width = 100; FpSpread_Info.Columns[5].Width = 100; FpSpread_Info.Columns[6].Width = 100; FpSpread_Info.Columns[7].Width = 200; FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); FpSpread_Info.Rows.Count = Data.Rows.Count; if (Data.Rows.Count > 0) { int i, j; foreach (System.Data.DataColumn Column in Data.Columns) { i = Data.Columns.IndexOf(Column); FpSpread_Info.Columns[i].Width = 100; foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].HorizontalAlignment = CellHorizontalAlignment.Center; if ((i == 3 || i == 4 || i == 5 || i == 6) && Row[Column.ColumnName] != null) { bool bIsNumber = false; float fValue = 0; bIsNumber = float.TryParse(Row[Column.ColumnName].ToString(), out fValue); if (bIsNumber == true) { FpSpread_Info.Cells[j, i].Value = fValue.ToString("F1"); } else { FpSpread_Info.Cells[j, i].Value = Row[Column.ColumnName]; } } else { FpSpread_Info.Cells[j, i].Value = Row[Column.ColumnName]; } } } #region 计算总温度与锁定两天以前添加的温度 double fTemperatureSum = 0; object TemperatureAvg = null; object oLastEditTime = null; DateTime dtLastEditTime = new DateTime(); foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].Tag = Row["ID"] == DBNull.Value ? "" : Row["ID"].ToString(); TemperatureAvg = Row["TemperatureAvg"]; oLastEditTime = Row["LastEditTime"]; if (TemperatureAvg != DBNull.Value) { fTemperatureSum += Convert.ToDouble(TemperatureAvg); } if (oLastEditTime != DBNull.Value) { dtLastEditTime = DateTime.Parse(oLastEditTime.ToString()); if (dtLastEditTime.AddDays(2).CompareTo(DateTime.Now.Date) < 0 && !Yqun.Common.ContextCache.ApplicationContext.Current.IsAdministrator) { FpSpread_Info.Rows[j].Locked = true; } } } lblTemperatureSum.Text = string.Format("总温度:{0}℃", fTemperatureSum.ToString("f1")); #endregion } else { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } } else { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } ProgressScreen.Current.CloseSplashScreen(); this.Activate(); if (Data == null) { TotalCount.Text = string.Format("本次查询共 {0} 条记录", 0); } else { TotalCount.Text = string.Format("本次查询共 {0} 条记录", Data.Rows.Count); } }
private void Button_Query_Click(object sender, EventArgs e) { ProgressScreen.Current.ShowSplashScreen(); ProgressScreen.Current.SetStatus = "正在获取数据..."; FpSpread_Info.OperationMode = OperationMode.ReadOnly; String segment = ""; String company = ""; String testroom = ""; if (ComboBox_Segments.SelectedItem is Prjsct) { segment = (ComboBox_Segments.SelectedItem as Prjsct).PrjsctCode; } if (ComboBox_Company.SelectedItem is Orginfo) { company = (ComboBox_Company.SelectedItem as Orginfo).DepCode; } if (ComboBox_TestRooms.SelectedItem is PrjFolder) { testroom = (ComboBox_TestRooms.SelectedItem as PrjFolder).FolderCode; } DateTime StartDate = DateTime.Parse(string.Format("{0}-{1}-{2} 00:00:00", DateTimePicker_Start.Value.Year, DateTimePicker_Start.Value.Month, DateTimePicker_Start.Value.Day)); DateTime EndDate = DateTime.Parse(string.Format("{0}-{1}-{2} 23:59:59", DateTimePicker_End.Value.Year, DateTimePicker_End.Value.Month, DateTimePicker_End.Value.Day)); DataTable Data = PXJZReportDataList.GetJZReportInfos(segment, company, testroom, StartDate, EndDate); if (Data != null) { 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; for (int j = 0; j < FpSpread_Info.ColumnHeader.Columns.Count; j++) { String v = Data.Rows[i][FpSpread_Info.ColumnHeader.Cells[0, j].Tag.ToString()].ToString(); FpSpread_Info.Cells[i, j].Value = v; if (v == "不满足") { FpSpread_Info.Rows[i].BackColor = Color.FromArgb(255, 192, 192); } else { FpSpread_Info.Rows[i].BackColor = Color.FromName(System.Drawing.KnownColor.Control.ToString()); } } } } else { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } } else { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } ProgressScreen.Current.CloseSplashScreen(); this.Activate(); if (Data == null) { TotalCount.Text = string.Format("共 {0} 条记录", 0); } else { TotalCount.Text = string.Format("共 {0} 条记录", Data.Rows.Count); } }
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; } }
private void Bind() { DataTable Data = LoginDataList.GetLoginLogInfos(segment, company, testroom, StartDate, EndDate, tb_username.Text.Trim(), pagerControl1.PageIndex, pagesize, 0); pagerControl1.DrawControl(count, pagesize); if (Data != null) { FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); FpSpread_Info.Rows.Count = Data.Rows.Count; if (Data.Rows.Count > 0) { FpSpread_Info.Columns.Count = Data.Columns.Count; FpSpread_Info.ColumnHeader.RowCount = 1; for (int i = 0; i < Data.Columns.Count; i++) { FpSpread_Info.ColumnHeader.Cells[0, i].Text = Data.Columns[i].ColumnName; switch (Data.Columns[i].ColumnName) { case "用户": FpSpread_Info.Columns[i].Width = 120; break; case "IP地址": FpSpread_Info.Columns[i].Width = 150; break; case "物理地址": FpSpread_Info.Columns[i].Width = 150; break; case "机器名": FpSpread_Info.Columns[i].Width = 120; break; case "操作系统": FpSpread_Info.Columns[i].Width = 160; break; case "系统账户": FpSpread_Info.Columns[i].Width = 120; break; case "项目": FpSpread_Info.Columns[i].Width = 150; break; case "标段": FpSpread_Info.Columns[i].Width = 150; break; case "单位": FpSpread_Info.Columns[i].Width = 150; break; case "试验室": FpSpread_Info.Columns[i].Width = 150; break; case "登录时间": FpSpread_Info.Columns[i].Width = 170; break; case "退出时间": FpSpread_Info.Columns[i].Width = 170; break; default: break; } } for (int i = 0; i < Data.Rows.Count; i++) { FpSpread_Info.Rows[i].HorizontalAlignment = CellHorizontalAlignment.Center; for (int j = 0; j < FpSpread_Info.ColumnHeader.Columns.Count; j++) { FpSpread_Info.Cells[i, j].Value = Data.Rows[i][FpSpread_Info.ColumnHeader.Cells[0, j].Text].ToString(); } } } else { pagerControl1.DrawControl(count, pagesize); ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } } else { pagerControl1.DrawControl(count, pagesize); ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } ProgressScreen.Current.CloseSplashScreen(); this.Activate(); }
/// <summary> /// 显示数据表 /// </summary> private void ShowArrayTableData() { DataTable Schema = TableData.GetSchema(); //绑定数据时保证显示第一行,以免报错“System.ArgumentOutOfRangeException: Invalid low bound argument” if (FpSpread_Panel.Rows.Count > 0) { FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); } FpSpread_Panel.Reset(); FpSpread_Panel.RowHeaderVisible = false; FpSpread_Panel.RowCount = Schema.Rows.Count; FpSpread_Panel.ColumnCount = Schema.Columns.Count; Graphics g = FpSpread.CreateGraphics(); for (int k = 0; k < Schema.Columns.Count; k++) { FpSpread_Panel.Columns[k].VerticalAlignment = CellVerticalAlignment.Center; FpSpread_Panel.Columns[k].HorizontalAlignment = CellHorizontalAlignment.Center; FpSpread_Panel.Columns[k].Tag = Schema.Columns[k].ColumnName; FpSpread_Panel.ColumnHeader.Columns[k].Label = string.Concat(Schema.Columns[k].ColumnName, "(", TableData.GetDataTypeAbbr(k), ")"); FpSpread_Panel.ColumnHeader.Columns[k].Width = g.MeasureString(FpSpread_Panel.ColumnHeader.Columns[k].Label, FpSpread.Font).Width + 20; if (Schema.Columns[k].DataType == typeof(string)) { FpSpread_Panel.Columns[k].CellType = TextType; } else if (Schema.Columns[k].DataType == typeof(long)) { FpSpread_Panel.Columns[k].CellType = IntegerType; } else if (Schema.Columns[k].DataType == typeof(double)) { FpSpread_Panel.Columns[k].CellType = FloatType; } else if (Schema.Columns[k].DataType == typeof(DateTime)) { FpSpread_Panel.Columns[k].CellType = DateType; } } g.Dispose(); for (int j = 0; j < FpSpread_Panel.Columns.Count; j++) { for (int i = 0; i < FpSpread_Panel.Rows.Count; i++) { if (FpSpread_Panel.Columns[j].Tag != null) { FpSpread_Panel.Cells[i, j].Value = Schema.Rows[i][FpSpread_Panel.Columns[j].Tag.ToString()]; } } } if (FpSpread_Panel.ColumnHeader.Columns.Count > 0) { AutoColumnsWidth(FpSpread_Panel, 0, FpSpread_Panel.ColumnHeader.Columns.Count - 1, AutoSizeFlags.Contents, 150); } }
public void Execute(IJobExecutionContext context) { //获得当前用户所在的试验室编码 String Project = context.Scheduler.Context.GetString("project"); String TestRoomCode = context.Scheduler.Context.GetString("currentLabCode"); if (!string.IsNullOrEmpty(Project) && !string.IsNullOrEmpty(TestRoomCode)) { DataTable Data = DepositoryLabStadiumList.GetLabStadiumList(TestRoomCode); if (Data != null) { logger.Info(string.Format("[{0}]获取试验龄期提醒信息成功,共{1}条信息。", Project, Data.Rows.Count)); if (Data.Rows.Count > 0) { logger.Info(string.Format("[{0}]正在初始化试验龄期提醒信息...", Project)); StadiumReminderDialog Dialog = new StadiumReminderDialog(); Dialog.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; FpSpread FpSpread = Dialog.FpSpread; SheetView FpSpread_Info = Dialog.FpSpread_Info; FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); int HiddenColumnCount = 4; FpSpread_Info.Columns.Count = Data.Columns.Count - HiddenColumnCount; if (FpSpread_Info.Columns.Count > 0) { FpSpread_Info.Columns[0].Width = 160; FpSpread_Info.Columns[1].Width = 110; FpSpread_Info.Columns[2].Width = 80; FpSpread_Info.Columns[3].Width = 120; FpSpread_Info.Columns[4].Width = 100; FpSpread_Info.Columns[5].Width = 120; FpSpread_Info.Columns[6].Width = 190; FpSpread_Info.Columns[7].Width = 190; FpSpread_Info.Columns[0, FpSpread_Info.Columns.Count - 1].VerticalAlignment = CellVerticalAlignment.Center; FpSpread_Info.Columns[0, FpSpread_Info.Columns.Count - 1].HorizontalAlignment = CellHorizontalAlignment.Center; } DateTimeCellType datetime = new DateTimeCellType(); datetime.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate; FarPoint.Win.Spread.CellType.TextCellType text = new FarPoint.Win.Spread.CellType.TextCellType(); text.Multiline = true; text.WordWrap = true; FpSpread_Info.Columns[2].CellType = datetime; FpSpread_Info.Columns[5].CellType = text; FpSpread_Info.Columns[6].CellType = text; FpSpread_Info.Columns[7].CellType = text; FpSpread_Info.Rows.Count = Data.Rows.Count; if (Data.Rows.Count > 0) { FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].Height = 35; FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].Locked = true; FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].HorizontalAlignment = CellHorizontalAlignment.Center; FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].VerticalAlignment = CellVerticalAlignment.Center; } int i, j; foreach (System.Data.DataColumn Column in Data.Columns) { if (Column.ColumnName == "ID" || Column.ColumnName == "ModelCode" || Column.ColumnName == "ModelIndex" || Column.ColumnName == "DateSpan") { continue; } i = Data.Columns.IndexOf(Column); FpSpread_Info.Columns[i - HiddenColumnCount].VerticalAlignment = CellVerticalAlignment.Center; FpSpread_Info.Columns[i - HiddenColumnCount].Label = Column.ColumnName; foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].HorizontalAlignment = CellHorizontalAlignment.Center; FpSpread_Info.Cells[j, i - HiddenColumnCount].Value = Row[Column.ColumnName].ToString(); } } foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].Tag = Row["ModelCode"].ToString() + "," + Row["ModelIndex"].ToString() + "," + Row["ID"].ToString() + "," + Row["DateSpan"].ToString(); } logger.Info(string.Format("[{0}]正在显示提醒窗口...", Project)); Dialog.ShowDialog(); } } else { logger.Info(string.Format("[{0}]获取试验龄期提醒信息失败。", Project)); } logger.Info(string.Format("[{0}]试验龄期提醒完毕,试验室编码:{1}", Project, TestRoomCode)); } }
private void Button_Query_Click(object sender, EventArgs e) { ProgressScreen.Current.ShowSplashScreen(); ProgressScreen.Current.SetStatus = "正在获取数据..."; String segment = ""; String company = ""; String testroom = ""; if (ComboBox_Segments.SelectedItem is Prjsct) { segment = (ComboBox_Segments.SelectedItem as Prjsct).PrjsctCode; } else { segment = ""; } if (ComboBox_Company.SelectedItem is Orginfo) { company = (ComboBox_Company.SelectedItem as Orginfo).DepCode; } else { company = ""; } if (ComboBox_TestRooms.SelectedItem is PrjFolder) { testroom = (ComboBox_TestRooms.SelectedItem as PrjFolder).FolderCode; } else { testroom = ""; } DateTime StartDate = DateTime.Parse(string.Format("{0}-{1}-{2} 00:00:00", DateTimePicker_Start.Value.Year, DateTimePicker_Start.Value.Month, DateTimePicker_Start.Value.Day)); DateTime EndDate = DateTime.Parse(string.Format("{0}-{1}-{2} 00:00:00", DateTimePicker_End.Value.Year, DateTimePicker_End.Value.Month, DateTimePicker_End.Value.Day)); String sReportName = TextBox_ReportName.Text; String sReportNumber = TextBox_ReportNumber.Text; String sTestItems = TextBox_TestItems.Text; int SameCountSum = 0; DataTable Data = DocumentHelperClient.GetInvalidDocumentList(segment, company, testroom, sReportName, sReportNumber, StartDate, EndDate, sTestItems); if (Data != null) { FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); FpSpread_Info.Rows.Count = Data.Rows.Count; if (Data.Rows.Count > 0) { FarPoint.Win.Spread.CellType.TextCellType text = new FarPoint.Win.Spread.CellType.TextCellType(); text.Multiline = true; text.WordWrap = true; FpSpread_Info.Columns[0, 2].CellType = text; FpSpread_Info.Columns[11].CellType = text; FpSpread_Info.Columns[12].CellType = text; FpSpread_Info.Columns[13].CellType = text; FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].Height = 25; FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].Locked = true; FpSpread_Info.Columns[0, FpSpread_Info.Columns.Count - 1].VerticalAlignment = CellVerticalAlignment.Center; FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].HorizontalAlignment = CellHorizontalAlignment.Center; int i, j; foreach (System.Data.DataColumn Column in Data.Columns) { if (Column.ColumnName == "ID" || Column.ColumnName == "ModuleID") { continue; } i = Data.Columns.IndexOf(Column); FpSpread_Info.Columns[i - 2].VerticalAlignment = CellVerticalAlignment.Center; FpSpread_Info.Columns[i - 2].Label = Column.ColumnName; foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].HorizontalAlignment = CellHorizontalAlignment.Center; FpSpread_Info.Cells[j, i - 2].Value = Row[Column.ColumnName].ToString(); } } string strIsHeGe, strID; //foreach (DataRow Row in Data.Rows) //{ // j = Data.Rows.IndexOf(Row); // FpSpread_Info.Rows[j].Tag = Row["ID"].ToString() + "," + Row["ModuleID"].ToString(); // strIsHeGe = Row["是否合格"].ToString(); // if (strIsHeGe == "已合格") // { // FpSpread_Info.Rows[j].BackColor = Color.FromArgb(240, 180, 120); // } // else // { // FpSpread_Info.Rows[j].BackColor = Color.White; // } // strInvalidItem = Row["不合格项目"].ToString(); // FpSpread_Info.Rows[j].Height = strInvalidItem.Split('\r').Length * 24; // strID = Row["ID"].ToString(); //} DataRow drRow; int SameCount; for (int m = 0; m < Data.Rows.Count; m++) { FpSpread_Info.Rows[m].Tag = Data.Rows[m]["ID"].ToString() + "," + Data.Rows[m]["ModuleID"].ToString(); strIsHeGe = Data.Rows[m]["是否合格"].ToString(); if (strIsHeGe == "已合格") { FpSpread_Info.Rows[m].BackColor = Color.FromArgb(240, 180, 120); } else { FpSpread_Info.Rows[m].BackColor = Color.White; } drRow = Data.Rows[m]; strID = drRow["ID"].ToString(); SameCount = -1; foreach (DataRow drItem in Data.Rows) { if (strID == drItem["ID"].ToString()) { SameCount++; } } if (SameCount > 0) { foreach (System.Data.DataColumn Column in Data.Columns) { if (Column.ColumnName == "ID" || Column.ColumnName == "ModuleID" || Column.ColumnName == "不合格项目" || Column.ColumnName == "标准规定值" || Column.ColumnName == "实测值") { continue; } i = Data.Columns.IndexOf(Column); FpSpread_Info.Cells[m, i - 2].RowSpan = SameCount + 1; } SameCountSum += SameCount; m += SameCount; } } FpSpread.MouseUp += new MouseEventHandler(FpSpread_MouseUp); } else { FpSpread.MouseUp -= new MouseEventHandler(FpSpread_MouseUp); ProgressScreen.Current.CloseSplashScreen(); this.Activate(); MessageBox.Show("无数据,请重新选择条件!"); } } else { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); FpSpread.MouseUp -= new MouseEventHandler(FpSpread_MouseUp); MessageBox.Show("无数据,请重新选择条件!"); } ProgressScreen.Current.CloseSplashScreen(); this.Activate(); if (Data == null) { TotalCount.Text = string.Format("本次查询共 {0} 条记录", 0); } else { TotalCount.Text = string.Format("本次查询共 {0} 条记录", Data.Rows.Count - SameCountSum); } }
public void Execute(IJobExecutionContext context) { //获得当前用户名称和单位类型 String Project = context.Scheduler.Context.GetString("project"); String CompanyIndex = context.Scheduler.Context.GetString("currentCompanyIndex"); String CompanyType = context.Scheduler.Context.GetString("currentCompanyType"); Boolean IsAdmin = context.Scheduler.Context.GetBoolean("isAdmin"); if (!string.IsNullOrEmpty(Project) && !string.IsNullOrEmpty(CompanyType) && CompanyType != "@unit_施工单位") { List <String> RoomCodes = DepositoryEvaluateDataList.GetTestRoomList(IsAdmin, CompanyIndex, CompanyType); logger.Info(string.Format("[{0}]获得监管的试验室编码完成,编码列表为:{1}", Project, string.Join(",", RoomCodes.ToArray()))); DataTable Data = DepositoryEvaluateDataList.GetReminderInfos(RoomCodes.ToArray(), DateTime.Now, DateTime.Now); if (Data != null) { logger.Info(string.Format("[{0}]获取不合格报告信息成功,共{1}条信息。", Project, Data.Rows.Count)); if (Data.Rows.Count > 0) { logger.Info(string.Format("[{0}]正在初始化不合格报告信息...", Project)); ReportEvaluateDialog Dialog = new ReportEvaluateDialog(Project); FpSpread FpSpread = Dialog.FpSpread; SheetView FpSpread_Info = Dialog.FpSpread_Info; FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); FarPoint.Win.Spread.CellType.TextCellType text = new FarPoint.Win.Spread.CellType.TextCellType(); text.Multiline = true; text.WordWrap = true; FpSpread_Info.Columns[0, 2].CellType = text; FpSpread_Info.Rows.Count = Data.Rows.Count; FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].Height = 25; FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].Locked = true; FpSpread_Info.Columns[0, FpSpread_Info.Columns.Count - 1].VerticalAlignment = CellVerticalAlignment.Center; FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].HorizontalAlignment = CellHorizontalAlignment.Center; int i, j; foreach (System.Data.DataColumn Column in Data.Columns) { if (Column.ColumnName == "ID" || Column.ColumnName == "DataIndex" || Column.ColumnName == "ModelCode" || Column.ColumnName == "ModelIndex") { continue; } i = Data.Columns.IndexOf(Column); FpSpread_Info.Columns[i - 4].VerticalAlignment = CellVerticalAlignment.Center; FpSpread_Info.Columns[i - 4].Label = Column.ColumnName; foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].HorizontalAlignment = CellHorizontalAlignment.Center; FpSpread_Info.Cells[j, i - 4].Value = Row[Column.ColumnName].ToString(); } } foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].Tag = Row["DataIndex"].ToString() + "," + Row["ModelCode"].ToString() + "," + Row["ModelIndex"].ToString() + "," + Row["ID"].ToString(); } logger.Info(string.Format("[{0}]正在显示提醒窗口...", Project)); Dialog.ShowDialog(); } } else { logger.Info(string.Format("[{0}]获取不合格报告信息失败。", Project)); } logger.Info(string.Format("[{0}]不合格报告提醒完毕", Project)); } }
private void BindDayList() { ProgressScreen.Current.ShowSplashScreen(); ProgressScreen.Current.SetStatus = "正在获取数据..."; DataTable Data = ModuleHelperClient.GetTemperatureList(testroom, StartDate, EndDate, TemperatureType); if (Data != null) { FpSpread_Info.DataSource = Data; FpSpread_Info.Columns[2].Width = 100; FpSpread_Info.Columns[3].Width = 100; FpSpread_Info.Columns[4].Width = 100; FpSpread_Info.Columns[5].Width = 100; FpSpread_Info.Columns[6].Width = 100; FpSpread_Info.Columns[7].Width = 200; FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top); FpSpread_Info.Rows.Count = Data.Rows.Count; if (Data.Rows.Count > 0) { int i, j; foreach (System.Data.DataColumn Column in Data.Columns) { i = Data.Columns.IndexOf(Column); FpSpread_Info.Columns[i].Width = 100; foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].HorizontalAlignment = CellHorizontalAlignment.Center; FpSpread_Info.Cells[j, i].Value = Row[Column.ColumnName]; } } double fTemperatureSum = 0; object TemperatureAvg = null; object oLastEditTime = null; DateTime dtLastEditTime = new DateTime(); foreach (DataRow Row in Data.Rows) { j = Data.Rows.IndexOf(Row); FpSpread_Info.Rows[j].Tag = Row["ID"] == DBNull.Value ? "" : Row["ID"].ToString(); TemperatureAvg = Row["TemperatureAvg"]; oLastEditTime = Row["LastEditTime"]; if (TemperatureAvg != DBNull.Value) { fTemperatureSum += Convert.ToDouble(TemperatureAvg); } if (oLastEditTime != DBNull.Value) { dtLastEditTime = DateTime.Parse(oLastEditTime.ToString()); if (dtLastEditTime.AddDays(2).CompareTo(DateTime.Now.Date) < 0 && !Yqun.Common.ContextCache.ApplicationContext.Current.IsAdministrator) { FpSpread_Info.Rows[j].Locked = true; } } } } else { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); } } else { ProgressScreen.Current.CloseSplashScreen(); this.Activate(); } ProgressScreen.Current.CloseSplashScreen(); this.Activate(); if (Data == null) { TotalCount.Text = string.Format("本次查询共 {0} 条记录", 0); } else { TotalCount.Text = string.Format("本次查询共 {0} 条记录", Data.Rows.Count); } }