ImportGLdatamanageForm.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.DBOperation.Model;
  12. using System.IO;
  13. using Uninpho.DBOperation.Operation;
  14. using System.Text.RegularExpressions;
  15. using System.Reflection;
  16. using Uninpho.Tools.components.DWForm;
  17. using Uninpho.Tools.components.DataAnalysis;
  18. using DevExpress.XtraGrid.Views.Grid;
  19. namespace Uninpho.Tools.components.DWForm
  20. {
  21. public partial class ImportGLdatamanageForm : DevExpress.XtraEditors.XtraForm
  22. {
  23. GridView grid;
  24. string lx;
  25. public ImportGLdatamanageForm(GridView GV,string type)
  26. {
  27. InitializeComponent();
  28. grid = GV;
  29. lx = type;
  30. }
  31. /// 浏览文件目录
  32. private void simpleButton2_Click(object sender, EventArgs e)
  33. {
  34. if (xianlumingText.Text==""||zhanmingText.Text=="")
  35. {
  36. XtraMessageBox.Show("请选择线路和车站", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
  37. }
  38. else
  39. {
  40. if (lx == "gl")
  41. {
  42. DWCommon.OpenFile("txt", grid, xianlumingText.Text, zhanmingText.Text);
  43. txtindir.Text = DWCommon.lj;
  44. }
  45. else if (lx == "qk")
  46. {
  47. DWQKCommon.OpenFile("txt", grid, xianlumingText.Text, zhanmingText.Text);
  48. txtindir.Text = DWQKCommon.lj;
  49. }
  50. }
  51. }
  52. /// 导入数据
  53. private void newCreateBtnSon_Click(object sender, EventArgs e)
  54. {
  55. if (lx == "gl")
  56. {
  57. DWCommon.AddFile();
  58. }
  59. else if (lx == "qk")
  60. {
  61. DWQKCommon.AddFile();
  62. }
  63. this.Close();
  64. }
  65. ///取消
  66. private void NewcancelBtn_Click(object sender, EventArgs e)
  67. {
  68. if (lx == "gl")
  69. {
  70. DWCommon.CancelAddFile();
  71. }
  72. else if (lx == "qk")
  73. {
  74. DWQKCommon.CancelAddFile();
  75. }
  76. this.Close();
  77. }
  78. ///关联数据库
  79. private void xianlumingText_SelectedIndexChanged(object sender, EventArgs e)
  80. {
  81. }
  82. ///初始界面加载
  83. ///
  84. List<T_daocha_account> daochaData = new List<T_daocha_account>();
  85. private void ImportGLdatamanageForm_Load(object sender, EventArgs e)
  86. {
  87. daochaData = DBOperation.Operation.DataAnalysisToPG.QueryDCTZALL();
  88. //整理线路名集合
  89. var listtgXLMALL = daochaData.GroupBy(c => c.Xlm).Select(c => c.First()).ToList();
  90. foreach (var item in listtgXLMALL)
  91. {
  92. xianlumingText.Properties.Items.Add(item.Xlm);
  93. }
  94. }
  95. ///线路名下拉选择
  96. private void xianlumingText_EditValueChanged(object sender, EventArgs e)
  97. {
  98. zhanmingText.Properties.Items.Clear();
  99. var isInputTrueXLM = daochaData.FindAll(delegate (T_daocha_account dc)
  100. {
  101. return dc.Xlm == xianlumingText.Text;
  102. });
  103. //线路名
  104. if (isInputTrueXLM.Count != 0)
  105. {
  106. var listtg = isInputTrueXLM.GroupBy(c => c.Czm).Select(c => c.First()).ToList();
  107. foreach (var item in listtg)
  108. {
  109. zhanmingText.Properties.Items.Add(item.Czm);
  110. }
  111. zhanmingText.Enabled = true;
  112. }
  113. else
  114. {
  115. zhanmingText.Enabled = false;
  116. }
  117. zhanmingText.Text = "";
  118. }
  119. }
  120. }