后台数据表建立
This commit is contained in:
@@ -7395,6 +7395,13 @@
|
||||
<param name="Target"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Core.Util.EnumHelper.GetEnumDescription(System.Enum)">
|
||||
<summary>
|
||||
获取枚举注释
|
||||
</summary>
|
||||
<param name="enumValue"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Core.Util.MailHelper.#ctor(System.String,System.String)">
|
||||
<summary>
|
||||
邮箱类
|
||||
@@ -7402,6 +7409,13 @@
|
||||
<param name="message">发送的信息</param>
|
||||
<param name="userMailAddress">用户的地址</param>
|
||||
</member>
|
||||
<member name="M:Ewide.Core.Util.RandomHelper.GenerateRandomCode(System.Int32)">
|
||||
<summary>
|
||||
生成指定位数的随机码(数字)
|
||||
</summary>
|
||||
<param name="length"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Core.Util.RSAHandler.Xml2PemPublic(System.String,System.String)">
|
||||
<summary>
|
||||
XML 文件转成PEM 公钥格式
|
||||
|
||||
29
20220330_Vote/Ewide.Core/Util/EnumHelper.cs
Normal file
29
20220330_Vote/Ewide.Core/Util/EnumHelper.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.Util
|
||||
{
|
||||
public static class EnumHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取枚举注释
|
||||
/// </summary>
|
||||
/// <param name="enumValue"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetEnumDescription(this Enum enumValue)
|
||||
{
|
||||
string value = enumValue.ToString();
|
||||
FieldInfo field = enumValue.GetType().GetField(value);
|
||||
object[] objs = field.GetCustomAttributes(typeof(DescriptionAttribute), false); //获取描述属性
|
||||
if (objs == null || objs.Length == 0) //当描述属性没有时,直接返回名称
|
||||
return value;
|
||||
DescriptionAttribute descriptionAttribute = (DescriptionAttribute)objs[0];
|
||||
return descriptionAttribute.Description;
|
||||
}
|
||||
}
|
||||
}
|
||||
28
20220330_Vote/Ewide.Core/Util/RandomHelper.cs
Normal file
28
20220330_Vote/Ewide.Core/Util/RandomHelper.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.Util
|
||||
{
|
||||
public class RandomHelper
|
||||
{
|
||||
private const string BASECODE = "ABCDEFGHJKLMNPQRSTUVWXYZ0123456789";
|
||||
/// <summary>
|
||||
///生成指定位数的随机码(数字)
|
||||
/// </summary>
|
||||
/// <param name="length"></param>
|
||||
/// <returns></returns>
|
||||
public static string GenerateRandomCode(int length)
|
||||
{
|
||||
var result = new StringBuilder();
|
||||
for (var i = 0; i < length; i++)
|
||||
{
|
||||
var r = new Random(Guid.NewGuid().GetHashCode());
|
||||
result.Append(BASECODE[r.Next(BASECODE.Length)]);
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user