Esempio n. 1
0
        private void GetProducts(string search, string stok)
        {
            UrunDb db = new UrunDb();

            db.Connect();
            db.command             = new SqlCommand("sp_SearchProductList", db.connection);
            db.command.CommandType = CommandType.StoredProcedure;
            db.command.Parameters.AddWithValue("@search", search);
            db.command.Parameters.AddWithValue("@stok", stok);
            db.command.Parameters.AddWithValue("@altkategori", 0);
            db.command.ExecuteNonQuery();
            db.reader = db.command.ExecuteReader();
            while (db.reader.Read())
            {
                int     productID   = Convert.ToInt16(db.reader["Urun_ID"]);
                string  productName = db.reader["Urun_Ad"].ToString();
                decimal prudoctCost = Convert.ToDecimal(db.reader["Urun_Fiyat"]);
                string  imgPath     = db.reader["UrunResim_Yol"].ToString();
                productLists += String.Format("<div class='col-sm-4' style='margin-top:2em;'>" +
                                              "<div class='card'>" +
                                              "<div class='card-body text-center'>" +
                                              "<img src='{0}' class='img-thumbnail' style='width:150px;height:150px;' />" +
                                              "<a href='#'><h4><p><strong>{1}</strong></p></h4></a>" +
                                              "  <p>{2}</p>" +
                                              "<a href='ProductDetails.aspx?ProductID={3}' class='btn btn-fill btn-info'>İncele</a>" +
                                              " </div>" +
                                              "</div>" +
                                              "</div>", imgPath, prudoctCost, productName, productID);
            }
            db.reader.Close();
            db.connection.Close();
        }
Esempio n. 2
0
        protected void btnProductAdd_Click(object sender, EventArgs e)
        {
            singlePicture = Request.Params["singlePicture"] != null ? Request.Params["singlePicture"].ToString() : String.Empty;
            Urun u = new Urun();

            u.PersonelId.Id    = 1;
            u.Ad               = txtUrunAd.Text;
            u.Barkod           = txtBarkod.Text;
            u.Fiyat            = Convert.ToDecimal(txtCost.Text);
            u.Stok             = Convert.ToInt16(txtStock.Text);
            u.AltKategoriId.Id = Convert.ToInt16(DropDownListSubCategory.SelectedItem.Value);
            u.Ozellikler       = txtFeatures.Text;
            u.RafId.Id         = Convert.ToInt16(DropDownListRaf.SelectedItem.Value);
            UrunDb udb = new UrunDb();

            try
            {
                udb.Insert(u);
            }
            catch (Exception hata)
            {
                Response.Write("<script LANGUAGE='JavaScript' >alert('" + hata.Message.ToString() + "')</script>");
            }

            UrunResim r = new UrunResim();

            r.Yol = "Images/" + singlePicture;
            UrunResimDb rdb = new UrunResimDb();

            try
            {
                rdb.Insert(r);
            }
            catch (Exception hata)
            {
                Response.Write("<script LANGUAGE='JavaScript' >alert('" + hata.Message.ToString() + "')</script>");
            }
            Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
        }
Esempio n. 3
0
        protected void btnProductUpdate_Click(object sender, EventArgs e)
        {
            Urun u = new Urun();

            u.Ad               = txtUrunAd.Text;
            u.Barkod           = txtBarkod.Text;
            u.Ozellikler       = txtFeatures.Text;
            u.Stok             = Convert.ToInt16(txtStock.Text);
            u.AltKategoriId.Id = Convert.ToInt16(DropDownListSubCategory.SelectedItem.Value);
            u.Fiyat            = Convert.ToDecimal(txtCost.Text);
            UrunDb db = new UrunDb();

            try
            {
                db.Update(u);
            }
            catch (Exception hata)
            {
                Response.Write("<script LANGUAGE='JavaScript' >alert('" + hata.Message.ToString() + "')</script>");
            }
            Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
        }
Esempio n. 4
0
        protected void btnProductDelete_Click(object sender, EventArgs e)
        {
            Urun u = new Urun();

            u.Barkod = txtBarkod.Text;
            UrunDb    db        = new UrunDb();
            int       productID = db.GetProductID(u);
            UrunResim ur        = new UrunResim();

            ur.UrunId.Id = productID;
            UrunResimDb urdb = new UrunResimDb();

            try
            {
                urdb.Delete(ur);
                db.Delete(u);
            }
            catch (Exception hata)
            {
                Response.Write("<script LANGUAGE='JavaScript' >alert('" + hata.Message.ToString() + "')</script>");
            }
            Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
        }
