Exemplo n.º 1
0
        private void addRentalRecordToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var addRentalRecord = new AddEditRentalRecord();

            addRentalRecord.ShowDialog();
            addRentalRecord.MdiParent = this;
        }
Exemplo n.º 2
0
        private void btnAddRecord_Click(object sender, EventArgs e)
        {
            var addRentalRecord = new AddEditRentalRecord {
                MdiParent = this.MdiParent
            };

            addRentalRecord.Show();
        }
Exemplo n.º 3
0
        private void btnEditRecord_Click(object sender, EventArgs e)
        {
            try
            {
                //get ID of selected row
                var id = (int)gvRecordList.SelectedRows[0].Cells["Id"].Value;

                //query database for recoed
                var record = _db.CarRentalRecords.FirstOrDefault(q => q.id == id);

                var addEditRentalRecord = new AddEditRentalRecord(record);
                addEditRentalRecord.MdiParent = this.MdiParent;
                addEditRentalRecord.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show($"EditError: {ex.Message}");
            }
        }