This commit is contained in:
ky_sunl
2021-04-01 06:47:58 +00:00
parent 687b79910e
commit cb7e07922f
41 changed files with 881 additions and 88 deletions

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.Core.Service
{
public class BaseService
{
/// <summary>
/// 设置和读取异常信息。
/// </summary>
protected string _ErrorMessage = String.Empty;
/// <summary>
/// 读取异常信息。
/// </summary>
public string ErrorMessage
{
get
{
return _ErrorMessage;
}
}
}
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DapperExtensions;
using Ewide.Core.Model;
using Ewide.Core.Common;
namespace Ewide.Core.Service
{
public class GateService : BaseService
{
public void Login(string account, string password)
{
}
public string CreateAccount(string account, string password, string name)
{
using (var db = new Data.DapperTransactionHelper())
{
var user = new EC_User
{
ID = Guid.NewGuid().ToString(),
Account = account,
Password = AuthorizedHelper.GetPasswordMD5(password),
Name = name,
Type = 1,
Sex = 1,
Enabled = true,
CreateTime = DateTime.Now
};
db.Conn.Insert(user);
try
{
db.Complete();
return user.ID;
}
catch (Exception ex)
{
_ErrorMessage = ex.Message;
db.RollBack();
return null;
}
}
}
}
}

View File

@@ -42,6 +42,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Base\BaseService.cs" />
<Compile Include="Base\GateService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>