Exemple #1
0
        private void dgrdData_KeyDown(object sender, KeyEventArgs e)
        {
            const string METHOD_NAME = THIS + ".dgrdData_KeyDown()";

            try
            {
                switch (e.KeyCode)
                {
                case Keys.F4:
                    if (btnSave.Enabled)
                    {
                        dgrdData_ButtonClick(sender, null);
                    }
                    break;

                case Keys.Delete:
                    if ((e.KeyCode == Keys.Delete) && (dgrdData.SelectedRows.Count > 0))
                    {
                        if (btnSave.Enabled)
                        {
                            dgrdData.AllowDelete = true;
                            FormControlComponents.DeleteMultiRowsOnTrueDBGrid(dgrdData);
                            for (int i = 0; i < dgrdData.RowCount; i++)
                            {
                                if (dgrdData[i, ITM_ProductTable.PRODUCTID_FLD].ToString() != string.Empty)
                                {
                                    dgrdData[i, SEQUENCE_FLD] = i + 1;
                                }
                            }
                        }
                    }
                    break;
                }
            }
            catch (PCSException ex)
            {
                PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
                try
                {
                    Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION);
                }
            }
            catch (Exception ex)
            {
                PCSMessageBox.Show(ErrorCode.OTHER_ERROR);
                try
                {
                    Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
                }
                catch
                {
                    PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION);
                }
            }
        }