private void btnSave_Click(object sender, EventArgs e) { Listing[] viewListings = new Listing[100]; viewListing.listingID = txtboxListingID.Text; viewListing.address = txtboxAddress.Text; viewListing.listingEndDate = txtboxEndDate.Text; viewListing.rentalAmount = txtboxRentAmount.Text; viewListing.ownerEmail = txtboxOwnerEmail.Text; StreamWriter outfile = new StreamWriter("listings.txt", true); //("output.txt", true) use if you want to append outfile.WriteLine(viewListing.listingID + "#" + viewListing.address + "#" + viewListing.listingEndDate + "#" + viewListing.rentalAmount + "#" + viewListing.ownerEmail); // " should show student"); outfile.Close(); this.Close(); //int deleteID = listingUtils.SearchByID(searchVal); //listingUtils.DeleteListing(deleteID); DialogResult dialogResult = MessageBox.Show("Report saved.", "Save", MessageBoxButtons.OK); formListings showListings = new formListings(); if (showListings.ShowDialog() == DialogResult.OK) { } else { //LoadList(); } this.Close(); }
private void btnRent_Click(object sender, EventArgs e) { Listing viewListing = (Listing)listboxListings.SelectedItem; txtboxListingID.Text = viewListing.listingID; txtboxRentAmount.Text = viewListing.rentalAmount; txtboxOwnerEmail.Text = viewListing.ownerEmail; Transaction viewTransaction = new Transaction(); int remove = int.Parse(viewListing.listingID); listingUtils.DeleteListing(remove); //Transaction viewTransaction = (Transaction)listboxListings.SelectedItem; //Transaction viewTransaction = (Transaction)listboxListings.SelectedItem; formTransaction currentTransaction = new formTransaction(viewTransaction, viewListing.listingID, viewListing.rentalAmount, viewListing.ownerEmail); if (currentTransaction.ShowDialog() == DialogResult.OK) { } else { // LoadList(); } formListings updateListing = new formListings(); if (updateListing.ShowDialog() == DialogResult.OK) { } }
private void btnDelete_Click(object sender, EventArgs e) { Listing viewListing = (Listing)listboxListings.SelectedItem; string searchVal = viewListing.listingID; int deleteID = listingUtils.SearchByID(searchVal); listingUtils.DeleteListing(deleteID); listingUtils.GetAllListing(); DialogResult dialogResult = MessageBox.Show("Are you sure you would like to delete this listing?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { this.Close(); } else { LoadList(); } formListings showListings = new formListings(); if (showListings.ShowDialog() == DialogResult.OK) { } else { //LoadList(); } }
private void btnListings_Click_1(object sender, EventArgs e) { formListings showListings = new formListings(); if (showListings.ShowDialog() == DialogResult.OK) { } }