示例#1
0
        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);
            }
        }
        /// <summary>
        /// Called when [authorization asynchronous].
        /// </summary>
        /// <param name="actionContext">The action context.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns></returns>
        public override Task OnAuthorizationAsync(HttpActionContext actionContext, System.Threading.CancellationToken cancellationToken)
        {
            //var queryString = actionContext.Request.GetQueryNameValuePairs().ToDictionary(x => x.Key, x => x.Value);
            //var agent_id = queryString["agent_id"];
            //var sign = queryString["sign"];
            var principal = actionContext.RequestContext.Principal as ClaimsPrincipal;
            var logWallet = new LogWallet();

            if (principal != null && !principal.Identity.IsAuthenticated)
            {
                //logWallet.Log(MethodBase.GetCurrentMethod(), principal.Identity.IsAuthenticated.ToString(), null, "1");
                actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized);
                return(Task.FromResult <object>(null));
            }
            if (principal != null && (!principal.HasClaim(x => x.Type == "environment") || principal.HasClaim(x => x.Type == "environment" && x.Value != ("staging"))))
            {
                //logWallet.Log(MethodBase.GetCurrentMethod(),"", null, "2");
                actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized);
                return(Task.FromResult <object>(null));
            }

            if (principal != null && !(principal.HasClaim(x => x.Type == ClaimType && ClaimValue.Split(',').Intersect(x.Value.Split(',')).Any())))
            {
                //logWallet.Log(MethodBase.GetCurrentMethod(), "", null, "3");
                actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized);
                return(Task.FromResult <object>(null));
            }

            //User is Authorized, complete execution
            return(Task.FromResult <object>(null));
        }
        public string GenerateNewTransaction_Interest_Snapshot(WalletEntities newWalletEntities, string Tran_ID, decimal Interest_Amount, string AccID, decimal totalamount, string remarks)
        {
            try
            {
                var Tran_interest = new Transaction_Interest_Snapshot();
                Tran_interest.ID              = Guid.NewGuid().ToString();
                Tran_interest.Account_ID      = AccID;
                Tran_interest.Tran_ID         = Tran_ID;
                Tran_interest.Interest_Amount = ConvertUtility.RoundToTwoDecimalPlaces(Interest_Amount);
                Tran_interest.Total_Amount    = ConvertUtility.RoundToTwoDecimalPlaces(totalamount);
                Tran_interest.Createdate      = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour,
                                                             DateTime.Now.Minute, DateTime.Now.Second);
                Tran_interest.Remark           = remarks;
                Tran_interest.CheckSumInterest = BuildCheckSum_SnapshotInterest(Tran_interest);
                using (var eWalletTransactionUnitOfWork = new WalletTransactionUow(newWalletEntities))
                {
                    eWalletTransactionUnitOfWork.BeginTransaction().DoInsert(Tran_interest).EndTransaction();
                }

                return(Tran_interest.ID);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                logWallet.Log(MethodBase.GetCurrentMethod(), Tran_ID, ex, "");
                return("");
            }
        }
