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.DBOperation.Operation; namespace Uninpho.Tools.components.MTLFF { public partial class MTLFFListFrom : DevExpress.XtraEditors.XtraForm { bool isall = true; public MTLFFListFrom() { InitializeComponent(); } /// /// 保存至本地 /// 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 simpleButton1_Click(object sender, EventArgs e) { sheetControl01.SaveDocument(ExcelTools.filenameall); var uid = MTLFCommon.SaveExcel2PG(); //MTLFCommon.saveExcelData2PG(); if (isall) { var nowdata = DataAnalysisToPG.getfilemtlf(); ExcelTools.gridControl01.DataSource = nowdata; for (int i = 0; i < nowdata.Count; i++) { if (ExcelTools.gridView01.GetRowCellValue(i, "Id").ToString() == uid) { ExcelTools.gridView01.SelectRow(i); } } 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 MTLFFListFrom_Load(object sender, EventArgs e) { DataAnalysis.DACommon.DirectoryInit(Application.StartupPath + "\\mtlf_temp"); DataAnalysis.DACommon.FileCopy(Application.StartupPath + "\\mtlfdemo.xlsx", ExcelTools.filenameall); ExcelTools.initNewTableExcel(); sheetControl01.LoadDocument(ExcelTools.filenameall); ExcelTools.sheetControldemo = sheetControl01; //sheetControl01.LoadDocument(new byte[],); } private void MTLFFListFrom_FormClosed(object sender, FormClosedEventArgs e) { } } }