Commit inicial: ITCA_API_SAP_WMS (.NET Core 3.1)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
2b82744eb8
168 files changed
+11066
No files matched your search
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
|
||||
namespace Net.CrossCotting
|
||||
{
|
||||
public class Utils
|
||||
{
|
||||
public static DateTime DateTimeEmpty()
|
||||
{
|
||||
return new DateTime(1, 1, 1, 0, 0, 0);
|
||||
}
|
||||
|
||||
public static DateTime GetFechaHoraInicioActual(DateTime? fecha)
|
||||
{
|
||||
DateTime? data;
|
||||
|
||||
data = fecha;
|
||||
|
||||
if (fecha == null || fecha.Equals(DateTimeEmpty()))
|
||||
{
|
||||
data = new DateTime(DateTime.Now.Year, 1, DateTime.Now.Day, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = new DateTime(((DateTime)fecha).Year, ((DateTime)fecha).Month, ((DateTime)fecha).Day, 0, 0, 0);
|
||||
}
|
||||
|
||||
return (DateTime)data;
|
||||
}
|
||||
|
||||
public static DateTime GetFechaHoraFinActual(DateTime? fecha)
|
||||
{
|
||||
DateTime? data;
|
||||
|
||||
data = fecha;
|
||||
|
||||
if (fecha == null || fecha.Equals(DateTimeEmpty()))
|
||||
{
|
||||
data = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
|
||||
}
|
||||
else
|
||||
{
|
||||
data = new DateTime(((DateTime)fecha).Year, ((DateTime)fecha).Month, ((DateTime)fecha).Day, 23, 59, 59);
|
||||
}
|
||||
|
||||
return (DateTime)data;
|
||||
}
|
||||
|
||||
public static string GenerarCodigoAleatorio()
|
||||
{
|
||||
Random obj = new Random();
|
||||
string sCadena = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||
int longitud = sCadena.Length;
|
||||
char cletra;
|
||||
int nlongitud = 30;
|
||||
string sNuevacadena = string.Empty;
|
||||
|
||||
for (int i = 0; i < nlongitud; i++)
|
||||
{
|
||||
cletra = sCadena[obj.Next(nlongitud)];
|
||||
sNuevacadena += cletra.ToString();
|
||||
}
|
||||
return sNuevacadena;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user