public bool InsertSnapshot(string now)
        {
            var lstRewardAcc      = new List <Wallet_Account_Reward>();
            var lstWalletSnapshot = new List <Wallet_Snapshot>();
            var userLogic         = new WalletUserLogic(true);

            try
            {
                var DateSnapshot = new WalletSnapshotQueryBuilder(new WalletEntities()).GetLatestDateSnapshot().FirstOrDefault().CreateDateSnapshot;
                if (DateSnapshot.Year == int.Parse(now.Split('-')[0]) && DateSnapshot.Month == int.Parse(now.Split('-')[1]) && DateSnapshot.Day == int.Parse(now.Split('-')[2]))
                {
                    return(true);
                }
                WalletTransactionUow WalletTransactionUnitOfWork = null;
                using (WalletTransactionUnitOfWork = new WalletTransactionUow(new WalletEntities()))
                {
                    WalletTransactionUnitOfWork.BeginTransaction();
                    var lstWalletAccount = WalletTransactionUnitOfWork.GetAllWalletAccount().OrderBy(wa => wa.ID);
                    lstRewardAcc = WalletTransactionUnitOfWork.GetAllRewardAccount();
                    string S1 = "";
                    foreach (Wallet_Account walletAcc in lstWalletAccount)
                    {
                        var walletSnapShot = new Wallet_Snapshot();
                        walletSnapShot.ID         = Guid.NewGuid().ToString();
                        walletSnapShot.Account_ID = walletAcc.ID;
                        walletSnapShot.Balance    = walletAcc.Available_Balance;
                        if (lstRewardAcc != null)
                        {
                            var rewardACC = lstRewardAcc.Find(p => p.ID == walletAcc.ID);
                            if (rewardACC != null)
                            {
                                walletSnapShot.Reward_Amount = rewardACC.Reward_Amount;
                            }
                            else
                            {
                                walletSnapShot.Reward_Amount = 0;
                            }
                        }
                        else
                        {
                            walletSnapShot.Reward_Amount = 0;
                        }
                        walletSnapShot.CreateDate         = walletAcc.CreateDate;
                        walletSnapShot.UpdateDate         = walletAcc.UpdateDate;
                        walletSnapShot.CreateDateSnapshot = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour,
                                                                         DateTime.Now.Minute, DateTime.Now.Second);
                        walletSnapShot.Currency_Code = walletAcc.Currency_Code;
                        walletSnapShot.Checksum      = BuildCheckSum(walletSnapShot);
                        lstWalletSnapshot.Add(walletSnapShot);
                        S1 += walletSnapShot.ID + walletSnapShot.Account_ID + ConvertUtility.RoundToTwoDecimalPlaces(walletSnapShot.Balance) + ConvertUtility.RoundToTwoDecimalPlaces(walletSnapShot.Reward_Amount) + walletSnapShot.CreateDate.ToString("yyyy-MM-dd HH:mm:ss") + walletSnapShot.Currency_Code + walletSnapShot.Checksum;
                    }
                    var S1Hash = SecurityLogic.GetSha1Hash(S1);
                    foreach (Wallet_Snapshot Wallet_Snapshot in lstWalletSnapshot)
                    {
                        Wallet_Snapshot.Snapshot = S1Hash;
                    }

                    WalletTransactionUnitOfWork.DoInsertMany(lstWalletSnapshot).EndTransaction();
                }
                return(true);
            }
            catch (Exception ex)
            {
                var logWallet = new LogWallet();
                Task.Factory.StartNew(() => logWallet.Log(MethodBase.GetCurrentMethod(), "", ex, ""));
                return(false);
            }
        }
        public string BuildCheckSum(Wallet_Snapshot pSnapshot)
        {
            string CheckSum = SecurityLogic.GetSha1Hash(pSnapshot.ID + "|" + pSnapshot.Account_ID + "|" + ConvertUtility.RoundToTwoDecimalPlaces(pSnapshot.Balance) + "|" + ConvertUtility.RoundToTwoDecimalPlaces(pSnapshot.Reward_Amount ?? 0) + "|" + pSnapshot.CreateDate.ToString("yyyy-MM-dd HH:mm:ss") + "|" + pSnapshot.Currency_Code + "|" + Globals.StampServerKey);

            return(CheckSum);
        }