示例#1
0
        private void dataGridTransaction_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            String colName = dataGridTransaction.Columns[e.ColumnIndex].Name;

            if (colName == "Delete")
            {
                if (e.RowIndex >= 0)
                {
                    pos.deleteData(dataGridTransaction.Rows[e.RowIndex].Cells[0].Value.ToString(), this);
                    dataGridTransaction.Rows.RemoveAt(dataGridTransaction.Rows[e.RowIndex].Cells[0].RowIndex);
                    tableShow();
                }
            }

            if (colName == "addqty")
            {
                pos.addQty(dataGridTransaction.Rows[e.RowIndex].Cells[1].Value.ToString(),
                           Transactionlbl.Text,
                           Double.Parse(dataGridTransaction.Rows[e.RowIndex].Cells[5].Value.ToString()),
                           int.Parse(dataGridTransaction.Rows[e.RowIndex].Cells[4].Value.ToString()),
                           int.Parse(txtQty.Text),
                           Double.Parse(dataGridTransaction.Rows[e.RowIndex].Cells[3].Value.ToString()));
                tableShow();
            }

            if (colName == "removeqty")
            {
                pos.removeQty(dataGridTransaction.Rows[e.RowIndex].Cells[1].Value.ToString(),
                              Transactionlbl.Text,
                              Double.Parse(dataGridTransaction.Rows[e.RowIndex].Cells[5].Value.ToString()),
                              int.Parse(txtQty.Text),
                              Double.Parse(dataGridTransaction.Rows[e.RowIndex].Cells[3].Value.ToString()));
                tableShow();
            }
        }