Beispiel #1
0
 private void ListDataGrid_CurrentCellKeyDown(object sender, CurrentCellKeyEventArgs e)
 {
     if (e.KeyEventArgs.KeyCode == Keys.Enter)
     {
         e.KeyEventArgs.Handled = true;
     }
 }
Beispiel #2
0
        private void _view_OnListDataGridCurrentCellKeyDown(object sender, CurrentCellKeyEventArgs e)
        {
            if (e.KeyEventArgs.KeyCode == Keys.Return)
            {
                switch (e.ColumnIndex)
                {
                case 1: // Kode

                    _view_OnListDataGridCellKodeKeyDown(sender, e);

                    break;

                case 3: // Qty

                    _view_OnListDataGridCellQtyKeyDown(sender, e);

                    break;

                case 5: // HPP

                    _view_OnListDataGridCellHppKeyDown(sender, e);

                    break;
                }
            }
        }
Beispiel #3
0
        private void _view_OnListDataGridCellQtyKeyDown(object sender, CurrentCellKeyEventArgs e)
        {
            var listDataGrid = _view.ListDataGrid;

            if (CurrCellValue != null)
            {
                if (int.Parse(CurrCellValue.ToString(), NumberStyles.Number) > 0)
                {
                    listDataGrid.MoveToCurrentCell(new RowColumnIndex(CurrCellRowIndex, (e.ColumnIndex + 2)));
                    listDataGrid.CurrentCell.BeginEdit();
                }
            }

            e.KeyEventArgs.Handled = true;
        }
Beispiel #4
0
        private void _view_OnListDataGridCellHppKeyDown(object sender, CurrentCellKeyEventArgs e)
        {
            var listDataGrid = _view.ListDataGrid;

            if (CurrCellValue != null)
            {
                if (CurrCellRowIndex != (listDataGrid.RowCount - 1))
                {
                    listDataGrid.MoveToCurrentCell(new RowColumnIndex((CurrCellRowIndex + 1), 1));
                    listDataGrid.CurrentCell.BeginEdit();

                    e.KeyEventArgs.Handled = true;
                }
                else
                {
                    _listsPembelianDetails.Add(new PembelianDetailModel());
                    listDataGrid.MoveToCurrentCell(new RowColumnIndex((CurrCellRowIndex + 1), 1));
                    listDataGrid.CurrentCell.BeginEdit();
                }
            }
        }
        private void _view_OnListDataGridCellQtyKeyDown(object sender, CurrentCellKeyEventArgs e)
        {
            var listDataGrid = _view.ListDataGrid;

            if (CurrCellValue != null)
            {
                if (CurrCellRowIndex != (listDataGrid.RowCount - 1))
                {
                    if (decimal.Parse(CurrCellValue.ToString(), NumberStyles.Number) > 0)
                    {
                        listDataGrid.MoveToCurrentCell(new RowColumnIndex((CurrCellRowIndex + 1), 1));
                        listDataGrid.CurrentCell.BeginEdit();
                    }

                    e.KeyEventArgs.Handled = true;
                }
                else
                {
                    _listPenjualanDetails.Add(new PenjualanDetailModel());
                    listDataGrid.MoveToCurrentCell(new RowColumnIndex((CurrCellRowIndex + 1), 1));
                    listDataGrid.CurrentCell.BeginEdit();
                }
            }
        }
        private void _view_OnListDataGridCellKodeKeyDown(object sender, CurrentCellKeyEventArgs e)
        {
            var listDataGrid = _view.ListDataGrid;

            if (CurrCellValue != null)
            {
                var kode        = CurrCellValue.ToString();
                var barangModel = _listsBarangs.Where(b => b.kode.Equals(kode)).FirstOrDefault();

                if (barangModel != null)
                {
                    _listPenjualanDetails[(CurrCellRowIndex - 1)].Barang     = barangModel;
                    _listPenjualanDetails[(CurrCellRowIndex - 1)].qty        = 1;
                    _listPenjualanDetails[(CurrCellRowIndex - 1)].harga_jual = barangModel.harga_jual;

                    listDataGrid.MoveToCurrentCell(new RowColumnIndex(CurrCellRowIndex, (e.ColumnIndex + 2)));
                    listDataGrid.CurrentCell.BeginEdit();
                    e.KeyEventArgs.Handled = true;
                }
                else
                {
                    if (!string.IsNullOrWhiteSpace(CurrCellValue.ToString()))
                    {
                        _kodeOrNamaForSearching = CurrCellValue.ToString();
                        _view_OnCariData(null, null);
                    }
                    else
                    {
                        _kodeOrNamaForSearching = "";
                        _view_OnCariData(null, null);
                    }

                    e.KeyEventArgs.Handled = true;
                }
            }
        }
 private void ListDataGrid_CurrentCellKeyDown(object sender, CurrentCellKeyEventArgs e)
 {
     OnListDataGridCurrentCellKeyDown?.Invoke(sender, e);
 }