You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.8 KiB
58 lines
1.8 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace SSWMS.Common
|
|
{
|
|
public class StringUtils
|
|
{
|
|
public static string GetCurrentTime()
|
|
{
|
|
return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
}
|
|
|
|
public static string GetExpireDay(int iDays)
|
|
{
|
|
return DateTime.Now.AddDays(0 - iDays).ToString("yyyy-MM-dd HH:mm:ss");
|
|
}
|
|
|
|
public static string GetCurrentDay()
|
|
{
|
|
return DateTime.Now.ToString("yyyy-MM-dd");
|
|
}
|
|
|
|
public static string GetNextDay()
|
|
{
|
|
return DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
|
|
}
|
|
|
|
public static bool StockBarcodeValidate(string sStockBarcode)
|
|
{
|
|
//return Regex.IsMatch(sStockBarcode, @"^[T|H][0-9]{5}$");
|
|
return Regex.IsMatch(sStockBarcode, @"^[0-9|A-Z|a-z]{20}$");
|
|
}
|
|
|
|
public static bool StockBarcodeValidateStock(string sStockBarcode)
|
|
{
|
|
return Regex.IsMatch(sStockBarcode, @"^T[0-9]{5}$");
|
|
}
|
|
|
|
public static bool StockBarcodeValidateCage(string sStockBarcode)
|
|
{
|
|
//return Regex.IsMatch(sStockBarcode, @"^H[0-9]{5}$");
|
|
return false;
|
|
}
|
|
|
|
public static string GetParenthesesValue(string str)
|
|
{
|
|
return Regex.Match(str, @"\((.+)\)").Groups[1].Value;
|
|
}
|
|
|
|
private static Dictionary<string, string> DicCHSString = new Dictionary<string, string>() { };
|
|
private static Dictionary<string, string> DicENString = new Dictionary<string, string>() { };
|
|
public static string GetLangString(string sKey, string sLang = "Default")
|
|
{
|
|
return (sLang == "en-US" ? DicENString : DicCHSString)[sKey];
|
|
}
|
|
}
|
|
}
|