Esempio n. 5
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            Label_SearchNotFound.Text = "";
            Urun u = new Urun();

            u.Barkod = search = Request.Params["search"] != null ? Request.Params["search"].ToString() : String.Empty;
            UrunDb db          = new UrunDb();
            int    subCategory = 0,
                   category    = 0,
                   personelID  = 0,
                   counter     = 0;

            db.Connect();
            db.command = new SqlCommand("SELECT	* FROM tbl_Urun WHERE	Urun_Barkod LIKE @barcode", db.connection);
            db.command.Parameters.AddWithValue("@barcode", u.Barkod);
            db.command.ExecuteNonQuery();
            db.reader = db.command.ExecuteReader();
            while (db.reader.Read())
            {
                txtCost.Text     = Convert.ToSingle(db.reader["Urun_Fiyat"]).ToString();
                txtStock.Text    = db.reader["Urun_Stok"].ToString();
                txtUrunAd.Text   = db.reader["Urun_Ad"].ToString();
                txtBarkod.Text   = search;
                txtFeatures.Text = db.reader["Urun_Ozellikleri"].ToString();
                subCategory      = Convert.ToInt16(db.reader["AltKategori_id"]);
                personelID       = Convert.ToInt16(db.reader["Personel_id"]);
                counter++;
            }
            db.reader.Close();
            if (counter == 0)
            {
                Label_SearchNotFound.Visible = true;
                Label_SearchNotFound.Text    = "Aradığınız ürün bulunamadı!";
            }
            else
            {
                db.command = new SqlCommand("SELECT * FROM tbl_AltKategori WHERE AltKategori_ID=@subCategory", db.connection);
                db.command.Parameters.AddWithValue("@subCategory", subCategory);
                db.command.ExecuteNonQuery();
                db.reader = db.command.ExecuteReader();
                while (db.reader.Read())
                {
                    category = Convert.ToInt16(db.reader["Kategori_id"]);
                }
                db.reader.Close();
                db.connection.Close();
                db.connection.Dispose();

                Kategori k = new Kategori();
                k.Id = category;
                KategoriDb kdb = new KategoriDb();
                Label_CurrentCategory.Text    = "";
                Label_CurrentCategory.Visible = true;
                Label_CurrentCategory.Text    = kdb.GetCategoryName(k);

                AltKategori ak = new AltKategori();
                ak.Id = subCategory;
                AltKategoriDb akdb = new AltKategoriDb();
                Label_CurrentSubCategory.Text    = "";
                Label_CurrentSubCategory.Visible = true;
                Label_CurrentSubCategory.Text    = akdb.GetSubCategoryName(ak);
                ShowCategory();
                txtBarkod.Enabled = false;
            }
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UrunID = Convert.ToInt32(Request.QueryString["ProductID"]);


            Urun Product = new Urun();

            Product.Id = UrunID;

            UrunDb dbProduct = new UrunDb();

            dbProduct.Connect();

            SqlCommand command = new SqlCommand("sp_ProductDetails", dbProduct.connection);

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@productID", Product.Id);

            SqlParameter productName = new SqlParameter("@productName", SqlDbType.NVarChar, int.MaxValue);

            productName.Direction = ParameterDirection.Output;
            command.Parameters.Add(productName);

            SqlParameter productPrice = new SqlParameter("@productPrice", SqlDbType.Decimal, 0);

            productPrice.Precision = 18;
            productPrice.Scale     = 2;
            productPrice.Direction = ParameterDirection.Output;
            command.Parameters.Add(productPrice);

            SqlParameter productStock = new SqlParameter("@productStock", SqlDbType.Int);

            productStock.Direction = ParameterDirection.Output;
            command.Parameters.Add(productStock);

            SqlParameter productSpecial = new SqlParameter("@productSpecial", SqlDbType.NVarChar, int.MaxValue);

            productSpecial.Direction = ParameterDirection.Output;
            command.Parameters.Add(productSpecial);

            SqlParameter productImageURL = new SqlParameter("@productImageURL", SqlDbType.NVarChar, int.MaxValue);

            productImageURL.Direction = ParameterDirection.Output;
            command.Parameters.Add(productImageURL);

            SqlParameter shelfID = new SqlParameter("@rafID", SqlDbType.Int);

            shelfID.Direction = ParameterDirection.Output;
            command.Parameters.Add(shelfID);
            try
            {
                command.ExecuteNonQuery();
                string pName     = productName.Value.ToString();
                string pPrice    = Convert.ToString(productPrice.Value);
                string pStock    = Convert.ToString(productStock.Value);
                string pSpecial  = productSpecial.Value.ToString();
                string pImageURL = productImageURL.Value.ToString();
                rafID = Convert.ToInt16(shelfID.Value);


                labelOzellikler.Text  = pSpecial;
                labelStokBilgi.Text   = pStock + " adet";
                labelUrunAd.Text      = pName;
                labelUrunFiyat.Text   = pPrice + " ₺";
                productImage.ImageUrl = pImageURL;

                dbProduct.command = new SqlCommand("SELECT * FROM tbl_Harita", dbProduct.connection);
                dbProduct.command.ExecuteNonQuery();
                dbProduct.reader = dbProduct.command.ExecuteReader();
                while (dbProduct.reader.Read())
                {
                    harita = dbProduct.reader["Harita_Tasarim"].ToString();
                }
                dbProduct.reader.Close();
                dbProduct.reader.Dispose();
            }
            catch (SqlException hata)
            {
                throw new Exception(hata.Message);
            }
            dbProduct.connection.Close();
            dbProduct.connection.Dispose();
        }