From 88ebe3f492f8af85d46606a3cc0bad95c4290c66 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 23 八月 2023 13:49:27 +0800 Subject: [PATCH] 查询用户所在的单位编码、显示文件的大小信息等 --- DataLoader/Model/ViewData.cs | 18 +++++++++ DataLoader/App.config | 2 DataLoader/MainWindow.xaml.cs | 7 ++- DataLoader/CS/Importor.cs | 12 ++--- DataLoader/CS/NtstWeb.cs | 9 +--- DataLoader/MainWindow.xaml | 1 DataLoader/CS/DBHelper.cs | 12 ++++++ 7 files changed, 45 insertions(+), 16 deletions(-) diff --git a/DataLoader/App.config b/DataLoader/App.config index 50a0c79..dff2dde 100644 --- a/DataLoader/App.config +++ b/DataLoader/App.config @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> - <add key="StartPath" value="1"/> + <add key="StartPath" value="3"/> <add key="SourcePath" value="D:\Moon\data"/> <add key="TargetPath" value="D:\LF\upload"/> <!--<add key="pgConn" value="Server=127.0.0.1;Port=5433;Database=langfang;User Id=postgres;Password=postgres;"/>--> diff --git a/DataLoader/CS/DBHelper.cs b/DataLoader/CS/DBHelper.cs index a51056b..a716e80 100644 --- a/DataLoader/CS/DBHelper.cs +++ b/DataLoader/CS/DBHelper.cs @@ -84,5 +84,17 @@ return list; } + + /// <summary> + /// 鏍规嵁鐢ㄦ埛ID鏌ヨ鍗曚綅缂栫爜 + /// </summary> + public static string SelectDepCodeByUid(int userId) + { + string sql = string.Format("select depcode from lf.sys_user where id = {0}", userId); + + object obj = Tools.DBHelper.GetScalar(sql); + + return null == obj ? null : obj.ToString(); + } } } diff --git a/DataLoader/CS/Importor.cs b/DataLoader/CS/Importor.cs index 217d165..c93f991 100644 --- a/DataLoader/CS/Importor.cs +++ b/DataLoader/CS/Importor.cs @@ -16,17 +16,15 @@ public static void GetFiles(ObservableCollection<ViewData> viewDatas) { string[] files = Directory.GetFiles(CommonProp.SourcePath, "*", SearchOption.AllDirectories); - for (int i = 0, c = files.Length; i < c; i++) + + int i = 1; + foreach(string file in files) { - string file = files[i]; string ext = Path.GetExtension(file).ToLower(); - if (!StaticData.ALL_EXTENSION.Contains(ext) || IsExcludFile(file)) - { - continue; - } + if (!StaticData.ALL_EXTENSION.Contains(ext) || IsExcludFile(file)) continue; ViewData vd = new ViewData(); - vd.ID = i + 1; + vd.ID = i++; vd.FilePath = file; vd.Ext = ext; vd.Status = "鍑嗗"; diff --git a/DataLoader/CS/NtstWeb.cs b/DataLoader/CS/NtstWeb.cs index 4bc8e13..58e5ee6 100644 --- a/DataLoader/CS/NtstWeb.cs +++ b/DataLoader/CS/NtstWeb.cs @@ -1,9 +1,5 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; +锘縰sing DataLoader.CS; +using System; namespace DataLoader.Model { @@ -24,6 +20,7 @@ CommonProp.UserId = uid; CommonProp.Uname = uname; CommonProp.Token = token; + CommonProp.Depcode = DBHelper.SelectDepCodeByUid(uid); owner.Dispatcher.Invoke(new Action(delegate { diff --git a/DataLoader/MainWindow.xaml b/DataLoader/MainWindow.xaml index 1f05831..fc60e23 100644 --- a/DataLoader/MainWindow.xaml +++ b/DataLoader/MainWindow.xaml @@ -212,6 +212,7 @@ </GridViewColumn.CellTemplate> </GridViewColumn> <GridViewColumn Header="璺緞" Width="Auto" DisplayMemberBinding="{Binding Path=FilePath, Mode=OneWay}"/> + <GridViewColumn Header="澶у皬(MB)" Width="Auto" DisplayMemberBinding="{Binding Path=Sizes, Mode=OneWay}"/> <GridViewColumn Header="杩愯鐘舵��" Width="120" DisplayMemberBinding="{Binding Path=Status, Mode=OneWay}"/> </GridView.Columns> </GridView> diff --git a/DataLoader/MainWindow.xaml.cs b/DataLoader/MainWindow.xaml.cs index 1fdbeb3..b0c417e 100644 --- a/DataLoader/MainWindow.xaml.cs +++ b/DataLoader/MainWindow.xaml.cs @@ -29,13 +29,14 @@ this.DataContext = this; } + // 绐楀彛鍔犺浇瀹屾垚 private void Window_Loaded(object sender, RoutedEventArgs e) { CommonProp.Owner = this; CommonProp.Init(); - this.btnLoad.IsEnabled = false; - this.btnImport.IsEnabled = false; + //this.btnLoad.IsEnabled = false; + //this.btnImport.IsEnabled = false; lvView.DataContext = viewDatas; lvView.SetBinding(ListView.ItemsSourceProperty, new Binding()); @@ -44,6 +45,7 @@ LogOut.Info("************ 搴旂敤绋嬪簭鍚姩鎴愬姛锛� ************"); } + // 鑾峰彇鍏冩暟鎹被鍨� private List<MetaType> GetMetaTypes() { List<MetaType> list = new List<MetaType>(); @@ -156,6 +158,7 @@ Importor.GetFiles(viewDatas); this.isBusy = false; } + // 瀵煎叆 private void Import_MouseLeftButtonDown(object sender, RoutedEventArgs e) { diff --git a/DataLoader/Model/ViewData.cs b/DataLoader/Model/ViewData.cs index 2086ee0..5d6e7a5 100644 --- a/DataLoader/Model/ViewData.cs +++ b/DataLoader/Model/ViewData.cs @@ -53,6 +53,24 @@ } } + private double _sizes; + + public double Sizes + { + set + { + if (_sizes != value) + { + _sizes = value; + ChangProperty("Sizes"); + } + } + get + { + return _sizes; + } + } + private string _status; public string Status -- Gitblit v1.9.3