Пример #1
0
 private void creTextBox1_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == 13)
     {
         DataTable dataTable = get_services.getCustBySwipe(creTextBox1.Text);
         if (dataTable.Rows.Count > 0)
         {
             dataGridView1.DataSource = dataTable;
             selectRow = dataGridView1.Rows[0];
             for (int i = 0; i < View.Rows.Count; i++)
             {
                 if (selectRow.Cells[0].Value.ToString() == View.Rows[i][0].ToString())
                 {
                     RowIndex = i;
                     break;
                 }
             }
             this.DialogResult = DialogResult.OK;
         }
         else
         {
             creTextBox1.Text = "";
             creTextBox1.Focus();
         }
     }
 }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            FrmKeyBoard frmKeyBoard = new FrmKeyBoard(true);

            if (frmKeyBoard.ShowDialog() == DialogResult.OK)
            {
                DataTable dataTable = get_service.getCustBySwipe(frmKeyBoard.value);
                if (dataTable.Rows.Count > 0)
                {
                    Alert.Show("Thẻ từ đã tồn tại !", Color.Red);
                    return;
                }
                Persistence.CustomerSwipe customerSwipe = new CustomerSwipe(frmKeyBoard.value);
                customerSwipe.isNew = true;
                listBox1.Items.Add(customerSwipe);
                swipeList.Add(customerSwipe);
            }
        }