示例#1
0
        private void grid_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                DataGridView datagrid = this.dtTransactionDetailsList;
                Int64        index;
                Int64        colIndex;
                if (datagrid.RowCount > 0)
                {
                    transaction = new BIZ.Transaction();
                    index       = datagrid.CurrentRow.Index;
                    colIndex    = datagrid.CurrentCell.ColumnIndex;
                    if (colIndex == 5)
                    {
                        TransactionID = Convert.ToInt64(datagrid.Rows[Convert.ToInt32(index)].Cells[0].Value);
                        if (TransactionID > 0)
                        {
                            DataSet dtresult = new DataSet();
                            PopulateBLL();
                            dtresult = transaction.TransactionGetByKey();

                            if (dtresult.Tables.Count > 0)
                            {
                                if (dtresult.Tables[0].Rows.Count > 0)
                                {
                                    RecordSearched = dtresult.Tables[0];
                                    PopulateControl();
                                }
                            }
                            else
                            {
                                MessageBox.Show("No record is found", "Search");
                            }
                        }
                    }
                    else if (colIndex == 6)
                    {
                        TransactionID = Convert.ToInt64(datagrid.Rows[Convert.ToInt32(index)].Cells[0].Value);
                        if (TransactionID > 0)
                        {
                            if (MessageBox.Show("Are you sure you would like to delete this transaction?", "Delete Record", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                transaction.TransactionID = TransactionID;
                                transaction.TransactionDelete();
                                ClearControl();
                                TransactionGetByBillingNo();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(Common.Common.CustomError(ex.Message), "Error");
            }
        }