private void cBoxCategory_SelectedIndexChanged(object sender, EventArgs e) { ivo = new VO.InventoryVO(); ivo.cat_description = cBoxCategory.Text; ivo.patchCategoryCode(); l2.Text = ivo.patchCategoryCode(); }
private void btnSUpdate_Click(object sender, EventArgs e) { ivo = new VO.InventoryVO(); String S; String C; String W; if (Convert.ToInt32(dataGridView2.SelectedRows[0].Cells[1].Value.ToString()) >= 0 && Convert.ToDecimal(dataGridView2.SelectedRows[0].Cells[5].Value.ToString()) >= 0 && Convert.ToDecimal(dataGridView2.SelectedRows[0].Cells[6].Value.ToString()) >= 0 && Convert.ToDecimal(dataGridView2.SelectedRows[0].Cells[7].Value.ToString()) >= 0) { try { ivo.supplier_name = dataGridView2.SelectedRows[0].Cells[8].Value.ToString(); ivo.cat_description = dataGridView2.SelectedRows[0].Cells[9].Value.ToString(); ivo.warehouse_name = dataGridView2.SelectedRows[0].Cells[10].Value.ToString(); S = ivo.patchSupplierCode(); C = ivo.patchCategoryCode(); W = ivo.patchWarehouseCode(); updateCompute(); this.inventory_stocksTableAdapter.UpdateStocks(dataGridView2.SelectedRows[0].Cells[3].Value.ToString(), S, C, W, Convert.ToInt32(dataGridView2.SelectedRows[0].Cells[1].Value.ToString()), dataGridView2.SelectedRows[0].Cells[4].Value.ToString(), Convert.ToDecimal(dataGridView2.SelectedRows[0].Cells[5].Value.ToString()), Convert.ToDecimal(dataGridView2.SelectedRows[0].Cells[6].Value.ToString()), total, Convert.ToInt32(dataGridView2.SelectedRows[0].Cells[0].Value.ToString()), dataGridView2.SelectedRows[0].Cells[2].Value.ToString()); btnSUpdate.Enabled = false; this.inventory_stocksTableAdapter.Fill(this.npos_dbDataSet1.inventory_stocks); } catch (Exception) { MessageBox.Show("Please Check Your Encoded Data or Check Database Server is Active!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } trapDGV2(); } else { MessageBox.Show("Negative Value is not allowed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }