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 Uninpho.DBOperation.Model; using System.IO; using Uninpho.DBOperation.Operation; using System.Text.RegularExpressions; using System.Reflection; namespace Uninpho.Tools.components.DWForm { public partial class ImportGLdatamanageForm : DevExpress.XtraEditors.XtraForm { public ImportGLdatamanageForm() { InitializeComponent(); } /// 浏览文件目录 private void simpleButton2_Click(object sender, EventArgs e) { // 创建一个OpenFileDialog实例 OpenFileDialog openFileDialog = new OpenFileDialog { // 设置文件对话框的标题 Title = "选择文件", // 初始目录,可选 InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop), // 设置过滤条件,只显示文本文件,可以根据需要修改 Filter = "文本 (*.txt)|*.txt" }; // 显示文件对话框并检查用户是否选择了文件 if (openFileDialog.ShowDialog() == DialogResult.OK) { // 将选择的文件路径写入文本框 txtindir.Text = openFileDialog.FileName; } } /// 导入数据 private void newCreateBtnSon_Click(object sender, EventArgs e) { } ///取消 private void NewcancelBtn_Click(object sender, EventArgs e) { this.Close(); } ///关联数据库 /// 电务/缺口 List dwglData = new List(); private void xianlumingText_SelectedIndexChanged(object sender, EventArgs e) { } ///初始界面加载 private void ImportGLdatamanageForm_Load(object sender, EventArgs e) { dwglData = DBOperation.Operation.DataAnalysisToPG.QueryDWGLALL(); //整理线路名集合 var listtgXLMALL = dwglData.GroupBy(c => c.Xianlu).Select(c => c.First()).ToList(); foreach (var item in listtgXLMALL) { xianlumingText.Properties.Items.Add(item.Xianlu); } } ///线路名下拉选择 private void xianlumingText_EditValueChanged(object sender, EventArgs e) { zhanmingText.Properties.Items.Clear(); var isInputTrueXLM = dwglData.FindAll(delegate (T_dwfile_account dwgl) { return dwgl.Xianlu == xianlumingText.Text; }); //线路名 if (isInputTrueXLM.Count != 0) { var listtg = isInputTrueXLM.GroupBy(c => c.Chezhan).Select(c => c.First()).ToList(); foreach (var item in listtg) { zhanmingText.Properties.Items.Add(item.Chezhan); } zhanmingText.Enabled = true; } else { zhanmingText.Enabled = false; } zhanmingText.Text = ""; } } }