Esempio n. 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            AdminDomain adminDomain = new AdminDomain();
            AdminDAO adminDAO = new AdminDAO();
            PictureBA pictureBA = new PictureBA();

            string filePath = FileUpload1.PostedFile.FileName;
            Stream fileStream = FileUpload1.PostedFile.InputStream;
            adminDomain.setTitle(title.Text);
            adminDomain.setPictureType(pictureBA.pictureType(filePath));
            adminDomain.setPicture(pictureBA.pictureToByte(fileStream));
            adminDAO.uploadImage(adminDomain);
        }
Esempio n. 2
0
 public AdminDomain getHomePageImage()
 {
     SqlConnection mySqlConnection = sqlQueryConn.getSqlConnection();
     AdminDomain adminDomain = new AdminDomain();
     string query = "SELECT * FROM [admin_image] where id = 1";
     using (mySqlConnection)
     {
         SqlCommand cmd = new SqlCommand(query, mySqlConnection);
         mySqlConnection.Open();
         SqlDataReader rdr = cmd.ExecuteReader();
         while (rdr.Read())
         {
             adminDomain.setId((int)rdr["id"]);
             adminDomain.setTitle(rdr["name"].ToString());
             adminDomain.setPicture((byte[])rdr["image"]);
             adminDomain.setPictureType(rdr["image_type"].ToString());
         }
         rdr.Close();
     }
     return adminDomain;
 }