示例#4
0
        public string BuildCheckSumAvailable2(Wallet_Account CurrenctWalletAcc)
        {
            try
            {
                if (Globals.StampServerKey != "Invalid Key")
                {
                    //var logWallet = new LogWallet();
                    //logWallet.Log(MethodBase.GetCurrentMethod(), CurrenctWalletAcc.ID + "|" + CurrenctWalletAcc.Wallet_ID + "|" + CurrenctWalletAcc.Currency_Code + "|" + CurrenctWalletAcc.User_ID + "|" + (string.IsNullOrEmpty(CurrenctWalletAcc.CreateUser) ? "" : CurrenctWalletAcc.CreateUser.Trim()) + "|" + CurrenctWalletAcc.CreateDate + "|" + CurrenctWalletAcc.UpdateDate + "|" + (string.IsNullOrEmpty(CurrenctWalletAcc.UpdateUser) ? "" : CurrenctWalletAcc.UpdateUser.Trim()) + "|" + ConvertUtility.RoundToTwoDecimalPlaces(CurrenctWalletAcc.Available_Balance) + "|" + Globals.StampServerKey, null, "BuildCheckSumAvailable2");
                    if (string.IsNullOrEmpty(Globals.StampServerKey))
                    {
                        localhost.EWallet_StampService stampService = new localhost.EWallet_StampService();
                        var EncryptTokenEBW = SimpleAesUtil.Encrypt(EwalletConstant.TokenEBW);
                        Globals.StampServerKey = stampService.Generate_Stamp_Key(EncryptTokenEBW);
                    }

                    return(SecurityLogic.GetSha1Hash(CurrenctWalletAcc.ID + "|" + CurrenctWalletAcc.Wallet_ID + "|" + CurrenctWalletAcc.Currency_Code + "|" + CurrenctWalletAcc.User_ID + "|" + (string.IsNullOrEmpty(CurrenctWalletAcc.CreateUser) ? "" : CurrenctWalletAcc.CreateUser.Trim()) + "|" + CurrenctWalletAcc.CreateDate.ToString("yyyy-MM-dd HH:mm:ss") + "|" + CurrenctWalletAcc.UpdateDate.ToString("yyyy-MM-dd HH:mm:ss") + "|" + (string.IsNullOrEmpty(CurrenctWalletAcc.UpdateUser) ? "" : CurrenctWalletAcc.UpdateUser.Trim()) + "|" + ConvertUtility.RoundToTwoDecimalPlaces(CurrenctWalletAcc.Available_Balance) + "|" + Globals.StampServerKey));
                }
                else
                {
                    //var logWallet = new LogWallet();
                    //logWallet.Log(MethodBase.GetCurrentMethod(), CurrenctWalletAcc.ID + "|" + CurrenctWalletAcc.Wallet_ID + "|" + CurrenctWalletAcc.Currency_Code + "|" + CurrenctWalletAcc.User_ID + "|" + (string.IsNullOrEmpty(CurrenctWalletAcc.CreateUser) ? "" : CurrenctWalletAcc.CreateUser.Trim()) + "|" + CurrenctWalletAcc.CreateDate + "|" + CurrenctWalletAcc.UpdateDate + "|" + (string.IsNullOrEmpty(CurrenctWalletAcc.UpdateUser) ? "" : CurrenctWalletAcc.UpdateUser.Trim()) + "|" + ConvertUtility.RoundToTwoDecimalPlaces(CurrenctWalletAcc.Available_Balance) + "|" + Globals.StampServerKey, null, "BuildCheckSumAvailable2");

                    return("");
                }
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), CurrenctWalletAcc.Wallet_ID, ex, ""));
                return("");
            }
        }
示例#5
0
 public bool CheckConditionRewardByDatenUserID(DateTime pStartDate, string pUserID)
 {
     try
     {
         var countReward        = 0;
         var transactionOptions = new System.Transactions.TransactionOptions();
         transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
         using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
         {
             countReward = new TransactionQueryBuilder(new WalletEntities()).CountRewardTransactionByDatenUserID(pStartDate, pUserID);
         }
         if (countReward > EwalletConstant.LimitTopupExtraPerUser)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         var logWallet = new LogWallet();
         logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, "");
         return(false);
     }
 }
示例#6
0
        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);
            }
        }
示例#7
0
        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);
            }
        }
