コード例 #1
0
 private void ShowCategory()
 {
     if (!IsPostBack)
     {
         KategoriDb db = new KategoriDb();
         DropDownListCategory.DataSource     = db.CategoriesShow();
         DropDownListCategory.DataValueField = "Kategori_ID";
         DropDownListCategory.DataTextField  = "Kategori_Ad";
         DropDownListCategory.DataBind();
     }
 }
コード例 #2
0
        protected void btnCategoryDelete_Click(object sender, EventArgs e)
        {
            Kategori k = new Kategori();

            k.Id = Convert.ToInt16(DropDownListCategories.SelectedItem.Value);
            KategoriDb db = new KategoriDb();

            try
            {
                db.Delete(k);
            }
            catch (Exception hata)
            {
                Label_ErrorDelete.Visible = true;
                Label_ErrorDelete.Text    = hata.Message.ToString();
            }
            CategoryListShow();
            Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
        }
コード例 #3
0
        protected void btnCategoryAdd_Click(object sender, EventArgs e)
        {
            Label_ErrorDelete.Text = "";
            Label_Error.Text       = "";
            Kategori k = new Kategori();

            k.Ad = txtCategoryName.Text;
            KategoriDb kdb = new KategoriDb();

            try
            {
                kdb.Insert(k);
            }
            catch (Exception hata)
            {
                Label_Error.Visible = true;
                Label_Error.Text    = hata.Message.ToString();
            }
            CategoryListShow();
            Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
        }
コード例 #4
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;
            }
        }