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); } }
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); } }
public bool UpdateAllCheckSumWalletAccountByUserID(string pUserID) { var lstWalletAccount = new List <Wallet_Account>(); var userLogic = new WalletUserLogic(true); try { var logWallet = new LogWallet(); WalletTransactionUow WalletTransactionUnitOfWork = null; using (WalletTransactionUnitOfWork = new WalletTransactionUow(new WalletEntities())) { lstWalletAccount = WalletTransactionUnitOfWork.GetWalletAccountByUserID(pUserID); var flg = false; foreach (Wallet_Account walletAcc in lstWalletAccount) { //if (walletAcc.ChecksumAvailable2 == walletAcc.ChecksumAvailable1) //{ walletAcc.ChecksumAvailable1 = BuildCheckSumAvailable1(walletAcc); walletAcc.ChecksumAvailable2 = BuildCheckSumAvailable2(walletAcc); walletAcc.ChecksumTotal1 = BuildCheckSumTotal1(walletAcc); walletAcc.ChecksumTotal2 = BuildCheckSumTotal2(walletAcc); flg = true; //} } if (flg) { WalletTransactionUnitOfWork.DoUpdateMany(lstWalletAccount); } } return(true); } catch (Exception ex) { var logWallet = new LogWallet(); Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, "")); return(false); } }