示例#8
0
        public TokenTownBusResponse GetAccessTokenTownBus(TokenRequestTownBus requestParams)
        {
            TokenTownBusResponse tokenTownBus = new TokenTownBusResponse();
            var  townBusEntity = new TownBusEntities();
            bool isExistToken  = false;
            WalletTransactionUow WalletTransactionUnitOfWork = null;

            try
            {
                var strCredencial = SimpleAesUtil.DecryptAES(requestParams.Credential, EwalletConstant.keyAES).Split(';');
                var isExists      = new WalletUserTownbusQueryBuilder(new TownBusEntities()).GetUserByLoginIdnPassword(strCredencial.First(), strCredencial.Last()).FirstOrDefault();
                if (isExists != null)
                {
                    var branch = new WalletBranchTownBusQueryBuilder(new TownBusEntities()).HasBranchId(isExists.Branch_ID).FirstOrDefault();
                    if (branch != null)
                    {
                        tokenTownBus.CompanyID = branch.Company_ID;
                    }
                    tokenTownBus.AccessToken = SimpleAesUtil.EncryptAES(isExists.User_ID + isExists.Password + DateTime.Now.ToString("yyyy-MM-dd hh:00:00"), EwalletConstant.keyAES);
                    tokenTownBus.UserID      = isExists.User_ID;
                    //save notificateToken to config
                    if (string.IsNullOrWhiteSpace(requestParams.NotificationToken))
                    {
                        isExistToken = new TownBusNotificationQueryBuilder(townBusEntity).HasNotificationUniqueId(requestParams.CarPlate, tokenTownBus.CompanyID, requestParams.NotificationUniqueId.Trim());
                    }
                    else
                    {
                        isExistToken = new TownBusNotificationQueryBuilder(townBusEntity).HasNotifcationToken(requestParams.CarPlate, tokenTownBus.CompanyID, requestParams.NotificationToken.Trim());
                    }

                    if (!isExistToken)
                    {
                        // var busType = new TownBusTypeQueryBuilder(townBusEntity).GetBusIdByCompanyIdnBusNo(tokenTownBus.CompanyID, requestParams.CarPlate).FirstOrDefault();
                        using (WalletTransactionUnitOfWork = new WalletTransactionUow(townBusEntity))
                        {
                            TownBusNotification townBusNotification = new TownBusNotification();
                            townBusNotification.CarPlate  = requestParams.CarPlate;
                            townBusNotification.CompanyID = tokenTownBus.CompanyID;
                            //townBusNotification.BusID = busType.Bus_ID;
                            townBusNotification.NotificationToken    = requestParams.NotificationToken.Trim();
                            townBusNotification.NotificationUniqueId = requestParams.NotificationUniqueId.Trim();
                            WalletTransactionUnitOfWork.BeginTransaction(System.Data.IsolationLevel.RepeatableRead)
                            .DoInsert(townBusNotification)
                            .EndTransaction();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                logWallet.Log(MethodBase.GetCurrentMethod(), requestParams.Credential, ex, "");
                return(tokenTownBus);
            }
            return(tokenTownBus);
        }
示例#9
0
        public List <User_Bank_Account> LoadAllUserBankAccount()
        {
            List <string> messages    = new List <string>();
            var           userBankLst = new List <User_Bank_Account>();

            try
            {
                userBankLst = new UserBankAccountQueryBuilder(new WalletEntities()).GetAllUserBankAccount().ToList();
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
            }
            return(userBankLst);
        }
示例#10
0
        public User_Bank_Account UserBankAccountByID(string id)
        {
            List <string> messages = new List <string>();
            var           userBank = new User_Bank_Account();

            try
            {
                userBank = new UserBankAccountQueryBuilder(new WalletEntities()).UserBankAccount_ByID(id).FirstOrDefault();
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
            }
            return(userBank);
        }
示例#11
0
        public TownBusCoordinate GetTownBusCoordinateByCoordinateID(int coordinateID)
        {
            var townBusCoordinate = new TownBusCoordinate();

            try
            {
                townBusCoordinate = new WalletTownBusCoordinateQueryBuilder(new TownBusEntities()).GetTownBusCoordinateByCoordinateID(coordinateID).FirstOrDefault();
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                logWallet.Log(MethodBase.GetCurrentMethod(), townBusCoordinate.TownBus_Coordinate_ID, ex, "");
                return(null);
            }
            return(townBusCoordinate);
        }
 public bool InsertTransactionRewards(Wallet_Account_Reward record)
 {
     try
     {
         using (var eWalletTransactionUnitOfWork = new WalletTransactionUow(new WalletEntities()))
         {
             eWalletTransactionUnitOfWork.BeginTransaction().DoInsert(record).EndTransaction();
             return(true);
         }
     }
     catch (Exception ex)
     {
         var logWallet = new LogWallet();
         logWallet.Log(MethodBase.GetCurrentMethod(), record.ID, ex, "");
         return(false);
     }
 }
 public bool InsertUserCard(User_Card record)
 {
     try
     {
         using (var eWalletTransactionUnitOfWork = new WalletTransactionUow(new WalletEntities()))
         {
             eWalletTransactionUnitOfWork.BeginTransaction().DoInsert(record).EndTransaction();
         }
         return(true);
     }
     catch (Exception ex)
     {
         var logWallet = new LogWallet();
         Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), record.User_ID, ex, ""));
         return(false);
     }
 }
 public string InsertUserRecord(User record)
 {
     try
     {
         using (var eWalletTransactionUnitOfWork = new WalletTransactionUow(new WalletEntities()))
         {
             record.User_ID = SecurityLogic.GenerateKey(30);
             eWalletTransactionUnitOfWork.BeginTransaction().DoInsert(record).EndTransaction();
         }
         return(record.User_ID);
     }
     catch (Exception ex)
     {
         var logWallet = new LogWallet();
         Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), record.User_ID, ex, ""));
         return("");
     }
 }
