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.
 
 
 
 
 

51 lines
2.2 KiB

using NFine.Code;
using NFine.Data;
using NFine.Domain.Entity.SystemManage;
using NFine.Domain.IRepository.SystemManage;
using NFine.Repository.SystemManage;
namespace NFine.Repository.SystemManage
{
public class UserRepository : RepositoryBase<UserEntity>, IUserRepository
{
public void DeleteForm(string keyValue)
{
using (var db = new RepositoryBase().BeginTrans())
{
db.Delete<UserEntity>(t => t.F_Id == keyValue);
db.Delete<UserLogOnEntity>(t => t.F_UserId == keyValue);
db.Commit();
}
}
public void SubmitForm(UserEntity userEntity, UserLogOnEntity userLogOnEntity, string keyValue)
{
using (var db = new RepositoryBase().BeginTrans())
{
if (!string.IsNullOrEmpty(keyValue))
{
db.Update(userEntity);
//var entity = db.FindEntity<UserLogOnEntity>(userEntity.F_Id);
//if (entity == null)
//{
// userLogOnEntity.F_Id = userEntity.F_Id;
// userLogOnEntity.F_UserId = userEntity.F_Id;
// userLogOnEntity.F_UserSecretkey = Md5.md5(Common.CreateNo(), 16).ToLower();
// userLogOnEntity.F_UserPassword = Md5.md5(DESEncrypt.Encrypt(Md5.md5(userLogOnEntity.F_UserPassword, 32).ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower();
// db.Insert(userLogOnEntity);
//}
}
else
{
userLogOnEntity.F_Id = userEntity.F_Id;
userLogOnEntity.F_UserId = userEntity.F_Id;
userLogOnEntity.F_UserSecretkey = Md5.md5(Common.CreateNo(), 16).ToLower();
userLogOnEntity.F_UserPassword = Md5.md5(DESEncrypt.Encrypt(Md5.md5(userLogOnEntity.F_UserPassword, 32).ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower();
db.Insert(userEntity);
db.Insert(userLogOnEntity);
}
db.Commit();
}
}
}
}