| | |
| | | { |
| | | get |
| | | { |
| | | if (_ph == null) _ph = new PostgreHelper(DbEnum.langfang); |
| | | if (_ph == null) _ph = new PostgreHelper(); |
| | | |
| | | return _ph; |
| | | } |
| | |
| | | |
| | | public static int InsertMeta(SysMeta meta) |
| | | { |
| | | List<DbParameter> list = Tool.GetParams<SysMeta>(insertMeta, meta); |
| | | List<DbParameter> list = Tools.GetParams<SysMeta>(insertMeta, meta); |
| | | |
| | | object obj = Helper.GetScalar(insertMeta, list.ToArray()); |
| | | |
| | |
| | | |
| | | vd.Meta = new SysMeta(); |
| | | vd.Meta.name = fi.Name; |
| | | vd.Meta.dirid = Tool.DirId; |
| | | //vd.Meta.dirid = Common.DirId; |
| | | vd.Meta.depid = 1; |
| | | vd.Meta.verid = 0; |
| | | vd.Meta.type = fi.Extension.ToLower().Replace(".", ""); |
| | | vd.Meta.sizes = Tool.SizeToMb(fi.Length); |
| | | vd.Meta.create_user = Tool.UserId; |
| | | vd.Meta.sizes = Tools.SizeToMb(fi.Length); |
| | | vd.Meta.create_user = CommonProp.UserId; |
| | | } |
| | | |
| | | public static void ImportFiles(ObservableCollection<ViewData> viewDatas, string target) |
| | | public static void ImportFiles(ObservableCollection<ViewData> viewDatas, string target, int start) |
| | | { |
| | | Parallel.ForEach(viewDatas, (vd, ParallelLoopState) => |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | vd.Status = "插入数据库..."; |
| | | int start = GetSubPath(target, 1); |
| | | SysMeta mf = GetMetaFile(vd, start, guid); |
| | | |
| | | int metaId = InsertMeta(mf); |
| | | if (metaId == 0) |
| | | { |
| | | vd.Status = "元数据出错!"; |
| | | return; |
| | | } |
| | | vd.Status = "获取数据目录..."; |
| | | int subPath = GetSubPath(target, start); |
| | | SysMeta mf = GetMetaFile(vd, subPath, guid); |
| | | |
| | | vd.Status = "复制文件..."; |
| | | CopyFile(vd.FilePath, Path.Combine(target, mf.path)); |
| | | |
| | | vd.Status = "完成。"; |
| | | vd.Status = "准备入库"; |
| | | vd.Meta = mf; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | vd.Status = "失败!"; |
| | | } |
| | | }); |
| | | |
| | | foreach (ViewData vd in viewDatas) |
| | | { |
| | | int metaId = InsertMeta(vd.Meta); |
| | | vd.Status = metaId == 0 ? "元数据出错!" : "完成。"; |
| | | } |
| | | } |
| | | |
| | | public static void ImportFiles2(ObservableCollection<ViewData> viewDatas, string target) |