示例#15
0
 public TownBusTrip GetMaxChargeByTripID(TownBusEntities newWalletEntities, int TripID)
 {
     try
     {
         var transactionOptions = new System.Transactions.TransactionOptions();
         transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
         using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
         {
             return(new WalletTownbusQueryBuilder(newWalletEntities).GetTownbusInfoByTripID(TripID).FirstOrDefault());
         }
     }
     catch (Exception ex)
     {
         var logWallet = new LogWallet();
         logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, "");
         return(null);
     }
 }
示例#16
0
        public List <Wallet_Account_Reward> GetRewardsByAccIds(List <string> Ids)
        {
            var logWallet = new LogWallet();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    return(new WalletRewardQueryBuilder(new WalletEntities()).GotBalance().HaveIds(Ids).ToList());
                }
            }
            catch (Exception ex)
            {
                logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, "Error in GetRewardsByAccIds of TallyWithdrawBalance");
                return(null);
            }
        }
示例#17
0
        public Wallet_Account_Reward GetRewardByAccID(string pAccID)
        {
            var logWallet = new LogWallet();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    return(new WalletRewardQueryBuilder(new WalletEntities()).GetRewardByAccID(pAccID).FirstOrDefault());
                }
            }
            catch (Exception ex)
            {
                logWallet.Log(MethodBase.GetCurrentMethod(), pAccID, ex, "");
                return(null);
            }
        }
示例#18
0
        public List <Transaction> GetTransactionLstTownBusByCarIDnDateTime(TripsRequestTownBus request)
        {
            var transactionlst = new List <Transaction>();

            try
            {
                transactionlst = new TransactionQueryBuilder(new WalletEntities())
                                 .GetTransBySource("TownBus")
                                 .FromDate(DateTime.Parse(request.StartDateTimeRange.Replace("T", " ")))
                                 .ToDate(DateTime.Parse(request.EndDateTimeRange.Replace("T", " "))).ToList();
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                logWallet.Log(MethodBase.GetCurrentMethod(), request.CarId, ex, "");
                return(null);
            }
            return(transactionlst);
        }
