protected void uiLinkButtonMainLogin_Click(object sender, EventArgs e) { UserInfo user = new UserInfo(); user.GetUserByUserNameAndPassword(uiTextBoxUserName.Text, uiTextBoxPassword.Text); if (user.RowCount > 0) { Session["CurrentUser"] = user; if (Request.QueryString["url"] != null) Response.Redirect(Request.QueryString["url"].ToString()); Response.Redirect("default.aspx"); } else { uiLabelError.Visible = true; } }
protected void uiLinkButtonRegister_Click(object sender, EventArgs e) { UserInfo user = new UserInfo(); user.AddNew(); user.FullName = uiTextBoxFN.Text; user.UserName = uiTextBoxUN.Text; user.UserPassword = uiTextBoxPassword.Text; user.Email = uiTextBoxEmail.Text; user.UserAddress = uiTextBoxAddress.Text; user.ShippingAddress = uiTextBoxSAddress.Text; user.LandLine = uiTextBoxLandLine.Text; user.MobilePhone = uiTextBoxMobile.Text; user.Save(); Session["CurrentUser"] = user; Response.Redirect("default.aspx"); }
private void LoadFavItems() { if (Session["CurrentUser"] != null) { UserInfo user = new UserInfo(); user = (UserInfo)Session["CurrentUser"]; UserFavorites favs = new UserFavorites(); favs.GetFavouritesByUserID(user.UserID); if (favs.RowCount > 0) { uiRepeaterItems.DataSource = favs.DefaultView; uiRepeaterItems.DataBind(); } } else { uiLiteralNoItems.Visible = true; } }
protected void uiLinkButtonMainLogin_Click(object sender, EventArgs e) { UserInfo user = new UserInfo(); user.GetUserByUserNameAndPassword(uiTextBoxUserName.Text, uiTextBoxPassword.Text); if (user.RowCount > 0 ) { if (user.UserName == "Admin") { Session["CurrentAdmin"] = user; Response.Redirect("admincp.aspx"); } else { uiLabelError.Visible = true; } } else { uiLabelError.Visible = true; } }
protected void uiRepeaterCards_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "AddToFav") { UserFavorites fav = new UserFavorites(); if (Session["CurrentUser"] != null) { UserInfo user = new UserInfo(); user = (UserInfo)Session["CurrentUser"]; fav.GetFavouritesByUserIDAndProductID(user.UserID, Convert.ToInt32(e.CommandArgument.ToString())); if (!(fav.RowCount > 0)) { fav.AddNew(); fav.UserID = user.UserID; fav.CardID = Convert.ToInt32(e.CommandArgument.ToString()); fav.MarkDate = DateTime.Now; fav.Save(); } } else { Response.Redirect("login.aspx"); } } }