Esempio n. 1
0
        private void BtnCancelReservedMedia_Click(object sender, EventArgs e)
        {
            if (activeReservationsViewRow == null)
            {
                MessageBox.Show("please select row correctly using selector column on the left.");
            }
            else
            {
                //RID == 0
                string myStrReserveId = activeReservationsViewRow.Cells[0].Value.ToString(); //initialy it is saved as an object
                bool   parseResult    = int.TryParse(myStrReserveId, out int reserveId);

                if (parseResult)
                {
                    //if(reservedLogic.deleteReservation(reserveId))
                    bool result = dtFunc.getBool(ws.deleteReservation(reserveId));
                    if (result)
                    {
                        MessageBox.Show("successfull reservation removed.");

                        //resfresh DGV
                        setDataForDataGridViews();
                        activeReservationsViewRow = null;  //reset active row value
                    }
                    else
                    {
                        MessageBox.Show("error reservation did not delete.");
                    }
                }
                else
                {
                    MessageBox.Show("could not convert str of reserveId to int for cancel reservation.");
                    return;
                }
            }
        }