示例#19
0
 public bool DeleteUserBankAcc(string IDBankAcc)
 {
     try
     {
         using (var eWalletTransactionUnitOfWork = new WalletTransactionUow(new WalletEntities()))
         {
             eWalletTransactionUnitOfWork.BeginTransaction();
             var UserBankAcc = new UserBankAccountQueryBuilder(new WalletEntities()).HasID(IDBankAcc).FirstOrDefault();
             eWalletTransactionUnitOfWork.DoDelete(UserBankAcc);
             eWalletTransactionUnitOfWork.EndTransaction();
         }
         return(true);
     }
     catch (Exception ex)
     {
         var logWallet = new LogWallet();
         Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), IDBankAcc, ex, ""));
         return(false);
     }
 }
        public bool UpdateCheckSumSnapshot(string pChecksum)
        {
            var lstSnapshots = new List <Wallet_Snapshot>();
            var userLogic    = new WalletUserLogic(true);

            try
            {
                var logWallet = new LogWallet();
                WalletTransactionUow WalletTransactionUnitOfWork = null;
                using (WalletTransactionUnitOfWork = new WalletTransactionUow(new WalletEntities()))
                {
                    lstSnapshots = WalletTransactionUnitOfWork.GetSnapshotByCheckSum(pChecksum);
                    logWallet.Log(MethodBase.GetCurrentMethod(), "Log here 1: " + pChecksum + "|" + lstSnapshots.Count, null, "");
                    var S1 = "";
                    foreach (Wallet_Snapshot walletSnapShot in lstSnapshots)
                    {
                        walletSnapShot.Checksum = BuildCheckSum(walletSnapShot);
                        S1 += (walletSnapShot.ID + walletSnapShot.Account_ID + ConvertUtility.RoundToTwoDecimalPlaces(walletSnapShot.Balance) + walletSnapShot.CreateDate.ToString("yyyy-MM-dd HH:mm:ss") + walletSnapShot.Currency_Code + walletSnapShot.Checksum);
                    }
                    logWallet.Log(MethodBase.GetCurrentMethod(), "Log here 2", null, "");
                    var S1Hash = SecurityLogic.GetSha1Hash(S1);
                    logWallet.Log(MethodBase.GetCurrentMethod(), "Log here 3" + S1Hash, null, "");
                    foreach (Wallet_Snapshot Wallet_Snapshot in lstSnapshots)
                    {
                        Wallet_Snapshot.Snapshot = S1Hash;
                    }

                    WalletTransactionUnitOfWork.DoUpdateMany(lstSnapshots).EndTransaction();

                    logWallet.Log(MethodBase.GetCurrentMethod(), "Finish Update UpdateCheckSumSnapshot", null, "");
                }

                return(true);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
                return(false);
            }
        }
示例#21
0
        public bool UpdateAllCheckSumWalletAccountWithEmptyCS(string FromDate, string ToDate)
        {
            var lstWalletAccount = new List <Wallet_Account>();
            var userLogic        = new WalletUserLogic(true);
            var logWallet        = new LogWallet();

            try
            {
                WalletTransactionUow WalletTransactionUnitOfWork = null;
                using (WalletTransactionUnitOfWork = new WalletTransactionUow(new WalletEntities()))
                {
                    var startDate = new DateTime(int.Parse(FromDate.Split('-')[0]), int.Parse(FromDate.Split('-')[1]), int.Parse(FromDate.Split('-')[2]));
                    var toDate    = new DateTime(int.Parse(ToDate.Split('-')[0]), int.Parse(ToDate.Split('-')[1]), int.Parse(ToDate.Split('-')[2]));
                    var diffDate  = toDate.Subtract(startDate).TotalDays;
                    logWallet.Log(MethodBase.GetCurrentMethod(), "Start UpdateAllCheckSumWalletAccountWithEmptyCS", null, "");

                    for (int i = 0; i <= diffDate; i++)
                    {
                        var date = startDate.AddDays(i);
                        lstWalletAccount = WalletTransactionUnitOfWork.GetAllWalletAccountByDateWithoutCS(date);

                        foreach (Wallet_Account walletAcc in lstWalletAccount)
                        {
                            walletAcc.ChecksumAvailable1 = BuildCheckSumAvailable1(walletAcc);
                            walletAcc.ChecksumAvailable2 = BuildCheckSumAvailable2(walletAcc);
                            walletAcc.ChecksumTotal1     = BuildCheckSumTotal1(walletAcc);
                            walletAcc.ChecksumTotal2     = BuildCheckSumTotal2(walletAcc);
                        }
                        WalletTransactionUnitOfWork.DoUpdateMany(lstWalletAccount);
                        logWallet.Log(MethodBase.GetCurrentMethod(), date, null, date.ToString("yyyy-MM-dd") + ": " + lstWalletAccount.Count);
                    }
                    logWallet.Log(MethodBase.GetCurrentMethod(), "End UpdateAllCheckSumWalletAccountWithEmptyCS", null, "");
                }
                return(true);
            }
            catch (Exception ex)
            {
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
                return(false);
            }
        }
