public void ReadActiveQueriesForXLSheet(string ProjectName) { var(Queries, Resolutions) = _ProjectRepository.GetQueriesForXLsheet(ProjectName); try { var Result = (from Resolution in Resolutions join Query in Queries on Resolution.QueryID equals Query.QueryID select new { QueryStatement = Query.QueryName, Resolution = Resolution.Solution }).AsEnumerable(); var mapper = new Ganss.Excel.ExcelMapper(); var Path = $@"C:\Users\DN5W\Documents\Visual Studio 2017\Projects\NG-Bot\Queries\{ProjectName.ToUpper()} Queries.xlsx"; mapper.Save(Path, Result, $"{ProjectName} Queries", true); } catch (System.IO.IOException) { Console.WriteLine("\n\tPlease close the file and try again!"); } }
public void ReadActiveQueriesForXLSheet(string ProjectName) { var(Queries, Resolutions) = _ProjectRepository.GetQueriesForXLsheet(ProjectName); try { var Result = (from Resolution in Resolutions join Query in Queries on Resolution.QueryID equals Query.QueryID select new { QueryStatement = Query.QueryName, Resolution = Resolution.Solution }).AsEnumerable(); var mapper = new Ganss.Excel.ExcelMapper(); var userName = WindowsIdentity.GetCurrent().Name.Split('\\')[1]; var Path = $@"C:\Users\{userName}\Downloads\{ProjectName.ToUpper()} Queries.xlsx"; mapper.Save(Path, Result, $"{ProjectName} Queries", true); } catch (System.IO.IOException) { Console.WriteLine("\n\tPlease close the file and try again!"); } }