protected void Page_Load(object sender, EventArgs e) { if (Session["login"] != null) { string username = null; if (Session["id"] != null) { int.TryParse(clsRidjindalEncryption.Decrypt(Session["id"].ToString(), "P@ssword", "123", "SHA1", 2, "%1234567890@#$%^", 256), out userID); } if (Session["userName"] != null) { username = clsRidjindalEncryption.Decrypt(Session["userName"].ToString(), "P@ssword", "123", "SHA1", 2, "%1234567890@#$%^", 256); } string email = null; if (Session["email"] != null) { email = clsRidjindalEncryption.Decrypt(Session["email"].ToString(), "P@ssword", "123", "SHA1", 2, "%1234567890@#$%^", 256); } string pwd = null; if (Session["pwd"] != null) { pwd = clsRidjindalEncryption.Decrypt(Session["pwd"].ToString(), "P@ssword", "123", "SHA1", 2, "%1234567890@#$%^", 256); } if (Login.checkLogin(username, email, pwd, clsRidjindalEncryption.Decrypt(Session["login"].ToString(), "P@ssword", "123", "SHA1", 2, "%1234567890@#$%^", 256) == "1") == null || userID == -1) { Response.Redirect("Login.aspx"); } int productID; if (Request.QueryString["id"] == null || !int.TryParse(Request.QueryString["id"], out productID)) { Response.Redirect("Products.aspx"); } else { lhptxt.InnerText = (Login.UserLHP(userID) + Login.getProgramsCount(userID)).ToString(); usernametxt.InnerText = username; hdfuserid.Value = userID.ToString(); wishListTxt.InnerText = Login.countWishList(userID).ToString(); cartTxt.InnerText = Login.countCart(userID).ToString(); title_label.InnerText = productID.ToString(); SqlConnection con = new SqlConnection(Login.GetConnectionString()); SqlConnection con1 = new SqlConnection(Login.GetConnectionString()); string strsql = "select * from LH_product join LH_category on LH_product.category = LH_category.id where LH_product.id =@productID"; con.Open(); SqlCommand cmd = new SqlCommand(strsql, con); cmd.Parameters.AddWithValue("@productID", productID); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { title_label.InnerText = dr["title"].ToString(); titleTxt.InnerText = dr["title"].ToString(); categoryLink.HRef = "products.aspx?id=" + dr["id"].ToString(); categoryLink.InnerText = dr["category_name"].ToString(); wishList.Attributes["onclick"] = "javascript: fnAddWishIcon(" + productID + ");"; price.InnerText = dr["price"].ToString(); strsql = "select * from LH_product_image where product_id =@productID"; con1.Open(); cmd = new SqlCommand(strsql, con1); cmd.Parameters.AddWithValue("@productID", productID); SqlDataReader dr1 = cmd.ExecuteReader(); bool firstImageFlag = true; while (dr1.Read()) { HtmlGenericControl li = new HtmlGenericControl("li"); if (firstImageFlag) { li.Attributes["class"] = "active"; firstImageFlag = false; firstImage.Src = dr1["image"].ToString(); } HtmlGenericControl img = new HtmlGenericControl("img"); img.Attributes["src"] = dr1["image"].ToString(); li.Controls.Add(img); productImage.Controls.Add(li); } } SqlConnection conn = new SqlConnection(Login.GetConnectionString()); string strsql1 = "select * from LH_Programs join LH_Rates on LH_Programs.program = LH_Rates.Program_ID join LH_programs_list on LH_Programs.program = LH_programs_list.ID where LH_Rates.Approved = 1 and LH_Programs.User_Id = @userID"; conn.Open(); SqlCommand cmd1 = new SqlCommand(strsql1, conn); cmd1.Parameters.AddWithValue("@userID", hdfuserid.Value); SqlDataReader dr2 = cmd1.ExecuteReader(); int i = 0; while (dr2.Read()) { i++; Createprogram(int.Parse(dr2[1].ToString()), dr2[10].ToString(), dr2["logo"].ToString(), dr2["name"].ToString(), dr2["points"].ToString(), dr2["program"].ToString(), i); // wishlistbar(dr2[16].ToString()); } conn.Close(); } } else { Response.Redirect("logout.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { int userID = -1; if (Session["login"] != null) { string username = null; if (Session["id"] != null) { int.TryParse(clsRidjindalEncryption.Decrypt(Session["id"].ToString(), "P@ssword", "123", "SHA1", 2, "%1234567890@#$%^", 256), out userID); } if (Session["userName"] != null) { username = clsRidjindalEncryption.Decrypt(Session["userName"].ToString(), "P@ssword", "123", "SHA1", 2, "%1234567890@#$%^", 256); } string email = null; if (Session["email"] != null) { email = clsRidjindalEncryption.Decrypt(Session["email"].ToString(), "P@ssword", "123", "SHA1", 2, "%1234567890@#$%^", 256); } string pwd = null; if (Session["pwd"] != null) { pwd = clsRidjindalEncryption.Decrypt(Session["pwd"].ToString(), "P@ssword", "123", "SHA1", 2, "%1234567890@#$%^", 256); } bool isSession = (Session["login"] != null) ? clsRidjindalEncryption.Decrypt(Session["login"].ToString(), "P@ssword", "123", "SHA1", 2, "%1234567890@#$%^", 256) == "1" : false; if (Login.checkLogin(username, email, pwd, isSession) != null) { sign.Visible = false; signup_menu.Visible = false; login_menu.Visible = false; wishListItem.Visible = true; cartItem.Visible = true; cartCount.InnerText = Login.countCart(userID).ToString(); wishListCount.InnerText = Login.countWishList(userID).ToString(); //usernameDiv.Visible = true; //usernametxt.InnerText = username; } else { sign.Visible = true; signup_menu.Visible = true; login_menu.Visible = true; wishListItem.Visible = false; cartItem.Visible = false; //usernameDiv.Visible = false; } } else { sign.Visible = true; signup_menu.Visible = true; login_menu.Visible = true; wishListItem.Visible = false; cartItem.Visible = false; //usernameDiv.Visible = false; } SqlConnection con = new SqlConnection(Login.GetConnectionString()); string query = "select * from LH_category"; con.Open(); SqlCommand cmd = new SqlCommand(query, con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { categoryItems.Controls.Add(new LiteralControl(" <li><a href='products.aspx?cat=" + dr["id"] + "'>" + dr["category_name"] + "</a></li>")); } con.Close(); }