예제 #1
0
파일: SearchDAO.cs 프로젝트: feid8/woods
        //Not Needed, I think.
        public List<ProductDomain> searchAllTwo(string search)
        {
            ProductDomain product = new ProductDomain();
            List<ProductDomain> productList = new List<ProductDomain>();

            string query = "SELECT * FROM [product]";

            SqlConnection sqlConnection = sqlQueryConnection.getSqlConnection();
            using (sqlConnection)
            {

                SqlCommand cmd = new SqlCommand(query, sqlConnection);
                sqlConnection.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    product = new ProductDomain();
                    product.ProductID = Int32.Parse(rdr["id"].ToString());
                    product.AccountID = Int32.Parse(rdr["account_id"].ToString());
                    product.Title = rdr["title"].ToString();
                    product.Description = rdr["description"].ToString();
                    product.Price = float.Parse(rdr["price"].ToString());
                    product.Shipping = float.Parse(rdr["shipping"].ToString());
                    product.Height = rdr["height"].ToString();
                    product.Width = rdr["width"].ToString();
                    product.Depth = rdr["depth"].ToString();
                    product.Weight = rdr["weight"].ToString();
                    product.Quantity = Int32.Parse(rdr["quantity"].ToString());
                    productList.Add(product);
                }
                rdr.Close();
            }
            return productList;
        }
예제 #2
0
        protected void SubmitButtom_Click(object sender, EventArgs e)
        {
            int accountId = accountDomain.AccountNumber;
            ProductDomain productDomain = new ProductDomain();
            //string filePath = FileUpload1.PostedFile.FileName;
            //Stream fileStream = FileUpload1.PostedFile.InputStream;
            productDomain.AccountID = accountId;
            productDomain.Title = title.Text;
            productDomain.Description = description.Text;
            productDomain.Price = float.Parse(price.Text);
            productDomain.Shipping = float.Parse(shipping.Text);
            productDomain.Height = height.Text;
            productDomain.Width = width.Text;
            productDomain.Depth = depth.Text;
            productDomain.Width = width.Text;
            productDomain.Weight = weight.Text;
            productDomain.Quantity = Int32.Parse(quantity.Text);
            //productDomain.PictureType = pictureBA.pictureType(filePath);
            //productDomain.Picture = pictureBA.pictureToByte(fileStream);
            productDAO.insert(productDomain);

            int productId = productDAO.getRecentProductId(accountId);

            List<Picture> list = new List<Picture>();
            int position = 0;
            foreach (Control control in this.FindControl("form1").Controls)
            {

                if(control.GetType().Name == "FileUpload")
                {
                    FileUpload fileUpload = (FileUpload)control;
                    if (fileUpload != null)
                    {
                        string filePath = fileUpload.PostedFile.FileName;
                        Stream fileStream = fileUpload.PostedFile.InputStream;
                        Picture picture = new Picture();
                        picture.AccountId = accountId;
                        picture.ProductId = productId;
                        picture.PictureByte = pictureBA.pictureToByte(fileStream);
                        picture.PictureType = pictureBA.pictureType(filePath);
                        picture.Position = position;
                        if(picture.PictureByte != null && picture.PictureType != null)
                        {
                            list.Add(picture);
                        }
                        position++;
                    }
                }
            }

            if(list.Count > 0)
            {
                pictureDAO.insertList(list);
            }

            Response.Redirect("MyAccount.aspx");
        }
예제 #3
0
파일: myshop.aspx.cs 프로젝트: feid8/woods
 protected void Button1_Click(object sender, EventArgs e)
 {
     ProductDomain productDomain = new ProductDomain();
     string filePath = FileUpload1.PostedFile.FileName;
     Stream fileStream = FileUpload1.PostedFile.InputStream;
     productDomain.AccountID = accountDomain.AccountNumber;
     productDomain.Title = title.Text;
     productDomain.Description = description.Text;
     productDomain.Price = float.Parse(price.Text);
     productDomain.Shipping = float.Parse(shipping.Text);
     productDomain.Height = height.Text;
     productDomain.Width = width.Text;
     productDomain.Depth = depth.Text;
     productDomain.Width = width.Text;
     productDomain.Weight = weight.Text;
     productDomain.Quantity = Int32.Parse(quantity.Text);
     productDAO.insert(productDomain);
 }