//
//Matt Iwan
//CSC-236001
// Movie Rental Program 2
// Add A Store Summary and Rental Summary to calculate the
// Amount Due Tax, After Discount Income and # of Customers Served
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MattIwanRentalStore
{
public partial class FrmMovieRental3 : Form
{
public FrmMovieRental3()
{
InitializeComponent();
}
/* Proj3changes & Calculation Steps
*
* Movie Rental Amount will Now display the cost of the format when Radio Buttons are selected and add's New Release
*
* -Calculation Steps-
* gbRentalSummary Calculation:
*
* 1.RentalAmount[lblRentAmt] Displays Amount from format and New release(If checked)
* 2. Add A Total Amount from Selected Format & Movie Quantity (SubTotal) A.K.A Before Discount Cost
* 3.If user enters a Member #, It will check the is Member CB and Discount will apply
* 4.Final Cost will Be Displayed With/Without Discount
*
* -Store Income-
* 5. Total customers[lblTotCost] - is determined by the Calculate Click Event| Increments per click [vCustServed]
* 6. Store Income[lblStoreIncome] - Lifetime view of Order income (After Discount)| Added from: [vStoreIncome]
*/
//Arrays
// Movie Name
//Format
//RentAmount
//Constants
const double CDISCOUNT = .10d;
const double CMOVDVD = 4.50d;
const double CMOVBD = 5.00d;
const double CNEWRELEASE = 1.00d;
//Variables
int vCustServd = 0;
double vAmtDue = 0;
double vStoreIncome = 0;
double vRentalTotal = 0;
int vMovieQuant = 0;
double vAddNewRelease = 1.00d;
//Project3 Variables
double vSubTotal = 0d;
string txtScratch = " ";
string so = " ";
private void btnSubmit_Click(object sender, EventArgs e)
{
if (txtSearch.Text == string.Empty)
{
MessageBox.Show("You need to enter a movie title", "Missing Characters");
}
else
{
vMovieQuant += 1;
lblMovieQuant.Text = vMovieQuant.ToString();
MessageBox.Show("Request Accepted");
txtSearch.Text = string.Empty;
}
//Sub Total
vSubTotal = vRentalTotal;
lblSubTotal.Text = vSubTotal.ToString("C");
}
// ***Disabled***
/* private void btnClear_Click(object sender, EventArgs e)
{
txtSearch.Clear();
vMovieQuant -= 1;
lblMovieQuant.Text = vMovieQuant.ToString();
}
*/
private void btnAbout_Click(object sender, EventArgs e)
{
MessageBox.Show("Matt Iwan CSC 236-001 Movie Rental Project");
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void btnCalculate_Click(object sender, EventArgs e)
{
//Rental Amount
// 1.Displays Format & New release( If Checked) Cost
//2. Total of Selected Movies(SubTotal)
// DVD || BD * MovieQuant
//Discount
lblDiscount.Text = CDISCOUNT.ToString("P");
// Total Amount
vAmtDue = vRentalTotal;
lblTotal.Text = vRentalTotal.ToString("C");
//Store GroupBox
//Customers Served
vCustServd += 1;
lblTotCust.Text = vCustServd.ToString();
//Store Income
vStoreIncome = vRentalTotal;
lblStoreIncome.Text = vStoreIncome.ToString("C");
}
private void btnSumClear_Click(object sender, EventArgs e)
{
lblMovieQuant.Text = null;
lblDiscount.Text = null;
lblRentalAmt.Text = null;
lblTotal.Text = null;
lblStoreIncome.Text = null;
lblTotCust.Text = null;
lblSubTotal.Text = null;
}
private double Calculate (bool BDMovietype,
bool DVDMovietype,
bool Member,
bool NewRelease)
{
BDMovietype = rbBluRay.Checked;
DVDMovietype = rbDVD.Checked;
Member = cbIsMember.Checked;
NewRelease= cbNewRelease.Checked;
if (DVDMovietype == true)
{
vRentalTotal = CMOVDVD;
}
else if (BDMovietype == true)
{
vRentalTotal = CMOVBD;
}
else
{
}
if(Member == true)
{
vAmtDue = vRentalTotal * CDISCOUNT;
vAmtDue = vRentalTotal - vAmtDue;
}
if (NewRelease == true)
{
vAddNewRelease = vRentalTotal += CNEWRELEASE;
}
}
private void rbDVD_CheckedChanged(object sender, EventArgs e)
{
RadioButton rbDVD = (RadioButton)sender;
return Calculate();
lblRentalAmt.Text = CMOVDVD.ToString("C");
}
private void rbBluRay_CheckedChanged(object sender, EventArgs e)
{
RadioButton rbBluRay = (RadioButton)sender;
return Calculate(CMOVBD);
lblRentalAmt.Text = CMOVBD.ToString("C");
}
private void cbNewRelease_CheckedChanged(object sender, EventArgs e)
{
return Calculate(vAddNewRelease);
lblRentalAmt.Text = vAddNewRelease.ToString("C");
}
private void cbIsMember_CheckedChanged(object sender, EventArgs e)
{
if (cbIsMember.Checked)
{
lblTotal.Text = vAmtDue.ToString("C");
lblDiscount.Visible = true;
cbIsMember.Enabled = false;
}
}
private void btnOrdCom_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Confirm", "Confirm") == DialogResult.OK)
{
MessageBox.Show("Thankyou");
}
//If btnOrdCom is clicked then cbIsMember enabled and unchecked
if (cbIsMember.Enabled == false)
{
cbIsMember.Enabled = true;
cbIsMember.Checked = false;
lblMovieQuant.Text = null;
lblDiscount.Text = null;
lblRentalAmt.Text = null;
lblTotal.Text = null;
lblStoreIncome.Text = null;
lblTotCust.Text = null;
lblSubTotal.Text = null;
txtSearch.Text = string.Empty;
cbNewRelease.Checked = false;
rbDVD.Checked = false;
rbBluRay.Checked = false;
}
}
private void BtnClrNxt_Click(object sender, EventArgs e)
{
txtSearch.Text = string.Empty;
cbNewRelease.Checked = false;
rbDVD.Checked = false;
rbBluRay.Checked = false;
}
}
}
Can somebody help???

New Topic/Question
This topic is locked




MultiQuote






|