Beispiel #1
0
        private void textBox_LotCode_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                textBox_LotCode.Text = "";
                textBox_LotCode.Text = scannedCode.ToString();
                scannedCode.Clear();

                using (conn = new SQLiteConnection(connStr))
                {
                    conn.Open();
                    codeCURD = new BarcodeReferenceCode_CRUD(conn);

                    BarcodeLotCodeInfo item = new BarcodeLotCodeInfo();
                    var id = codeCURD.GetMaxID(BarcodeReferenceCode_CRUD.Table.LOT_CODE) + 1;
                    item.ID      = id;
                    item.LotCode = textBox_LotCode.Text;

                    codeCURD.Insert(item);

                    ds = codeCURD.SelectAll_Dataset(BarcodeReferenceCode_CRUD.Table.LOT_CODE);
                    conn.Close();
                }

                DataGridViewRefreshBinding(BarcodeReferenceCode_CRUD.Table.LOT_CODE);
            }
            else
            {
                textBox_LotCode.Text = "";
                scannedCode.Append(KeyToUni.KeyCodeToUnicode(e.KeyCode).ToUpper());
            }
        }
Beispiel #2
0
        private void button_LotDelete_Click(object sender, EventArgs e)
        {
            var index = dataGridView.CurrentCell.RowIndex;
            var id    = dataGridView[0, index];
            var code  = dataGridView[1, index];

            BarcodeLotCodeInfo item = new BarcodeLotCodeInfo();

            item.ID      = (int)id.Value;
            item.LotCode = (string)code.Value;

            using (conn = new SQLiteConnection(connStr))
            {
                conn.Open();
                codeCURD = new BarcodeReferenceCode_CRUD(conn);
                codeCURD.Delete(item);
                ds = codeCURD.SelectAll_Dataset(BarcodeReferenceCode_CRUD.Table.LOT_CODE);
                conn.Close();
            }

            DataGridViewRefreshBinding(BarcodeReferenceCode_CRUD.Table.LOT_CODE);
        }