using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using System.IO; using Uninpho.Tools.components.MTLFF; using Uninpho.DBOperation.Operation; namespace Uninpho.Tools.components.ZZJH { public partial class ZZJHListFrom : DevExpress.XtraEditors.XtraForm { bool isall = true; public ZZJHListFrom() { InitializeComponent(); } /// /// 保存至数据库 /// private void simpleButton1_Click(object sender, EventArgs e) { sheetControl01.SaveDocument(ExcelTools.filenameall); var uid = ZZJHCommon.SaveExcel2PG(); //ZZJHCommon.saveExcelData2PG(); if (isall) { var nowdata = DataAnalysisToPG.getfilezzjh(); ExcelTools.gridControl02.DataSource = nowdata; for (int i = 0; i < nowdata.Count; i++) { if (ExcelTools.gridView02.GetRowCellValue(i, "Id").ToString() == uid) { ExcelTools.gridView02.SelectRow(i); } } XtraMessageBox.Show("保存完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } /// /// 保存至本地 /// private void simpleButton2_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "xlsx files(*.xlsx)|*.xlsx|All files(*.*)|*.*"; sfd.FileName = "道岔几何尺寸检查记录表";//道岔全面检查记录表 if (sfd.ShowDialog() == DialogResult.OK) { sheetControl01.SaveDocument(sfd.FileName); XtraMessageBox.Show("保存完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } /// /// 保存至数据库和本地 /// private void simpleButton4_Click(object sender, EventArgs e) { try { isall = false; simpleButton1_Click(sender, e); simpleButton2_Click(sender, e); isall = true; } catch (Exception) { throw; } } private void simpleButton3_Click(object sender, EventArgs e) { File.Delete(ExcelTools.filenameall); this.Close(); } private void ZZJHListFrom_Load(object sender, EventArgs e) { DataAnalysis.DACommon.DirectoryInit(Application.StartupPath + "\\zzjh_temp"); DataAnalysis.DACommon.FileCopy(Application.StartupPath + "\\zzjhdemo.xlsx", ExcelTools.filenameall); ExcelTools.initNewTableExcelzzjh(); sheetControl01.LoadDocument(ExcelTools.filenameall); ExcelTools.sheetControldemo = sheetControl01; //sheetControl01.LoadDocument(new byte[],); } private void ZZJHListFrom_FormClosed(object sender, FormClosedEventArgs e) { } } }