Esempio n. 1
0
        //btns

        private void BtnReturnMedia_Click(object sender, EventArgs e)
        {
            if (activeBookingsViewRow == null)
            {
                MessageBox.Show("please select row correctly using selector column on the left.");
            }
            else
            {
                //BID == 0
                string myStrBorrowId = activeBookingsViewRow.Cells[0].Value.ToString(); //initialy it is saved as an object
                bool   parseResult   = int.TryParse(myStrBorrowId, out int borrowId);

                // set late fee
                // currently hardcoded $10
                int lateFee = 10;

                if (parseResult)
                {
                    //if (borrowLogic.updateMediaForReturn(borrowId, lateFee))

                    bool result = dtFunc.getBool(ws.updateMediaForReturn(borrowId, lateFee));
                    if (result)
                    {
                        MessageBox.Show("successfull media returned.");

                        //resfresh DGV
                        setDataForDataGridViews();
                        activeBookingsViewRow = null;  //reset active row value
                    }
                    else
                    {
                        MessageBox.Show("error media not returned on update.");
                    }
                }
                else
                {
                    MessageBox.Show("could not convert str of borrowId to int for media Return.");
                    return;
                }
            }
        }