Пример #1
0
 protected void btnUploadImage_Click(object sender, EventArgs e)
 {
     pictureTableAdapter pictureTable = new pictureTableAdapter();
     userwhiskyTableAdapter userwhiskyTable = new userwhiskyTableAdapter();
     Guid currentUserID = Guid.Parse(System.Web.Security.Membership.GetUser().ProviderUserKey.ToString());
     if (fuImageUpload.PostedFile != null &&
         fuImageUpload.FileName != "")
     {
         HttpPostedFile imageFile = fuImageUpload.PostedFile;
         byte[] imageData = new byte[imageFile.ContentLength];
         imageFile.InputStream.Read(imageData, 0, imageFile.ContentLength);
         pictureTable.Insert(
             currentUserID,
             int.Parse(this.Request.QueryString["id"]),
             radioFriendsOnly.Checked,
             radioAllowAll.Checked,
             imageData,
             imageFile.ContentType);
         DataTable pictures = pictureTable.GetImageByUserAndWhisky(currentUserID, int.Parse(this.Request.QueryString["id"]));
         userwhiskyTable.UpdatePicture(int.Parse(pictures.Rows[0]["id"].ToString()),currentUserID,int.Parse(this.Request.QueryString["id"]));
     }
 }
Пример #2
0
 protected void selectImage_Click(object sender, ImageClickEventArgs e)
 {
     MembershipUser currentUser = System.Web.Security.Membership.GetUser();
     ImageButton imgBtnControl = sender as ImageButton;
     userwhiskyTableAdapter userWhiskyTable = new userwhiskyTableAdapter();
     userWhiskyTable.UpdatePicture(int.Parse(imgBtnControl.ID.ToString()), Guid.Parse(currentUser.ProviderUserKey.ToString()), int.Parse(Request.QueryString["id"].ToString()));
 }