diff --git a/Controllers/AutoController.cs b/Controllers/AutoController.cs index 5d2945c..29b9096 100644 --- a/Controllers/AutoController.cs +++ b/Controllers/AutoController.cs @@ -139,6 +139,11 @@ namespace NejCommon.Controllers return query; } + protected virtual Task> ApplyPagination(IQueryable query, Pagination pag) + { + return query.ApplyPaginationRes(providers, pag); + } + /// /// Get all the /// @@ -147,7 +152,7 @@ namespace NejCommon.Controllers [HttpGet] public virtual async Task, Ok>>> GetAll([FromServices] TOwner company, [FromQuery] Pagination pag) { - var data = await ApplyDefaultOrdering(GetQuery(company)).AsNoTrackingWithIdentityResolution().ApplyPaginationRes(providers, pag); + var data = await ApplyPagination(ApplyDefaultOrdering(GetQuery(company)).AsNoTrackingWithIdentityResolution(), pag); //Console.Writeline(data.Data); diff --git a/Controllers/ResponseEnricher.cs b/Controllers/ResponseEnricher.cs index 32ef4cb..77f3466 100644 --- a/Controllers/ResponseEnricher.cs +++ b/Controllers/ResponseEnricher.cs @@ -9,15 +9,19 @@ namespace NejCommon.Controllers; public static class Responses { + public static FileStreamHttpResult RespondFileStream(this ControllerBase controller, Stream stream, string contentType, string fileName) + { + stream.Seek(0, SeekOrigin.Begin); + + controller.Response.Headers.Add("Content-Disposition", "inline; filename=" + fileName); + return TypedResults.File(stream, contentType, fileName); + } public static FileStreamHttpResult RespondXlsx(this ControllerBase controller, XLWorkbook file, string fileName) { var stream = new MemoryStream(); file.SaveAs(stream); - stream.Seek(0, SeekOrigin.Begin); - - controller.Response.Headers.Add("Content-Disposition", "inline; filename=" + fileName); - return TypedResults.File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName); + return RespondFileStream(controller, stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName); } public static FileStreamHttpResult RespondXlsxTable(this ControllerBase controller, IEnumerable data, string name = "Data", string? sheetName = null) { @@ -39,11 +43,7 @@ public static class Responses public static FileStreamHttpResult RespondXml(this ControllerBase controller, T obj, string fileName = "Data.xml") { var stream = Utils.Xml.Serialize(obj); - //Console.Writeline(stream.Length); - stream.Seek(0, SeekOrigin.Begin); - - controller.Response.Headers.Add("Content-Disposition", "inline; filename=" + fileName); - return TypedResults.File(stream, "text/xml", fileName); + return RespondFileStream(controller, stream, "text/xml", fileName); } } \ No newline at end of file diff --git a/Emails/wwwroot/output.css b/Emails/wwwroot/output.css index b596b6e..86a9ef8 100644 --- a/Emails/wwwroot/output.css +++ b/Emails/wwwroot/output.css @@ -1,5 +1,113 @@ +*, ::before, ::after { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +::backdrop { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + /* -! tailwindcss v3.4.11 | MIT License | https://tailwindcss.com +! tailwindcss v3.4.13 | MIT License | https://tailwindcss.com */ /* @@ -446,114 +554,6 @@ video { display: none; } -*, ::before, ::after { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; - --tw-contain-size: ; - --tw-contain-layout: ; - --tw-contain-paint: ; - --tw-contain-style: ; -} - -::backdrop { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; - --tw-contain-size: ; - --tw-contain-layout: ; - --tw-contain-paint: ; - --tw-contain-style: ; -} - .visible { visibility: visible; } @@ -570,6 +570,10 @@ video { display: table; } +.hidden { + display: none; +} + .filter { filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); } diff --git a/Utils/ClosedXMLSetup.cs b/Utils/ClosedXMLSetup.cs index 0caa736..9e7cbd0 100644 --- a/Utils/ClosedXMLSetup.cs +++ b/Utils/ClosedXMLSetup.cs @@ -10,7 +10,7 @@ public class FakeGraphicsEngine : IXLGraphicEngine { private static double PointsToPixels(double points, double dpi) { - return points / 72.0 * dpi; + return points / 72.0 * dpi / 10.0; } public double GetDescent(IXLFontBase font, double dpiY) { diff --git a/Utils/XmlUtils.cs b/Utils/XmlUtils.cs new file mode 100644 index 0000000..453469f --- /dev/null +++ b/Utils/XmlUtils.cs @@ -0,0 +1,34 @@ + + +using System.Text; +using System.Xml; + +using System.Xml.Serialization; + +namespace NejCommon.Utils; +public static class XmlUtils +{ + public static MemoryStream GetXmlStream(T obj) where T : class + { + + var stream = new MemoryStream(); + //use utf8 encoding + var serializer = new XmlSerializer(typeof(T)); + var settings = new XmlWriterSettings + { + Indent = true, + Encoding = Encoding.UTF8, + }; + + //Console.Writeline(stream.Length); + + using (var writer = XmlWriter.Create(stream, settings)) + { + serializer.Serialize(writer, obj); + //Console.Writeline(stream.Length); + stream.Seek(0, SeekOrigin.Begin); + + return stream; + } + } +}