示例#22
0
        public Wallet_Account GetWalletAccByUserIDnCurrencyCode(string UserID, string CurrencyCode)
        {
            var WalletAcc = new Wallet_Account();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    WalletAcc = new WalletAccountQueryBuilder(new WalletEntities()).GetAccIdByUserIDnCurrencyCode(UserID, CurrencyCode).FirstOrDefault();
                }
                return(WalletAcc);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), UserID + "|" + CurrencyCode, ex, ""));
                return(WalletAcc);
            }
        }
示例#23
0
        /// <summary>
        /// Get AspNetUser by aspNetUserId
        /// </summary>
        /// <param name="aspNetUserId"></param>
        /// <returns></returns>
        public List <User_Bank_Account> GetBankAccwithoutPending()
        {
            var user_bank = new List <User_Bank_Account>();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    user_bank = new UserBankAccountQueryBuilder(new WalletEntities()).GetBankAccwithoutPending().ToList();
                }
                return(user_bank);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
                return(user_bank);
            }
        }
示例#24
0
        public Wallet_Rule GetWalletRuleByAccID(string pAccID)
        {
            var WalletRule = new Wallet_Rule();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    WalletRule = new WalletRuleQueryBuilder(new WalletEntities()).GetWalletByID(pAccID).FirstOrDefault();
                }
                return(WalletRule);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), pAccID, ex, ""));
                return(WalletRule);
            }
        }
示例#25
0
        public Transaction GetWalletTranByTranID(string TranID)
        {
            var Tran = new Transaction();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    Tran = new TransactionQueryBuilder(new WalletEntities()).GetTranByTranID(TranID).FirstOrDefault();
                }
                return(Tran);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), TranID, ex, ""));
                return(Tran);
            }
        }
示例#26
0
        public List <User_Bank_Account> LoadVerificationStatus(string userID, string currency)
        {
            List <string> messages = new List <string>();
            var           userBank = new List <User_Bank_Account>();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    userBank = new UserBankAccountQueryBuilder(new WalletEntities()).GetInfoUserBankAccount(userID, currency).ToList();
                }
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
            }
            return(userBank);
        }
示例#27
0
        public List <Transaction> GetTranTownBusnWithdrawByUserIDNoVerify(string pUserID, string pCurrencyCode)
        {
            var Tran = new List <Transaction>();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    Tran = new TransactionQueryBuilder(new WalletEntities()).GetTranTownBusnWithdrawByUserIDNoVerify(pUserID, pCurrencyCode).ToList();
                }
                return(Tran);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
                return(Tran);
            }
        }
示例#28
0
        public List <Transaction> GetTransTopupWithoutVerified()
        {
            var Tran = new List <Transaction>();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    Tran = new TransactionQueryBuilder(new WalletEntities()).GetTransTopup().ToList();
                }
                return(Tran);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
                return(Tran);
            }
        }
示例#29
0
        public bool IsExistUserID(string pUserID)
        {
            bool result = false;

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    result = new WalletUserQueryBuilder(new WalletEntities()).HasUserId(pUserID);
                }
                return(result);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), pUserID, ex, ""));
                return(result);
            }
        }
示例#30
0
        public List <Wallet_Account> GetWalletAccsByWalletIdCurrencies(List <string> walletCurrencies)
        {
            var WalletAccs = new List <Wallet_Account>();

            try
            {
                var transactionOptions = new System.Transactions.TransactionOptions();
                transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
                using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
                {
                    WalletAccs = new WalletAccountQueryBuilder(new WalletEntities()).HasWalletCurrencies(walletCurrencies).ToList();
                }
                return(WalletAccs);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), walletCurrencies.Aggregate((a, b) => $"{a},{b}"), ex, ""));
                return(WalletAccs);
            }
        }