| | |
| | | <?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;"/>--> |
| | |
| | | |
| | | 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(); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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 = "准备"; |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows; |
| | | using DataLoader.CS; |
| | | using System; |
| | | |
| | | namespace DataLoader.Model |
| | | { |
| | |
| | | CommonProp.UserId = uid; |
| | | CommonProp.Uname = uname; |
| | | CommonProp.Token = token; |
| | | CommonProp.Depcode = DBHelper.SelectDepCodeByUid(uid); |
| | | |
| | | owner.Dispatcher.Invoke(new Action(delegate |
| | | { |
| | |
| | | </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> |
| | |
| | | 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()); |
| | |
| | | LogOut.Info("************ 应用程序启动成功! ************"); |
| | | } |
| | | |
| | | // 获取元数据类型 |
| | | private List<MetaType> GetMetaTypes() |
| | | { |
| | | List<MetaType> list = new List<MetaType>(); |
| | |
| | | Importor.GetFiles(viewDatas); |
| | | this.isBusy = false; |
| | | } |
| | | |
| | | // 导入 |
| | | private void Import_MouseLeftButtonDown(object sender, RoutedEventArgs e) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private double _sizes; |
| | | |
| | | public double Sizes |
| | | { |
| | | set |
| | | { |
| | | if (_sizes != value) |
| | | { |
| | | _sizes = value; |
| | | ChangProperty("Sizes"); |
| | | } |
| | | } |
| | | get |
| | | { |
| | | return _sizes; |
| | | } |
| | | } |
| | | |
| | | private string _status; |
| | | |
| | | public string Status |