This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Globalization; | |
| using System.Text; | |
| using System.Text.RegularExpressions; | |
| namespace Extensions; | |
| public static class StringExtensions | |
| { | |
| public static string FirstCharToUpper(this string input) => | |
| input switch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Reflection; | |
| public static class ObjectExtensions | |
| { | |
| public static T ToObject<T>(this IDictionary<string, object> source) | |
| where T : class, new() | |
| { | |
| var someObject = new T(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [AttributeUsage(AttributeTargets.Property)] | |
| public class DateLimitValidationAttribute : RequiredAttribute | |
| { | |
| protected override ValidationResult IsValid(object value, ValidationContext validationContext) | |
| { | |
| base.IsValid(value, validationContext); | |
| if (value == null) return ValidationResult.Success; | |
| var date = Convert.ToDateTime(value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public sealed class DateOnlyJsonConverter : JsonConverter<DateOnly> | |
| { | |
| public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | |
| { | |
| return DateOnly.FromDateTime(reader.GetDateTime()); | |
| } | |
| public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options) | |
| { | |
| var isoDate = value.ToString("O"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class ExcelExtensions | |
| { | |
| public const string ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; | |
| /// <summary> | |
| /// Creates a <see cref="FileStreamResult"/> which constains an excel file created from a <see cref="XLWorkbook"/> | |
| /// </summary> | |
| /// <param name="workbook"></param> | |
| /// <param name="fileName"></param> | |
| /// <returns></returns> | |
| public static FileStreamResult CreateFile(this XLWorkbook workbook, string fileName) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace CpfCnpj | |
| { | |
| public static class CpfCnpjUtils | |
| { | |
| public static bool IsValid(string cpfCnpj) | |
| { | |
| return (IsCpf(cpfCnpj) || IsCnpj(cpfCnpj)); | |
| } | |
| private static bool IsCpf(string cpf) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.AspNetCore.Mvc.Rendering; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Linq.Expressions; | |
| namespace Project.Infrastructure.Util | |
| { | |
| public interface IPagedList | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Formatar CNPJ, CPF e Retirar a Formatação | |
| * | |
| * Visite nossa página http://www.codigoexpresso.com.br | |
| * | |
| * by Antonio Azevedo | |
| * | |
| * public static string FormatCNPJ(string CNPJ) | |
| * Formata uma string CNPJ | |
| * Informar uma string sem formatacao com o codigo do CNPJ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace Project.Service.Extensions | |
| { | |
| /// <summary> | |
| /// Classe de extensão de formatos. | |
| /// </summary> | |
| public static class Format | |
| { | |
| /// <summary> |
NewerOlder