private void reserveMediaToUser(int userId) { //check if user exists User curUser = dtFunc.getOneUserFromDt(ws.getUserById(userId)); //User curUser = userLogic.getUserById(userId); //sets user id to -1 if error if (curUser.Id == -1) { //ERROR couldent get user by their id MessageBox.Show("unable to find current user in list"); return; } //checker bool bool result = false; if (activeMediaViewRow == null) { MessageBox.Show("Please select the selector row on the left of the data view"); return; } //get selected media data string mIdAsStr = activeMediaViewRow.Cells[0].Value.ToString(); //if mediaId parse worked correctly result = int.TryParse(mIdAsStr, out int mediaId); //try parse idAsStr to int id if (!result) { MessageBox.Show("checkOut Error: could not parse mediaIdStr to mediaIdInt "); return; } //get selected dateMonthDayString string dateMonthDayYear = TextBoxReserveDate.Text; //check to see if reservation is available //result = borrowLogic.getIsMediaAvailable(mediaId); result = true; //TODO @@@@@@@ Media always available @@@@@@@@@ //if media is already reserved if (result) { result = dtFunc.getBool(ws.insertNewReservation(userId, mediaId, dateMonthDayYear)); //result = reservedLogic.insertNewReservation(userId, mediaId, dateMonthDayYear); //monthDayYear format == "04-20-2020" == mm-dd-yyyy //if checkOut went smoothly if (result) { MessageBox.Show("successfully reserved media."); } else { MessageBox.Show("error creating reservation."); } } else { MessageBox.Show("Reserve Item is not currently available"); } }