public decimal UpdateRewardByAccIDForPaymentWithoutTownbus(WalletTransactionUow eWalletTransactionUnitOfWork, Wallet_Account_Reward RewardAcc, decimal CalReward, string remarks) { decimal realReward = 0; try { if (CalReward >= RewardAcc.Reward_Amount) { realReward = RewardAcc.Reward_Amount; RewardAcc.Reward_Amount = 0; } else if (CalReward < RewardAcc.Reward_Amount) { realReward = CalReward; RewardAcc.Reward_Amount = RewardAcc.Reward_Amount - CalReward; } RewardAcc.Updatedate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); RewardAcc.CheckSumReward = BuildCheckSum_Reward(RewardAcc); RewardAcc.Remark = remarks; eWalletTransactionUnitOfWork.DoUpdate(RewardAcc).SaveAndContinue(); return(realReward); } catch (Exception ex) { var logWallet = new LogWallet(); logWallet.Log(MethodBase.GetCurrentMethod(), RewardAcc.ID, ex, ""); return(-1); } }
public bool UpdateVerificationStatus(UserBankAccountRequest request) { if (SimpleAesUtil.DecryptAES(request.AccountNumber, EwalletConstant.keyAES).IndexOf(EwalletConstant.strWord) == -1) { return(false); } WalletTransactionUow WalletTransactionUnitOfWork = new WalletTransactionUow(new WalletEntities()); try { WalletTransactionUnitOfWork.BeginTransaction(); var UserBankAcc = WalletTransactionUnitOfWork.GetBankAccByID(request.ID); UserBankAcc.Comments = request.Comments; UserBankAcc.Verify = request.Verify; UserBankAcc.Update_date = DateTime.Now; WalletTransactionUnitOfWork.DoUpdate(UserBankAcc).SaveAndContinue(); WalletTransactionUnitOfWork.EndTransaction(); return(true); } catch (Exception ex) { var logWallet = new LogWallet(); Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, "")); return(false); } }
public bool UpdateRewardByAccIDForTopup(WalletTransactionUow eWalletTransactionUnitOfWork, string AccID, decimal rewardamount, string remarks) { var logWallet = new LogWallet(); try { var RewardAcc = eWalletTransactionUnitOfWork.GetRewardByAccID(AccID); if (RewardAcc == null) { logWallet.Log(MethodBase.GetCurrentMethod(), "Could not find Reward Account by AccID: " + AccID, null, ""); return(false); } RewardAcc.Reward_Amount = RewardAcc.Reward_Amount + rewardamount; RewardAcc.Updatedate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); RewardAcc.CheckSumReward = BuildCheckSum_Reward(RewardAcc); RewardAcc.Remark = remarks; eWalletTransactionUnitOfWork.DoUpdate(RewardAcc).SaveAndContinue(); return(true); } catch (Exception ex) { logWallet.Log(MethodBase.GetCurrentMethod(), AccID, ex, ""); return(false); } }