Exemplo n.º 1
0
        private void frmBuktiBankKeluar_KeyDown(object sender, KeyEventArgs e)
        {
            if (lblPetunjuk.Visible == true)
            {
                switch (e.KeyCode)
                {
                case Keys.Escape:

                    frmBukaGiro frm = new frmBukaGiro();
                    frm = (frmBukaGiro)this.Caller;
                    frm.RefreshBBK(_rowIDBBK);
                    frm.FindRowBBK("RowIDBBK", _rowIDBBK.ToString());


                    break;

                case Keys.Insert:

                    Kasir.frmBukaGiroDetailUpdate ifrmDetail1 = new Kasir.frmBukaGiroDetailUpdate(this, _rowIDBBK, txtKepada.Text, _BankID, false, _TglBBK);
                    Program.MainForm.RegisterChild(ifrmDetail1);
                    ifrmDetail1.ShowDialog();

                    break;

                case Keys.Space:
                    if (gridGiroIn.SelectedCells.Count == 0)
                    {
                        return;
                    }

                    _rowIDGiroIn = (Guid)gridGiroIn.SelectedCells[0].OwningRow.Cells["RowIDGiroIn"].Value;
                    _GiroID      = (Guid)gridGiroIn.SelectedCells[0].OwningRow.Cells["GiroID"].Value;
                    Kasir.frmBukaGiroDetailUpdate ifrmDetail2 = new Kasir.frmBukaGiroDetailUpdate(this, _rowIDBBK, _rowIDGiroIn, _GiroID, txtKepada.Text, _BankID, false, _TglBBK);
                    Program.MainForm.RegisterChild(ifrmDetail2);
                    ifrmDetail2.ShowDialog();

                    break;

                case Keys.Delete:
                    if (MessageBox.Show("Data Ini Akan Dihapus ?", "", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                    {
                        return;
                    }

                    DeleteGiroInternal();

                    #region "Tambahan"
                    int i = 0;
                    int n = 0;
                    i = gridGiroIn.SelectedCells[0].RowIndex;
                    n = gridGiroIn.SelectedCells[0].ColumnIndex;
                    DataRowView dv = (DataRowView)gridGiroIn.SelectedCells[0].OwningRow.DataBoundItem;

                    DataRow dr = dv.Row;

                    dr.Delete();
                    _dtGiroIn.AcceptChanges();
                    gridGiroIn.Focus();
                    gridGiroIn.RefreshEdit();
                    if (gridGiroIn.RowCount > 0)
                    {
                        if (i == 0)
                        {
                            gridGiroIn.CurrentCell = gridGiroIn.Rows[0].Cells[n];
                            gridGiroIn.RefreshEdit();
                        }
                        else
                        {
                            gridGiroIn.CurrentCell = gridGiroIn.Rows[i - 1].Cells[n];
                            gridGiroIn.RefreshEdit();
                        }
                    }
                    #endregion

                    frmBukaGiro frm2 = new frmBukaGiro();
                    frm2 = (frmBukaGiro)this.Caller;
                    frm2.FindRowGiroIn("RowIDGiroIn", _rowIDGiroIn.ToString());
                    frm2.refreshDeleteGiroIn();


                    break;
                }
            }
        }