private void rent1Btn_Click(object sender, EventArgs e) { string upc = checkout1Txt.Text.Trim(' '); if (!Check.isUPC(upc)) { Prompt.enterUPC(); return; } if (!CopiesTable.hasCopy(upc)) { Prompt.notInDB("dvd", "UPC"); return; } if (!CopiesTable.isAvailable(upc)) { Prompt.copyUnavailable(); return; } string movie = MoviesTable.getMovieName(upc); currentDVD = new DVD(movie, upc); clearTextBoxes(rentPnl); setCurrentMainPanel(rent2Pnl); }
private void removeCopy1Btn_Click(object sender, EventArgs e) { string upc = removeCopy1Txt.Text.Trim(' '); if (!Check.areValidInputs(upc)) { Prompt.enterValidInput(); return; } if (!Check.isUPC(upc)) { Prompt.enterUPC(); return; } try { if (!CopiesTable.hasCopy(upc)) { Prompt.notInDB("dvd", "upc"); return; } if (RentalsTable.upcIsRenting(upc)) { Prompt.removalDependency("upc", "rental"); return; } CopiesTable.delete(upc); clearTextBoxes(removeCopyPnl); //exit to admin panel setCurrentMainPanel(adminPnl); } catch { RentalsTable.adapter.Dispose(); CopiesTable.adapter.Dispose(); Prompt.dbError(); } }
private void return1Btn_Click(object sender, EventArgs e) { string upc = return1Txt.Text.Trim(' '); if (!Check.areValidInputs(upc)) { Prompt.enterValidInput(); return; } if (!Check.isUPC(upc)) { Prompt.enterUPC(); return; } try { if (!CopiesTable.hasCopy(upc)) { Prompt.notInDB("dvd", "UPC"); return; } if (CopiesTable.isAvailable(upc)) { Prompt.cantReturn(); return; } RentalsTable.returnMovie(upc); CopiesTable.makeAvailable(upc); clearTextBoxes(returnPnl); }catch { RentalsTable.adapter.Dispose(); CopiesTable.adapter.Dispose(); Prompt.dbError(); } }