public static string GetUserId() { List <ProductDTO> result = new List <ProductDTO>(); if (HttpContext.Current.Request.Cookies.AllKeys.Contains("AudioShopLogin")) { Services.DataTransfer dataTransfer = new Services.DataTransfer(); var ticket = FormsAuthentication.Decrypt(HttpContext.Current.Request.Cookies["AudioShopLogin"].Value); return(ticket.UserData.Split(',').First()); } return(""); }
public static List <CategoryLiteDTO> GetCategories() { try { Services.DataTransfer dataTransfer = new Services.DataTransfer(); return(dataTransfer.GetcategoryList()); } catch (Exception) { return(null); } }
public static List <Cart> GetCurrentCartItems() { List <Cart> result = new List <Cart>(); if (HttpContext.Current.Request.Cookies.AllKeys.Contains("AudioShopLogin")) { Services.DataTransfer dataTransfer = new Services.DataTransfer(); var ticket = FormsAuthentication.Decrypt(HttpContext.Current.Request.Cookies["AudioShopLogin"].Value); string niduser = ticket.UserData.Split(',').First(); result = dataTransfer.GetAllCartByNidUser(Guid.Parse(niduser)); } return(result); }
public static bool CheckUserLogin() { if (HttpContext.Current.Request.Cookies.AllKeys.Contains("AudioShopLogin")) { Services.DataTransfer dataTransfer = new Services.DataTransfer(); var ticket = FormsAuthentication.Decrypt(HttpContext.Current.Request.Cookies["AudioShopLogin"].Value); string niduser = ticket.UserData.Split(',').First(); var tmpUser = dataTransfer.GetUserByNidUser(Guid.Parse(niduser)); if (tmpUser != null) { return(true); } else { return(false); } } else { return(false); } }