XXXWListFrom.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Linq;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using DevExpress.XtraEditors;
  11. using Uninpho.Tools.components.MTLFF;
  12. using System.IO;
  13. using DevExpress.Spreadsheet;
  14. using Uninpho.DBOperation.Operation;
  15. namespace Uninpho.Tools.components.XXXW
  16. {
  17. public partial class XXXWListFrom : DevExpress.XtraEditors.XtraForm
  18. {
  19. public XXXWListFrom()
  20. {
  21. InitializeComponent();
  22. }
  23. int maxrow = 0;//已修改数据的最大行数
  24. /// <summary>
  25. /// 取消
  26. /// </summary>
  27. private void simpleButton3_Click(object sender, EventArgs e)
  28. {
  29. File.Delete(ExcelTools.filenameall);
  30. this.Close();
  31. }
  32. private void XXXWListFrom_Load(object sender, EventArgs e)
  33. {
  34. DataAnalysis.DACommon.DirectoryInit(Application.StartupPath + "\\xxxw_temp");
  35. DataAnalysis.DACommon.FileCopy(Application.StartupPath + "\\xxxwdemo.xlsx", ExcelTools.filenameall);
  36. sheetControl01.LoadDocument(ExcelTools.filenameall, DevExpress.Spreadsheet.DocumentFormat.Xlsx);
  37. }
  38. private void sheetControl01_CellValueChanged(object sender, DevExpress.XtraSpreadsheet.SpreadsheetCellEventArgs e)
  39. {
  40. if (e.Value.ToString() != "" || e.Value.ToString() != null)
  41. {
  42. if (maxrow < e.RowIndex)
  43. {
  44. maxrow = e.RowIndex;
  45. }
  46. }
  47. }
  48. private void saveBtn_Click(object sender, EventArgs e)
  49. {
  50. sheetControl01.SaveDocument();
  51. string uid = XXXWCommon.NewPageSave2PG(maxrow+1);
  52. var nowdata = DataAnalysisToPG.getfilexxxwL();
  53. ExcelTools.gridControl03.DataSource = nowdata;
  54. for (int i = 0; i < nowdata.Count; i++)
  55. {
  56. if (ExcelTools.gridView03.GetRowCellValue(i, "Id").ToString() == uid)
  57. {
  58. ExcelTools.gridView03.SelectRow(i);
  59. }
  60. }
  61. XtraMessageBox.Show("保存完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  62. this.Close();
  63. }
  64. }
  65. }