示例#1
0
        private SaveResult SaveDeposit(InvestorWalletStatements oStatement)
        {
            InvestorAccounts investor = FiiiPayDB.InvestorAccountDb.GetById(oStatement.InvestorId);
            decimal          balance  = investor.Balance + oStatement.Amount;

            investor.Balance   = balance;
            oStatement.Balance = balance;

            InvestorWalletStatementBLL ab = new InvestorWalletStatementBLL();

            return(ab.Create(oStatement, investor, UserId, UserName));
        }
示例#2
0
        private SaveResult SaveWithhold(InvestorWalletStatements oStatement)
        {
            InvestorAccounts investor = FiiiPayDB.InvestorAccountDb.GetById(oStatement.InvestorId);
            decimal          balance  = investor.Balance - oStatement.Amount;

            if (balance < 0)
            {
                return(new SaveResult(false, "Amount cannot greater than balance"));
            }
            investor.Balance   = balance;
            oStatement.Balance = balance;

            InvestorWalletStatementBLL ab = new InvestorWalletStatementBLL();

            return(ab.Create(oStatement, investor, UserId, UserName));
        }
示例#3
0
        public SaveResult Create(InvestorWalletStatements statement, InvestorAccounts investor, int userId, string userName)
        {
            statement.Id = Guid.NewGuid();
            FiiiPayDB.InvestorAccountDb.Update(investor);
            int id = FiiiPayDB.InvestorWalletStatementDb.InsertReturnIdentity(statement);
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AccountBLL).FullName + ".Create";
            actionLog.Username   = userName;
            actionLog.LogContent = "Create InvestorWalletStatement " + id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);
            return(new SaveResult(true));
        }
示例#4
0
        public ActionResult SaveDeposit(int id, decimal amount, string remark, string type)
        {
            InvestorWalletStatements oStatement = new InvestorWalletStatements();

            oStatement.InvestorId = id;
            oStatement.Amount     = amount;
            oStatement.Remark     = remark;
            oStatement.Timestamp  = DateTime.UtcNow;
            if (type.Equals("Deposit"))//充币
            {
                oStatement.Action = InvestorTransactionType.Deposit;
                return(Json(SaveDeposit(oStatement).toJson()));
            }
            else//扣币
            {
                oStatement.Action = InvestorTransactionType.Withhold;
                return(Json(SaveWithhold(oStatement).toJson()));
            }
        }