纽威
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

1 year ago
  1. using NFine.Code;
  2. using NFine.Data;
  3. using NFine.Domain.Entity.SystemManage;
  4. using NFine.Domain.IRepository.SystemManage;
  5. using NFine.Repository.SystemManage;
  6. namespace NFine.Repository.SystemManage
  7. {
  8. public class UserRepository : RepositoryBase<UserEntity>, IUserRepository
  9. {
  10. public void DeleteForm(string keyValue)
  11. {
  12. using (var db = new RepositoryBase().BeginTrans())
  13. {
  14. db.Delete<UserEntity>(t => t.F_Id == keyValue);
  15. db.Delete<UserLogOnEntity>(t => t.F_UserId == keyValue);
  16. db.Commit();
  17. }
  18. }
  19. public void SubmitForm(UserEntity userEntity, UserLogOnEntity userLogOnEntity, string keyValue)
  20. {
  21. using (var db = new RepositoryBase().BeginTrans())
  22. {
  23. if (!string.IsNullOrEmpty(keyValue))
  24. {
  25. db.Update(userEntity);
  26. //var entity = db.FindEntity<UserLogOnEntity>(userEntity.F_Id);
  27. //if (entity == null)
  28. //{
  29. // userLogOnEntity.F_Id = userEntity.F_Id;
  30. // userLogOnEntity.F_UserId = userEntity.F_Id;
  31. // userLogOnEntity.F_UserSecretkey = Md5.md5(Common.CreateNo(), 16).ToLower();
  32. // userLogOnEntity.F_UserPassword = Md5.md5(DESEncrypt.Encrypt(Md5.md5(userLogOnEntity.F_UserPassword, 32).ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower();
  33. // db.Insert(userLogOnEntity);
  34. //}
  35. }
  36. else
  37. {
  38. userLogOnEntity.F_Id = userEntity.F_Id;
  39. userLogOnEntity.F_UserId = userEntity.F_Id;
  40. userLogOnEntity.F_UserSecretkey = Md5.md5(Common.CreateNo(), 16).ToLower();
  41. userLogOnEntity.F_UserPassword = Md5.md5(DESEncrypt.Encrypt(Md5.md5(userLogOnEntity.F_UserPassword, 32).ToLower(), userLogOnEntity.F_UserSecretkey).ToLower(), 32).ToLower();
  42. db.Insert(userEntity);
  43. db.Insert(userLogOnEntity);
  44. }
  45. db.Commit();
  46. }
  47. }
  48. }
  49. }