Saturday, January 15, 2011
(ASP.NET ) Web Tabanlı Kütüphane Uygulamamdan Bir Kesit,Add Book
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.IO;
public partial class admin_addBook : System.Web.UI.Page
{
private byte[] result;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
}
else
{
if (FileUpload1.HasFile)
{
HttpPostedFile newFile = FileUpload1.PostedFile;
byte[] data = new Byte[newFile.ContentLength];
newFile.InputStream.Read(data, 0, newFile.ContentLength);
result = data;
ImageConverter ic = new ImageConverter();
System.Drawing.Image img = (System.Drawing.Image)ic.ConvertFrom(data);
Bitmap b = new Bitmap(img);
b.Save(Server.MapPath("") + "\\temp.bmp");
Image1.ImageUrl = "temp.bmp";
Image1.Width = 150;
}
}
}
protected void btnAddBook_Click(object sender, EventArgs e)
{
database d = new database();
book newbook = new book();
newbook.bookTitle = txtBookTitle.Text;
newbook.bookAuthor = txtBookAuthor.Text;
if (result != null)
newbook.bookImage = result;
else
{
result = new byte[1];
newbook.bookImage = result;
}
d.insertNewBook(newbook);
}
protected void btnUpload_Click(object sender, EventArgs e)
{
}
}
Subscribe to:
Post Comments (Atom)
Kendi Çalışmalarım
2015
Kendi Çalışmalarım
2015
Kendi Çalışmalarım
2015
Kendi Çalışmalarım
2011
Kendi Çalışmalarım
2009
Kendi Çalışmalarım
2007
Kendi Çalışmalarım
2008
Kendi Çalışmalarım
2015
Kendi Çalışmalarım
2009

No comments:
Post a Comment