Exemplo n.º 1
0
        /*------------------------- Button clicks that changes record or open forms------------------------------*/
        private void bookTimeBTN_Click(object sender, EventArgs e)
        {
            int selectedRow = HelperMethod.GetSelectedRowIndex(freeTimesDataGridView);

            if (selectedRow < 0)
            {
                return;
            }

            /*Load the data that will be in the booking*/
            int vetId    = (int)freeTimesDataGridView[0, selectedRow].Value;
            int animalId = (int)freeTimesDataGridView[3, selectedRow].Value;

            DateTime startDate = (DateTime)freeTimesDataGridView[1, selectedRow].Value;
            DateTime endDate   = (DateTime)freeTimesDataGridView[1, selectedRow].Value;

            //Add booking record
            _dataAccess.AddBooking(animalId, vetId, startDate, endDate);

            //Reload tables
            RefreshTables();
        }