using System;
|
|
using BWP.B3Frameworks.BL;
|
|
using Forks.EnterpriseServices.BusinessInterfaces;
|
|
using Forks.EnterpriseServices.DomainObjects2;
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery;
|
|
|
|
namespace BWP.B3DogAuth {
|
|
[BusinessInterface(typeof(DogLoginUserBL))]
|
|
public interface IDogLoginUserBL : IBaseBL<DogLoginUser> {
|
|
|
|
}
|
|
|
|
public class DogLoginUserBL : BaseBL<DogLoginUser>, IDogLoginUserBL {
|
|
|
|
protected override void beforeInsert(DogLoginUser dmo) {
|
|
if (dmo.ID == 0)
|
|
throw new Exception("黑贝序号不能为空");
|
|
|
|
if (dmo.User_ID == 0)
|
|
throw new Exception("用户名不能为空");
|
|
|
|
DQueryDom query = new DQueryDom(new JoinAlias(typeof(DogLoginUser)));
|
|
query.Where.Conditions.Add(DQCondition.Or(DQCondition.EQ("ID", dmo.ID), DQCondition.EQ("User_ID", dmo.User_ID)));
|
|
query.Columns.Add(DQSelectColumn.Field("ID"));
|
|
if (Session.ExecuteScalar(query) != null) {
|
|
throw new Exception("黑贝序号或用户已定义");
|
|
}
|
|
|
|
base.beforeInsert(dmo);
|
|
}
|
|
}
|
|
}
|