123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- 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<T_dwfile_account> dwglData = new List<T_dwfile_account>();
-
- 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 = "";
- }
-
- }
- }
|