Пример #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     //Kategori Silme Butonu
     if (!String.IsNullOrEmpty(textBox2.Text) && !String.IsNullOrEmpty(textBox3.Text))
     {
         var a = MessageBox.Show(" Silmek istediğinize emin misiniz?", "Bilgilendirme", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (a == DialogResult.Yes)
         {
             Category cg = HelperCategory.GetByID(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value));
             cg.IsActive = false;
             var b = HelperCategory.CUD(cg, System.Data.Entity.EntityState.Modified);
             if (b.Item2)
             {
                 MessageBox.Show("Silme işlemi başarılı");
             }
             else
             {
                 MessageBox.Show("Silme yapılamadı");
             }
         }
         Yenile();
     }
     else
     {
         MessageBox.Show("Lütfen silinecek kategoriyi seçiniz.");
     }
 }
Пример #2
0
 private void button4_Click(object sender, EventArgs e)
 {
     //Kategori Düzenleme Butonu
     if (!String.IsNullOrEmpty(textBox2.Text) && !String.IsNullOrEmpty(textBox3.Text))
     {
         Category cg = HelperCategory.GetByID(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value));
         cg.categoryName = textBox2.Text;
         cg.Description  = textBox3.Text;
         var degistir = HelperCategory.CUD(cg, System.Data.Entity.EntityState.Modified);
         if (degistir.Item2)
         {
             MessageBox.Show("Güncelleme başarılı.");
         }
         else
         {
             MessageBox.Show("Güncelleme yapılamadı.");
         }
         Yenile();
     }
     else
     {
         MessageBox.Show("Lütfen tüm alanları doldurunuz.");
     }
     textBox2.Clear();
     textBox3.Clear();
 }
Пример #3
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            dataGridView1.ClearSelection();
            Category cg = HelperCategory.GetByID(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value));

            textBox2.Text = cg.categoryName;
            textBox3.Text = cg.Description;
        }
Пример #4
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            dataGridView1.ClearSelection();
            Product  p = HelperProduct.GetByID(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value));
            Category c = HelperCategory.GetByID(p.categoryID);
            Supplier s = HelperSupplier.GetByID(p.supplierID);

            textBox2.Text   = p.productName;
            textBox3.Text   = p.unitPrice.ToString();
            textBox4.Text   = p.discount.ToString();
            comboBox2.Text  = s.companyName;
            comboBox3.Text  = c.categoryName;
            button6.Enabled = true;
            button7.Enabled = true;
        }