protected void files_FilesPosted(object sender, FilesPostedEventArgs e) { try { if (e.PostedFiles.Count == 0) { return; } ExceptionCollection exceptions = new ExceptionCollection(); foreach (HttpPostedFile file in e.PostedFiles) { try { TransitAccountPicture p = new TransitAccountPicture(); ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream); p.Bitmap = t.Bitmap; p.Name = Path.GetFileName(file.FileName); p.Description = string.Empty; p.Hidden = true; int id = SessionManager.CreateOrUpdate <TransitAccountPicture>( p, SessionManager.AccountService.CreateOrUpdateAccountPicture); Size size = t.GetNewSize(new Size(200, 200)); inputBody.Content = string.Format("<a href=AccountPictureView.aspx?id={2}><img border=0 width={0} height={1} src=AccountPicture.aspx?id={2}></a>\n{3}", size.Width, size.Height, id, inputBody.Content); } catch (Exception ex) { exceptions.Add(new Exception(string.Format("Error processing {0}: {1}", Renderer.Render(file.FileName), ex.Message), ex)); } exceptions.Throw(); } } catch (Exception ex) { ReportException(ex); } }
protected void files_FilesPosted(object sender, FilesPostedEventArgs e) { try { if (e.PostedFiles.Count == 0) { return; } ExceptionCollection exceptions = new ExceptionCollection(); foreach (HttpPostedFile file in e.PostedFiles) { try { TransitAccountEventPicture p = new TransitAccountEventPicture(); ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream); p.Picture = t.Bitmap; p.Name = Path.GetFileName(file.FileName); p.Description = string.Empty; p.AccountEventId = RequestId; SessionManager.CreateOrUpdate <TransitAccountEventPicture>( p, SessionManager.EventService.CreateOrUpdateAccountEventPicture); } catch (Exception ex) { exceptions.Add(new Exception(string.Format("Error processing {0}: {1}", Renderer.Render(file.FileName), ex.Message), ex)); } } gridManage.CurrentPageIndex = 0; gridManage_OnGetDataSource(sender, e); gridManage.DataBind(); exceptions.Throw(); Redirect(string.Format("AccountEventView.aspx?id={0}", RequestId)); } catch (Exception ex) { ReportException(ex); } }
protected void files_FilesPosted(object sender, FilesPostedEventArgs e) { try { if (e.PostedFiles.Count == 0) { return; } ExceptionCollection exceptions = new ExceptionCollection(); foreach (HttpPostedFile file in e.PostedFiles) { try { TransitAccountPicture p = new TransitAccountPicture(); ThumbnailBitmap t = new ThumbnailBitmap(file.InputStream); p.Bitmap = t.Bitmap; p.Name = Path.GetFileName(file.FileName); p.Description = string.Empty; p.Hidden = false; SessionManager.CreateOrUpdate <TransitAccountPicture>( p, SessionManager.AccountService.CreateOrUpdateAccountPicture); } catch (Exception ex) { exceptions.Add(new Exception(string.Format("Error processing {0}: {1}", Renderer.Render(file.FileName), ex.Message), ex)); } } GetData(sender, e); exceptions.Throw(); } catch (Exception ex) { ReportException(ex); } }