예제 #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            _productDal.Update(new Product
            {
                Id          = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value),
                Name        = tbxUpdateName.Text.ToString(),
                UnitPrice   = Convert.ToDecimal(tbxUpdateUnitPrice.Text),
                StockAmount = Convert.ToInt32(tbxUpdateStockAmount.Text)
            });

            ProductLoad();
        }
예제 #2
0
 private void BtnUpdate_Click(object sender, EventArgs e)
 {
     _productDal.Update(new Product
     {
         Id          = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value),
         Name        = tbxNameUpdate.Text,
         UnitPrice   = Convert.ToDecimal(tbxUnitPriceUpdate.Text),
         StockAmount = Convert.ToInt32(tbxStockAmountUpdate.Text)
     });
     LoadProducts();
     MessageBox.Show("Product Updated!");
 }
예제 #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Product product = new Product
            {
                Id          = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value),
                Name        = tbxName.Text,
                UnitPrice   = Convert.ToDecimal(tbxUnitPrice.Text),
                StockAmount = Convert.ToInt32(tbxStockAmount.Text)
            };

            _productDal.Update(product);
            LoadProducts();
        }
예제 #4
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Product product = new Product()
            {
                Id           = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value),
                Name         = tbxUpdateName.Text,
                UnitPrice    = Convert.ToDecimal(tbxUpdateUnitPrice.Text),
                UnitsInStock = Convert.ToInt32(tbxUpdateStockAmount.Text)
            };

            _productDal.Update(product);
            LoadProducts();
            MessageBox.Show("Product Updated!");
        }
예제 #5
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Product product = new Product
            {
                Id          = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value),
                Name        = tbxNameUpdate.Text.ToString(),
                UnitPrice   = Convert.ToDecimal(tbxUnitPriceUpdate.Text),
                StockAmount = Convert.ToInt32(tbxStockAmountUpdate.Text)
            };

            _productDal.Update(product);
            ShowAllItems();
            MessageBox.Show("Updated :)");
        }
예제 #6
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Product product = new Product
            {
                Id          = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value),
                Name        = tbxNameUpdate.Text,
                UnitPrice   = Convert.ToDecimal(tblUnitPriceUpdate.Text),
                StockAmount = Convert.ToInt32(tbxStockAmountUpdate.Text)
            };

            _productdal.Update(product);
            TabloGetir();
            MessageBox.Show("Updated");
        }
예제 #7
0
파일: Form1.cs 프로젝트: smhblk04/Csharp
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Product product = new Product
            {
                id          = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value),
                Name        = tbxNameUpdate.Text,
                StockAmount = Convert.ToInt32(tbxstockAmountUpdate.Text),
                UnitPrice   = Convert.ToDecimal(tbxunitPriceUpdate.Text)
            };

            _productDal.Update(product);
            LoadProducts();//Sonuclari ekrana yansit
            MessageBox.Show("Product is updated.");
        }
예제 #8
0
 private void btnProductUpdate_Click(object sender, EventArgs e)
 {
     _productDal.Update(new Product
     {
         Product_Id  = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value),
         ProducName  = textProductNameUpdate.Text,
         UnitePrice  = Convert.ToDecimal(textUnitePriceUpdate.Text),
         StockAmount = Convert.ToInt32(textStockAmountUpdate.Text),
     });
     TextClear();
     LoadProducts();
     MessageBox.Show("Product Updated!");
     //MessageBox.Show("{0} Product Updated!",_product.ProducName);
 }
예제 #9
0
        private void btnUpdate_Click(object sender, EventArgs e) //update butonuna basıldığında çalışacak kod bloğu.
        {
            Product product = new Product
            {
                Id          = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value), //var olan id üzerine işlem yapılıyor.
                Name        = tbxNameUpdate.Text.ToString(),                          //update hücrelerinde yer alan veriler ekleniyor.
                UnitPrice   = Convert.ToDecimal(tbxUnitPriceUpdate.Text),
                StockAmount = Convert.ToInt32(tbxStockAmountUpdate.Text)
            };

            _productDal.Update(product);
            LoadProducts();
            MessageBox.Show("Updated!");
        }
예제 #10
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Product product = new Product
            {
                Id          = Convert.ToInt32(dgvProducts.CurrentRow.Cells[0].Value),
                Name        = txtNameUpdate.Text,
                UnitPrice   = Convert.ToInt32(txtUnitPriceUpdate.Text),
                StockAmount = Convert.ToInt32(txtStockAmountUpdate.Text)
            };

            _productDal.Update(product);
            LoadProducts();
            MessageBox.Show("Product Updated");
        }
예제 #11
0
        private void btnUpdate_Click(object sender, EventArgs e)                      //(97)update butonu textbox içinde yapılan değişiklikleri gride yüklemeye yarar.
        {
            Product product = new Product                                             //(97)Product sınıfının property nesnelerine erişebilmek için product nesnesini implemente ettik.
            {
                Id          = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value), //(97)Bu değer güncellenmeyeceği için doğrudan gridden çekiyoruz.
                Name        = tbxNameUpdate.Text,
                UnitPrice   = Convert.ToDecimal(tbxUnitPriceUpdate.Text),
                StockAmount = Convert.ToInt32(tbxStockAmountUpdate.Text)//(97) Diğer değerler textboxlarda değiştirilmiş hallariyle geri yüklenecekleri için textboxlardan çekiyoruz.
            };

            _productDal.Update(product); //(97)product nesnesine yüklenen veriler _productDal nesnesiyle ProductDal sınıfı içindeki update metoduna gönderildi.

            LoadProducts();              //(97)Grid yeniden yüklendi.
            MessageBox.Show("Updated");
        }
예제 #12
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     _productDal.Update(new Product
     {
         Id           = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value),
         Name         = txtUpdateName.Text,
         CategoryId   = Convert.ToInt32(cmbUpdateCategory.SelectedIndex),
         UnitPrice    = Convert.ToDecimal(txtUpdatePrice.Text),
         StockAmount  = Convert.ToInt32(txtUpdateStock.Text),
         Status       = Convert.ToBoolean(chbUpdateStatus.Checked),
         RegisterDate = DateTime.Now
     });
     LoadProducts();
     MessageBox.Show("Product Updated!!");
 }
예제 #13
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (dgwProducts.CurrentRow != null)
            {
                Product product = new Product()
                {
                    Id          = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value),
                    Name        = tbxNameUpdate.Text,
                    UnitPrice   = Convert.ToDecimal(tbxUnitPriceUpdate.Text),
                    StockAmount = Convert.ToInt32(tbxStockAmountUpdate.Text)
                };

                _productDal.Update(product);
                LoadProducts();
                MessageBox.Show("Product updated.");
            }
        }
예제 #14
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtUpdateName.Text))
     {
         Product product = new Product
         {
             Id          = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value),
             Name        = txtUpdateName.Text,
             UnitPrice   = Convert.ToDecimal(txtUpdateUnitPrice.Text),
             StockAmount = Convert.ToInt32(txtUpdateStockAmount.Text)
         };
         _productDal.Update(product);
         LoadProducts();
         UpdateProductFormTemizle();
         MessageBox.Show("Product Updated!");
     }
     else
     {
         MessageBox.Show("Select Product from Table!");
     }
 }