protected void BtnUpdate_Click(object sender, EventArgs e) { string userid = User.Identity.GetUserId(); int UserProfileId = UserProfileHelper.GetUserprofileId(userid); Button btn = (Button)sender; ListViewItem item = (ListViewItem)btn.NamingContainer; TextBox Fname = (TextBox)item.FindControl("FirstNameLabel"); TextBox Lname = (TextBox)item.FindControl("LastnameLabel"); TextBox Email = (TextBox)item.FindControl("EmailLabel"); TextBox Phone = (TextBox)item.FindControl("PhoneLabel"); Label Picture = (Label)item.FindControl("ProfilrpicLabel"); FileUpload Pimage1 = (FileUpload)item.FindControl("FileUpload1"); UserProfile u = new UserProfile(); u.FirstName = Fname.Text; u.Lastname = Lname.Text; u.Email = Email.Text; u.Phone = Phone.Text; if (Pimage1.FileName != "") { u.Profilrpic = Pimage1.FileName; Pimage1.SaveAs(Server.MapPath("~/ProfilePicture/" + u.Profilrpic)); } else { u.Profilrpic = Picture.Text; } u.UserProfileId = UserProfileId; UserProfileHelper.UpdateProfileSetting(u); Response.Redirect("ProfileSetting"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string userid = User.Identity.GetUserId(); int UserprofileId = UserProfileHelper.GetUserprofileId(userid); DataSet ds = CartHelper.ViewMyCart(UserprofileId); ListView1.DataSource = ds; ListView1.DataBind(); } }
protected void BtnCart_Click(object sender, EventArgs e) { string userid = User.Identity.GetUserId(); Button btn = (Button)sender; ListViewItem item = (ListViewItem)btn.NamingContainer; Label id = (Label)item.FindControl("ProductIdLabel"); TextBox quantity = (TextBox)item.FindControl("TxtQuantity"); Cart c = new Cart(); c.ProductId = int.Parse(id.Text); c.Quantity = int.Parse(quantity.Text); c.UserProfileId = UserProfileHelper.GetUserprofileId(userid); CartHelper.InsertCart(c); }
protected void BtnUpdate_Click(object sender, EventArgs e) { string userid = User.Identity.GetUserId(); int UserProfileId = UserProfileHelper.GetUserprofileId(userid); Button btn = (Button)sender; ListViewItem item = (ListViewItem)btn.NamingContainer; TextBox Hname = (TextBox)item.FindControl("HouseNameLabel"); TextBox Street = (TextBox)item.FindControl("StreetLabel"); TextBox City = (TextBox)item.FindControl("CityLabel"); TextBox State = (TextBox)item.FindControl("StateLabel"); TextBox Country = (TextBox)item.FindControl("CountryLabel"); TextBox Zip = (TextBox)item.FindControl("ZipLabel"); UserProfile u = new UserProfile(); u.HouseName = Hname.Text; u.Street = Street.Text; u.City = City.Text; u.State = State.Text; u.Country = Country.Text; u.Zip = int.Parse(Zip.Text); u.UserProfileId = UserProfileId; UserProfileHelper.UpdateAddressBook(u); Response.Redirect("AddressBook"); }