private void btnUpdate_Click(object sender, EventArgs e) { _productDal.Update(new Product { Id = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value), // id değişmesini istemediğimiz için gridden aldık. Name = tbxNameUpdate.Text, // yeni gelecek olan değeri update kısmındaki textboxtan aldık. UnitPrice = Convert.ToDecimal(tbxUnitPriceUpdate.Text), StockAmount = Convert.ToInt32(tbxStockAmountUpdate.Text) }); LoadProducts(); MessageBox.Show("Updated Successfully!"); }
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("Updated!"); }
private void btnUpdate_Click(object sender, EventArgs e) { _productDal.Update(new Product { Id = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value), // Buradaki Id'yi gridden alıyoruz. Kullanıcının değiştirmesiin istemiyoruz. Name = tbxNameUpdate.Text, Price = Convert.ToDecimal(tbxPriceUpdate.Text), Stock = Convert.ToInt32(tbxStockUpdate.Text), }); LoadProducts(); MessageBox.Show("Updated!"); }
private void btnUpdate_Click(object sender, EventArgs e) { _prodcDal.Update(new Product() { Id = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value), Name = txtNameUpdate.Text, UnitPrice = Convert.ToDecimal(txtUnitePriceUpdate.Text), StockAmount = Convert.ToInt32(txtStockAmountUpdate.Text) }); GetProductList(); MessageBox.Show("Products updated!"); }
private void btnUpdate_Click(object sender, EventArgs e) { _productDal.Update(new Product { Id = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value), Name = tbxUpdateName.Text, UnitPrice = Convert.ToDecimal(tbxUpdateUnitPrice.Text), StockAmount = Convert.ToInt32(tbxUpdateStockAmount.Text) }); ProductLoad(); MessageBox.Show("Updated!!"); }
private void btnUpdate_Click(object sender, EventArgs e) { _productDal.Update(new Product { Id = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value), Name = tbxNameUpdate.Text.ToString(), UnitPrice = Convert.ToDecimal(tbxUnitPriceUpdate.Text), StockAmount = Convert.ToInt32(tbxStockAmountUpdate.Text) //seçilen verileri id'ye göre değiştiriyor. }); //öncelikle verinin gelmesi lazım CellClick event bunu sağlıyor. LoadProducts(); MessageBox.Show("Updated!!!"); }
private void btnUpdate_Click(object sender, EventArgs e) { _productDal.Update(new Product { // ID değişmediği için Data Gridden alıyoruz Id = Convert.ToInt32(dgwProducts.CurrentRow.Cells[0].Value), //Diğerlerini Update 'den alıyoruz Name = tbxNameUpdate.Text, UnitPrice = Convert.ToDecimal(tbxUnitPriceUpdate.Text), Stock = Convert.ToInt32(tbxStockUpdate.Text) }); LoadProducts(); MessageBox.Show("Updated...."); }
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.ToInt16(cmbUpdateCategory.SelectedIndex), UnitPrice = Convert.ToDecimal(txtUpdatePrice.Text), StockAmount = Convert.ToInt16(txtUpdateStock.Text), Status = Convert.ToBoolean(chbUpdateStatus.Checked), RegisterDate = DateTime.Now }); LoadProducts(); MessageBox.Show("Product Updated!!"); }
private void btnUpdate_Click(object sender, EventArgs e) { (var Id, _, _, _) = GetDataGridValuesInTheRow(); var prod = new Product { Id = Id, Name = tbxNameUpdate.Text, UnitPrice = Convert.ToDecimal(tbxUnitPriceUpdate.Text), StockAmount = Convert.ToInt32(tbxStockAmountUpdate.Text), }; _productdal.Update(prod); _Refresh(); MessageBox.Show("Message Added!"); }
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!"); } }