public static string CreateToken(int userId, int expireDays) { string token = UserMng.CreateTOKEN(); DateTime expire = DateTime.Now.AddDays(expireDays); int authTokenId = UserMng.AddAuthToken(userId, token, expire); return(authTokenId.ToString() + ":" + token); }
//Used in statistics in administration public static List <ClientData> GetClientsStat(string searchText, int startFrom, int pageSize, string sortBy, string sortDir, int sellerId, int currentSellerId, int originId) { List <ClientData> l = new List <ClientData>(); foreach (var r in DB.GetClientsStats(searchText, startFrom, pageSize, sortBy, sortDir, sellerId, currentSellerId, originId)) { ClientData item = new ClientData(); item.ClientId = Convert.ToInt32(r["client_id"]); item.ClientName = r["client_name"].ToString(); if (r["seller_id"] != null && r["seller_id"].ToString() != "" && r["seller_id"].ToString().ToUpper() != "NULL") { item.SellerId = int.Parse(r["seller_id"].ToString()); } if (r["seller_name"] != null && r["seller_name"].ToString() != "" && r["seller_name"].ToString().ToUpper() != "NULL") { item.SellerName = r["seller_name"].ToString(); } if (r["seller_user_id"] != null && r["seller_user_id"].ToString() != "" && r["seller_user_id"].ToString().ToUpper() != "NULL") { item.SellerUserId = int.Parse(r["seller_user_id"].ToString()); } if (r["country_id"] != null && r["country_id"].ToString() != "") { item.CountryId = int.Parse(r["country_id"].ToString()); } if (r["country_name"] != null && r["country_name"].ToString() != "" && r["country_name"].ToString().ToUpper() != "NULL") { item.CountryName = r["country_name"].ToString(); } if (r["total_query_count"] != DBNull.Value) { item.TotalQueryCount = Convert.ToInt32(r["total_query_count"]); } if (r["origin_id_out"] != DBNull.Value && r["origin_id_out"] != null) { item.OriginId = int.Parse(r["origin_id_out"].ToString()); } item.Products = UserMng.GetClientProducts(item.ClientId); l.Add(item); } return(l); }
public static void EndUserSession(int sessionId, string sessionTempFolder) { DB.DelSession(sessionId); UserMng.DeleteSessionTempFolder(sessionTempFolder); }