/// <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 })); }
public string GetTradeNo(long orderId) { string sql = " Select TradeNo from [dbo].[Order] where Id=@orderId"; return(DbManage.ExecuteScalar <string>(sql, new { orderId })); }
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 })); }
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); }