ImportGLdatamanageForm.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. namespace Uninpho.Tools.components.DWForm
  17. {
  18. public partial class ImportGLdatamanageForm : DevExpress.XtraEditors.XtraForm
  19. {
  20. public ImportGLdatamanageForm()
  21. {
  22. InitializeComponent();
  23. }
  24. /// 浏览文件目录
  25. private void simpleButton2_Click(object sender, EventArgs e)
  26. {
  27. // 创建一个OpenFileDialog实例
  28. OpenFileDialog openFileDialog = new OpenFileDialog
  29. {
  30. // 设置文件对话框的标题
  31. Title = "选择文件",
  32. // 初始目录,可选
  33. InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
  34. // 设置过滤条件,只显示文本文件,可以根据需要修改
  35. Filter = "文本 (*.txt)|*.txt"
  36. };
  37. // 显示文件对话框并检查用户是否选择了文件
  38. if (openFileDialog.ShowDialog() == DialogResult.OK)
  39. {
  40. // 将选择的文件路径写入文本框
  41. txtindir.Text = openFileDialog.FileName;
  42. }
  43. }
  44. /// 导入数据
  45. private void newCreateBtnSon_Click(object sender, EventArgs e)
  46. {
  47. }
  48. ///取消
  49. private void NewcancelBtn_Click(object sender, EventArgs e)
  50. {
  51. this.Close();
  52. }
  53. ///关联数据库
  54. /// 电务/缺口
  55. List<T_dwfile_account> dwglData = new List<T_dwfile_account>();
  56. private void xianlumingText_SelectedIndexChanged(object sender, EventArgs e)
  57. {
  58. }
  59. ///初始界面加载
  60. private void ImportGLdatamanageForm_Load(object sender, EventArgs e)
  61. {
  62. dwglData = DBOperation.Operation.DataAnalysisToPG.QueryDWGLALL();
  63. //整理线路名集合
  64. var listtgXLMALL = dwglData.GroupBy(c => c.Xianlu).Select(c => c.First()).ToList();
  65. foreach (var item in listtgXLMALL)
  66. {
  67. xianlumingText.Properties.Items.Add(item.Xianlu);
  68. }
  69. }
  70. ///线路名下拉选择
  71. private void xianlumingText_EditValueChanged(object sender, EventArgs e)
  72. {
  73. zhanmingText.Properties.Items.Clear();
  74. var isInputTrueXLM = dwglData.FindAll(delegate (T_dwfile_account dwgl)
  75. {
  76. return dwgl.Xianlu == xianlumingText.Text;
  77. });
  78. //线路名
  79. if (isInputTrueXLM.Count != 0)
  80. {
  81. var listtg = isInputTrueXLM.GroupBy(c => c.Chezhan).Select(c => c.First()).ToList();
  82. foreach (var item in listtg)
  83. {
  84. zhanmingText.Properties.Items.Add(item.Chezhan);
  85. }
  86. zhanmingText.Enabled = true;
  87. }
  88. else
  89. {
  90. zhanmingText.Enabled = false;
  91. }
  92. zhanmingText.Text = "";
  93. }
  94. }
  95. }