From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- Gestor.Application/Helpers/CustomLinq.cs | 421 ------------------------------- 1 file changed, 421 deletions(-) delete mode 100644 Gestor.Application/Helpers/CustomLinq.cs (limited to 'Gestor.Application/Helpers/CustomLinq.cs') diff --git a/Gestor.Application/Helpers/CustomLinq.cs b/Gestor.Application/Helpers/CustomLinq.cs deleted file mode 100644 index 2900b2e..0000000 --- a/Gestor.Application/Helpers/CustomLinq.cs +++ /dev/null @@ -1,421 +0,0 @@ -using Gestor.Common.Validation; -using Gestor.Model.Domain.Relatorios; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; - -namespace Gestor.Application.Helpers -{ - public static class CustomLinq - { - public static List CustomNot(this List list, List property) - where T : class - { - if (property == null || property.Count == 0) - { - return list; - } - return list.Where((T x) => { - Func func8 = null; - Func func9 = null; - Func func10 = null; - Func func11 = null; - Func func12 = null; - Func func13 = null; - Func func14 = null; - List filtroPersonalizados = property; - Func u003cu003e9_21 = CustomLinq.u003cu003ec__2.u003cu003e9__2_1; - if (u003cu003e9_21 == null) - { - u003cu003e9_21 = (FiltroPersonalizado p) => p.get_Propriedade(); - CustomLinq.u003cu003ec__2.u003cu003e9__2_1 = u003cu003e9_21; - } - return filtroPersonalizados.GroupBy(u003cu003e9_21).ToList>().All>((IGrouping p) => { - Func func; - IGrouping strs = p; - Func u003cu003e9_23 = CustomLinq.u003cu003ec__2.u003cu003e9__2_3; - if (u003cu003e9_23 == null) - { - u003cu003e9_23 = (FiltroPersonalizado s) => s.get_SemValor(); - CustomLinq.u003cu003ec__2.u003cu003e9__2_3 = u003cu003e9_23; - } - if (strs.Any(u003cu003e9_23)) - { - IGrouping strs1 = p; - Func u003cu003e9_4 = func8; - if (u003cu003e9_4 == null) - { - Func func1 = (FiltroPersonalizado v) => { - bool value; - string str; - PropertyInfo propertyInfo1 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo1 != null ? propertyInfo1.GetValue(x) : false); - if (!value) - { - return true; - } - PropertyInfo propertyInfo = typeof(T).GetProperty(v.get_Propriedade()); - str = (propertyInfo != null ? propertyInfo.GetValue(x).ToString() : null); - return string.IsNullOrWhiteSpace(str); - }; - func = func1; - func8 = func1; - u003cu003e9_4 = func; - } - return strs1.All(u003cu003e9_4); - } - if (p.First().get_Tipo() == typeof(DateTime)) - { - IGrouping strs2 = p; - Func u003cu003e9_5 = func9; - if (u003cu003e9_5 == null) - { - Func func2 = (FiltroPersonalizado v) => { - bool value; - PropertyInfo propertyInfo2 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo2 != null ? propertyInfo2.GetValue(x) : false); - if (!value) - { - return false; - } - return (DateTime)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x) != DateTime.Parse(v.get_ValorIncial()); - }; - func = func2; - func9 = func2; - u003cu003e9_5 = func; - } - return strs2.All(u003cu003e9_5); - } - if (p.First().get_Tipo() == typeof(long)) - { - IGrouping strs3 = p; - Func u003cu003e9_6 = func10; - if (u003cu003e9_6 == null) - { - Func func3 = (FiltroPersonalizado v) => { - bool value; - PropertyInfo propertyInfo3 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo3 != null ? propertyInfo3.GetValue(x) : false); - if (!value) - { - return false; - } - return (long)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x) != long.Parse(v.get_ValorIncial()); - }; - func = func3; - func10 = func3; - u003cu003e9_6 = func; - } - return strs3.All(u003cu003e9_6); - } - if (p.First().get_Tipo() == typeof(int)) - { - IGrouping strs4 = p; - Func u003cu003e9_7 = func11; - if (u003cu003e9_7 == null) - { - Func func4 = (FiltroPersonalizado v) => { - bool value; - PropertyInfo propertyInfo4 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo4 != null ? propertyInfo4.GetValue(x) : false); - if (!value) - { - return false; - } - return (int)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x) != int.Parse(v.get_ValorIncial()); - }; - func = func4; - func11 = func4; - u003cu003e9_7 = func; - } - return strs4.All(u003cu003e9_7); - } - if (p.First().get_Tipo() == typeof(decimal)) - { - IGrouping strs5 = p; - Func u003cu003e9_8 = func12; - if (u003cu003e9_8 == null) - { - Func func5 = (FiltroPersonalizado v) => { - bool value; - PropertyInfo propertyInfo5 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo5 != null ? propertyInfo5.GetValue(x) : false); - if (!value) - { - return false; - } - return (decimal)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x) != decimal.Parse(v.get_ValorIncial()); - }; - func = func5; - func12 = func5; - u003cu003e9_8 = func; - } - return strs5.All(u003cu003e9_8); - } - if (p.First().get_Tipo() != typeof(Enum)) - { - IGrouping strs6 = p; - Func u003cu003e9_10 = func14; - if (u003cu003e9_10 == null) - { - Func func6 = (FiltroPersonalizado v) => { - bool value; - PropertyInfo propertyInfo6 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo6 != null ? propertyInfo6.GetValue(x) : false); - if (!value) - { - return false; - } - return !ValidationHelper.AlphanumericAndSpace(typeof(T).GetProperty(v.get_Propriedade()).GetValue(x).ToString().ToLower().Trim()).Contains(ValidationHelper.AlphanumericAndSpace(v.get_ValorIncial().ToLower().Trim())); - }; - func = func6; - func14 = func6; - u003cu003e9_10 = func; - } - return strs6.All(u003cu003e9_10); - } - IGrouping strs7 = p; - Func u003cu003e9_9 = func13; - if (u003cu003e9_9 == null) - { - Func func7 = (FiltroPersonalizado v) => { - bool value; - PropertyInfo propertyInfo7 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo7 != null ? propertyInfo7.GetValue(x) : false); - if (!value) - { - return false; - } - return !ValidationHelper.GetDescription((Enum)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x)).ToLower().Contains(v.get_ValorIncial().ToLower()); - }; - func = func7; - func13 = func7; - u003cu003e9_9 = func; - } - return strs7.All(u003cu003e9_9); - }); - }).ToList(); - } - - public static List CustomWhere(this List list, string propertyName, string query) - where T : class - { - PropertyInfo property = typeof(T).GetProperty(propertyName); - return ( - from in list - where property.GetValue(x).ToString().ToLower().Contains(query.ToLower()) - select ).ToList(); - } - - public static List CustomWhere(this List list, List property, bool buscaIgual = false) - where T : class - { - if (property == null || property.Count == 0) - { - return list; - } - return list.Where((T x) => { - Func func7 = null; - Func func8 = null; - Func func9 = null; - Func func10 = null; - Func func11 = null; - Func func12 = null; - Func func13 = null; - List filtroPersonalizados = property; - Func u003cu003e9_11 = CustomLinq.u003cu003ec__1.u003cu003e9__1_1; - if (u003cu003e9_11 == null) - { - u003cu003e9_11 = (FiltroPersonalizado p) => p.get_Propriedade(); - CustomLinq.u003cu003ec__1.u003cu003e9__1_1 = u003cu003e9_11; - } - return filtroPersonalizados.GroupBy(u003cu003e9_11).ToList>().All>((IGrouping p) => { - Func func; - IGrouping strs = p; - Func u003cu003e9_13 = CustomLinq.u003cu003ec__1.u003cu003e9__1_3; - if (u003cu003e9_13 == null) - { - u003cu003e9_13 = (FiltroPersonalizado s) => s.get_SemValor(); - CustomLinq.u003cu003ec__1.u003cu003e9__1_3 = u003cu003e9_13; - } - if (strs.Any(u003cu003e9_13)) - { - IGrouping strs1 = p; - Func u003cu003e9_4 = func7; - if (u003cu003e9_4 == null) - { - Func func1 = (FiltroPersonalizado v) => { - bool value; - string str; - string str1; - PropertyInfo propertyInfo1 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo1 != null ? propertyInfo1.GetValue(x) : false); - if (value) - { - PropertyInfo propertyInfo = typeof(T).GetProperty(v.get_Propriedade()); - str = (propertyInfo != null ? propertyInfo.GetValue(x).ToString() : null); - if (!string.IsNullOrWhiteSpace(str)) - { - PropertyInfo property1 = typeof(T).GetProperty(v.get_Propriedade()); - str1 = (property1 != null ? property1.GetValue(x).ToString() : null); - return string.IsNullOrEmpty(str1); - } - } - return true; - }; - func = func1; - func7 = func1; - u003cu003e9_4 = func; - } - return strs1.Any(u003cu003e9_4); - } - if (p.First().get_Tipo() == typeof(DateTime)) - { - IGrouping strs2 = p; - Func u003cu003e9_5 = func8; - if (u003cu003e9_5 == null) - { - Func func2 = (FiltroPersonalizado v) => { - bool value; - PropertyInfo propertyInfo2 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo2 != null ? propertyInfo2.GetValue(x) : false); - if (!value || !((DateTime)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x) >= DateTime.Parse(v.get_ValorIncial()))) - { - return false; - } - DateTime dateTime = (DateTime)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x); - DateTime dateTime1 = DateTime.Parse(v.get_ValorFinal()); - dateTime1 = dateTime1.AddDays(1); - return dateTime <= dateTime1.AddSeconds(-1); - }; - func = func2; - func8 = func2; - u003cu003e9_5 = func; - } - return strs2.Any(u003cu003e9_5); - } - if (p.First().get_Tipo() == typeof(long)) - { - IGrouping strs3 = p; - Func u003cu003e9_6 = func9; - if (u003cu003e9_6 == null) - { - Func func3 = (FiltroPersonalizado v) => { - bool value; - PropertyInfo propertyInfo3 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo3 != null ? propertyInfo3.GetValue(x) : false); - if (!value || (long)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x) < long.Parse(v.get_ValorIncial())) - { - return false; - } - return (long)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x) <= long.Parse(v.get_ValorFinal()); - }; - func = func3; - func9 = func3; - u003cu003e9_6 = func; - } - return strs3.Any(u003cu003e9_6); - } - if (p.First().get_Tipo() == typeof(int)) - { - IGrouping strs4 = p; - Func u003cu003e9_7 = func10; - if (u003cu003e9_7 == null) - { - Func func4 = (FiltroPersonalizado v) => { - bool value; - PropertyInfo propertyInfo4 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo4 != null ? propertyInfo4.GetValue(x) : false); - if (!value || (int)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x) < int.Parse(v.get_ValorIncial())) - { - return false; - } - return (int)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x) <= int.Parse(v.get_ValorFinal()); - }; - func = func4; - func10 = func4; - u003cu003e9_7 = func; - } - return strs4.Any(u003cu003e9_7); - } - if (p.First().get_Tipo() == typeof(decimal)) - { - IGrouping strs5 = p; - Func u003cu003e9_8 = func11; - if (u003cu003e9_8 == null) - { - Func func5 = (FiltroPersonalizado v) => { - bool value; - PropertyInfo propertyInfo5 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo5 != null ? propertyInfo5.GetValue(x) : false); - if (!value || !((decimal)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x) >= decimal.Parse(v.get_ValorIncial()))) - { - return false; - } - return (decimal)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x) <= decimal.Parse(v.get_ValorFinal()); - }; - func = func5; - func11 = func5; - u003cu003e9_8 = func; - } - return strs5.Any(u003cu003e9_8); - } - if (p.First().get_Tipo() != typeof(Enum)) - { - IGrouping strs6 = p; - Func u003cu003e9_10 = func13; - if (u003cu003e9_10 == null) - { - Func cSu0024u003cu003e8_locals1 = (FiltroPersonalizado v) => { - bool value; - bool flag; - if (!buscaIgual) - { - PropertyInfo propertyInfo6 = typeof(T).GetProperty(v.get_Propriedade()); - flag = (propertyInfo6 != null ? propertyInfo6.GetValue(x) : false); - if (!flag) - { - return false; - } - return ValidationHelper.AlphanumericAndSpace(typeof(T).GetProperty(v.get_Propriedade()).GetValue(x).ToString().ToLower().Trim()).Contains(ValidationHelper.AlphanumericAndSpace(v.get_ValorIncial().ToLower().Trim())); - } - PropertyInfo propertyInfo = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo != null ? propertyInfo.GetValue(x) : false); - if (!value) - { - return false; - } - return ValidationHelper.AlphanumericAndSpace(typeof(T).GetProperty(v.get_Propriedade()).GetValue(x).ToString().ToLower().Trim()).Equals(ValidationHelper.AlphanumericAndSpace(v.get_ValorIncial().ToLower().Trim())); - }; - func = cSu0024u003cu003e8_locals1; - func13 = cSu0024u003cu003e8_locals1; - u003cu003e9_10 = func; - } - return strs6.Any(u003cu003e9_10); - } - IGrouping strs7 = p; - Func u003cu003e9_9 = func12; - if (u003cu003e9_9 == null) - { - Func func6 = (FiltroPersonalizado v) => { - bool value; - PropertyInfo propertyInfo7 = typeof(T).GetProperty(v.get_Propriedade()); - value = (propertyInfo7 != null ? propertyInfo7.GetValue(x) : false); - if (!value) - { - return false; - } - return ValidationHelper.GetDescription((Enum)typeof(T).GetProperty(v.get_Propriedade()).GetValue(x)).ToLower().Equals(v.get_ValorIncial().ToLower()); - }; - func = func6; - func12 = func6; - u003cu003e9_9 = func; - } - return strs7.Any(u003cu003e9_9); - }); - }).ToList(); - } - } -} \ No newline at end of file -- cgit v1.2.3