public void Query(int userId) { //var request = new MemberRecommendLogRequest(); //request.salerId = userId; //request.PageSize = 1000; var account = AccountService.GetByUserId(userId); var query = RecommendLogService.GetList(account.accountId); if (query != null) { RecommendLogs.List = query.Select(x => new PromotionModel() { Name = x.DisplayName, value = x.grade.ToString(), tj = x.tj }).ToList(); //Page(request.PageIndex, request.PageSize, query.TotalCount, RecommendLogs); } presentExp = account.presentExp; activatePoint = account.activatePoint; grade = AccountGrade.GetName(account.grade); withdrawPoint = WithdrawService.GetUserIdPoint(account.userId); var query1 = RebateLogService.GetRebateLog(account.accountId); if (query1 != null) { PointLogs.List = query1.Select(x => new PromotionModel() { value = x.reateAmount.ToString(), submitTime = x.submitTime.ToString(), Name = string.Format("来自{0}的会员佣金", x.userId), type = "分享佣金" //x.type == RebateType.zero ? "" : x.type == RebateType.tj ? "推荐会员分享奖励" : x.type == RebateType.gw ? "推荐会员购物奖励" : "" }).ToList(); // Page(request1.PageIndex, request1.PageSize, query1.TotalCount, PointLogs); } }
public AccountService(DepositService depositService, WithdrawService withdrawService, ConsoleService consoleService, TransactionService transactionService) { _depositService = depositService; _withdrawService = withdrawService; _consoleService = consoleService; _transactionService = transactionService; }
private PersonalDetailsService GetNewService(RegulationType regulation) { var withdrawService = new WithdrawService(); var selfExclusionService = new ExternalSelfExclusionService(); switch (regulation) { case RegulationType.Regular: return(new RegularPersonalDetailsService( new MastercardDepositService(), withdrawService, selfExclusionService)); case RegulationType.Danish: return(new DanishPersonalDetailsService( new PaypalDepositService(), withdrawService, selfExclusionService)); case RegulationType.Polish: return(new PolishPersonalDetailsService( new MastercardDepositService(), new WithdrawService())); default: throw new NotImplementedException("regulation type is not implemented"); } }
public WithdrawController(WalletsRepository walletsRepository, WithdrawService withdrawService, ZCashService zecService, EtheriumService etheriumService) { _walletsRepository = walletsRepository; _withdrawService = withdrawService; _zecService = zecService; _etheriumService = etheriumService; }
public ResponseStruct <WithdrawService> GetWithdrawServices() { ResponseStruct <WithdrawService> response = new ResponseStruct <WithdrawService>(); response.data = new List <WithdrawService>(); try { DateTime now = DateTime.Now; using (MySqlConnection connection = new MySqlConnection(ConnectionString)) { connection.Open(); using (MySqlCommand com = new MySqlCommand("SELECT *,(select name from service_cat where catId=a.catId)as catName FROM withdraw_services a;", connection)) { MySqlDataReader reader = com.ExecuteReader(); if (reader.HasRows) { response.status = 1; while (reader.Read()) { WithdrawService wService = new WithdrawService(); wService.serviceID = Convert.ToInt64(reader["serviceID"]); wService.smartpayServiceID = Convert.ToInt64(reader["smartpayServiceID"]); wService.serviceName = reader["name"].ToString(); wService.serviceCatID = Convert.ToInt64(reader["catId"]); wService.serviceCatName = reader["catName"].ToString(); wService.serviceImgURL = reader["service_icon"].ToString(); response.data.Add(wService); } } else { response.status = 2; } connection.Close(); } } } catch (Exception ex) { response.status = 3; } return(response); }
public void Setup() { var options = new DbContextOptionsBuilder <BankAppDataContext>() .UseInMemoryDatabase(databaseName: "BankAppData") .Options; _context = new BankAppDataContext(options); if (_context.Accounts.FirstOrDefault(x => x.AccountId == 1) == null) { _context.Accounts.Add(new Accounts { AccountId = 1, Balance = 100 }); _context.SaveChanges(); } Mock <IAccountService> mockedAccountService = new Mock <IAccountService>(); mockedAccountService.Setup(x => x.GetAccountBalanceByID(It.IsAny <int>())).Returns(100m); _sut = new WithdrawService(_context, mockedAccountService.Object); }
public ListWithdraw Query(int pageIndex) { var user = _securityHelper.GetCurrentUser(); if (user != null) { var request = new WithdrawRequest(); request.PageIndex = pageIndex; request.UserId = user.CurrentUser.UserId; var query = WithdrawService.Query(request); if (query != null) { var listWithdraw = new ListWithdraw(); listWithdraw.List = query.ModelList.Select(x => new Withdraw() { point = x.point, orderNo = x.orderNo, state = x.state, remark = x.remark, submitTime = x.submitTime }).ToList(); Page(request.PageIndex, request.PageSize, query.TotalCount, listWithdraw); item = listWithdraw; return(listWithdraw); } } return(null); }
public ResultMessage Save(int userId) { if (point <= 0) { return new ResultMessage() { Code = -1, Msg = "提现积分必须大于0" } } ; Account = AccountService.GetByUserId(userId); if (Account == null) { return new ResultMessage() { Code = -1, Msg = "请重新登录" } } ; if (Account.activatePoint < point) { return new ResultMessage() { Code = -1, Msg = "积分余额不足" } } ; if (string.IsNullOrWhiteSpace(Account.openID)) { return new ResultMessage() { Code = -1, Msg = "你还未授权,请重新登录" } } ; TransactionHelper.BeginTransaction(); Withdraw model = new Withdraw(); model.openId = Account.openID; model.point = point; model.state = WithdrawStates.notaudit; model.submitTime = DateTime.Now; model.userId = Account.userId; model.amount = point; WithdrawService.Insert(model); OperationPointLog log = new OperationPointLog(); log.account = "activatePoint"; log.point = -point; log.remark = "提现"; log.submitTime = DateTime.Now; log.userId = Account.userId; OperationPointLogService.Insert(log); Account.activatePoint -= point; //Account.withdrawPoint += point; AccountService.Update(Account); TransactionHelper.Commit(); return(new ResultMessage() { Code = 0 }); } } }