Esempio n. 1
0
        /// <summary>
        ///  true 未过期,false 过期
        /// </summary>
        public bool CheckToken(string token)
        {
            var sql = @"select count(1) from dbo.[User] where token=@token and DATEDIFF(s, tokenExpireTime , getdate()) < 0;";

            return(DbManage.ExecuteScalar <int>(sql, new { token }) > 0);
        }
        public int GetCartCount(int userId)
        {
            var sql = @"Select count(1) from [dbo].[ShoppingCart] where UserId=@userId AND Status=1 AND IsDeleted=0;";

            return(DbManage.ExecuteScalar <int>(sql, new { userId }));
        }
Esempio n. 3
0
        public string GetTradeNo(long orderId)
        {
            string sql = " Select TradeNo from [dbo].[Order] where Id=@orderId";

            return(DbManage.ExecuteScalar <string>(sql, new { orderId }));
        }
Esempio n. 4
0
        public int Login(string username, string password)
        {
            var sql = @"select Id from dbo.Admin where [LogName] = @username and [LogPwd]= @password";

            return(DbManage.ExecuteScalar <int>(sql, new { username = username, password = password }));
        }
Esempio n. 5
0
        public bool ExistOrder(int userId, string tradeNo)
        {
            string sql = "SELECT count(1) from dbo.[Order] o inner join dbo.[User] u on u.Id=o.UserId where u.Id=@userId and o.TradeNo=@tradeNo";

            return(DbManage.ExecuteScalar <int>(sql, new { tradeNo, userId }) > 0);
        }