public Folder[] GetChildrenFolders(string folderId) { if (string.IsNullOrEmpty(folderId)) { folderId = "d:\\tmp\\tstRep"; } lock (_lockObject) { List <FolderExt> retVal = ChangeTracker.TrackingEntries.Select(x => x.Entity).OfType <FolderExt>().Where(x => x.ParentFolderId == folderId).ToList(); if (!retVal.Any()) { foreach (var path in Directory.GetDirectories(folderId)) { var subFolder = new FolderExt { Name = System.IO.Path.GetFileName(path), FileSystemPath = path, FolderId = path, ParentFolderId = folderId, ParentFolder = GetFolderById(folderId) }; retVal.Add(subFolder); ChangeTracker.Attach(subFolder); } } return(retVal.ToArray()); } }
public void CreatePivot(System.Data.DataTable dataSource, PivotTableConfig config) { var sheet = WorkBook.Worksheets.Add(dataSource.TableName); var source = sheet.Cell(1, 1).InsertTable(dataSource, dataSource.TableName, true); var range = source.DataRange; var dataRange = sheet.Range(sheet.Cell(1, 1), range.LastCell()); var ptSheet = WorkBook.Worksheets.Add(PIVOT_PREFIX + dataSource.TableName); var pt = ptSheet.PivotTables.AddNew(config.PivotName, ptSheet.Cell(1, 1), dataRange); foreach (var item in config.PivotColumns) { pt.ColumnLabels.Add(item); } foreach (var item in config.PivotRows) { pt.RowLabels.Add(item); } foreach (var item in config.PivotValues) { pt.Values.Add(item); } FilePath = FolderExt.getUniqueXlsxFileName(); WorkBook.SaveAs(FilePath); openExcel(FilePath, true); }
public Folder GetFolderById(string path) { var retVal = ChangeTracker.TrackingEntries.Select(x => x.Entity).OfType <FolderExt>().Where(x => x.FileSystemPath == path).FirstOrDefault(); if (retVal == null) { if (Directory.Exists(path)) { retVal = new FolderExt { Name = System.IO.Path.GetFileName(path), FolderId = path }; retVal.FileSystemPath = path; } ChangeTracker.Attach(retVal); } return(retVal); }
public static void run(string tbl_path, string output_path, string assemblyNamespace, bool optimized = false) { // set variables var typeLibFolder = new DirectoryInfo(tbl_path); var outputPath = new DirectoryInfo(output_path); var creationOrderList = new DirectoryInfo(outputPath.FullName + @"\TblCreationOrder.xml"); var creationOrder = new TypeLibMergeOrder(creationOrderList.FullName); assemblyNamespace = assemblyNamespace + "."; // Run Console.WriteLine("---------Input--------"); Console.WriteLine($"typeLibFolder {typeLibFolder.FullName}"); Console.WriteLine($"outputPath {outputPath.FullName}"); Console.WriteLine($"creationOrderList {creationOrderList.FullName}"); Console.WriteLine("---------Main run--------"); Console.ReadLine(); FolderExt.ClearFolder(outputPath); Directory.SetCurrentDirectory(outputPath.FullName); if (optimized && creationOrder.Exist()) { TlbToDllConverter.BuildDll(typeLibFolder, outputPath, creationOrder, assemblyNamespace); } else { TlbToDllConverter.BuildXmlAndDll(typeLibFolder, outputPath, creationOrder, assemblyNamespace); } Console.WriteLine("---------------Conversion complete------------------"); }