Пример #1
0
        // Proceed to checkout
        private void btnCart_Click(object sender, EventArgs e)
        {
            double subTotal = 0, price = 0;
            string id       = "";
            string xboxType = "Xbox360";
            string ps3Type  = "PS3";
            string wiiType  = "Wii";

            if (cbCODX.Checked)
            {
                Xbox360.GetGameRecord(lblCODX.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblCODX.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(xboxType);
            }

            if (cbHalo.Checked)
            {
                Xbox360.GetGameRecord(lblHalo.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblHalo.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(xboxType);
            }

            if (cbNBA.Checked)
            {
                Xbox360.GetGameRecord(lblNBA.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblNBA.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(xboxType);
            }

            if (cbFIFA.Checked)
            {
                Xbox360.GetGameRecord(lblFIFA.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblFIFA.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(xboxType);
            }

            if (cbGTA.Checked)
            {
                Xbox360.GetGameRecord(lblGTA.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblGTA.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(xboxType);
            }

            if (cbGodOfWar.Checked)
            {
                Ps3.GetGameRecord(lblGodOfWar.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblGodOfWar.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(ps3Type);
            }

            if (cbResidentEvil.Checked)
            {
                Ps3.GetGameRecord(lblResidentEvil.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblResidentEvil.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(ps3Type);
            }

            if (cbAssassinsCreed.Checked)
            {
                Ps3.GetGameRecord(lblAssassinsCreed.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblAssassinsCreed.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(ps3Type);
            }

            if (cbCODP.Checked)
            {
                Ps3.GetGameRecord(lblCODP.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblCODP.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(ps3Type);
            }

            if (cbMaxPayne.Checked)
            {
                Ps3.GetGameRecord(lblMaxPayne.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblMaxPayne.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(ps3Type);
            }

            if (cbSuperMario.Checked)
            {
                Wii.GetGameRecord(lblSuperMario.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblSuperMario.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(wiiType);
            }

            if (cbZelda.Checked)
            {
                Wii.GetGameRecord(lblZelda.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblZelda.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(wiiType);
            }

            if (cbMadagascar.Checked)
            {
                Wii.GetGameRecord(lblMadagascar.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblMadagascar.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(wiiType);
            }

            if (cbSpiderman.Checked)
            {
                Wii.GetGameRecord(lblSpiderman.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblSpiderman.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(wiiType);
            }

            if (cbJustDance.Checked)
            {
                Wii.GetGameRecord(lblJustDance.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblJustDance.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(wiiType);
            }

            frmYourCart thirdForm = new frmYourCart();

            thirdForm.GetInvoice  = Invoice;
            thirdForm.GetSubTotal = subTotal;
            thirdForm.GetUserName = userName;
            thirdForm.GetCount    = Invoice.GetTitle().Count;

            //Send to review order form
            frmReviewOrder fifthForm = new frmReviewOrder();

            fifthForm.GetTotalCost = subTotal;
            fifthForm.GetUserName  = userName;

            thirdForm.Show();
            this.Hide();
        }
Пример #2
0
        // Proceed to checkout
        private void btnCart_Click(object sender, EventArgs e)
        {
            double subTotal = 0, price = 0;
            string id = "";
            string xboxType = "Xbox360";
            string ps3Type = "PS3";
            string wiiType = "Wii";

            if (cbCODX.Checked)
            {
                Xbox360.GetGameRecord(lblCODX.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblCODX.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(xboxType);
            }

            if (cbHalo.Checked)
            {
                Xbox360.GetGameRecord(lblHalo.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblHalo.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(xboxType);
            }

            if (cbNBA.Checked)
            {
                Xbox360.GetGameRecord(lblNBA.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblNBA.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(xboxType);
            }

            if (cbFIFA.Checked)
            {
                Xbox360.GetGameRecord(lblFIFA.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblFIFA.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(xboxType);
            }

            if (cbGTA.Checked)
            {
                Xbox360.GetGameRecord(lblGTA.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblGTA.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(xboxType);
            }

            if (cbGodOfWar.Checked)
            {
                Ps3.GetGameRecord(lblGodOfWar.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblGodOfWar.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(ps3Type);
            }

            if (cbResidentEvil.Checked)
            {
                Ps3.GetGameRecord(lblResidentEvil.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblResidentEvil.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(ps3Type);
            }

            if (cbAssassinsCreed.Checked)
            {
                Ps3.GetGameRecord(lblAssassinsCreed.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblAssassinsCreed.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(ps3Type);
            }

            if (cbCODP.Checked)
            {
                Ps3.GetGameRecord(lblCODP.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblCODP.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(ps3Type);
            }

            if (cbMaxPayne.Checked)
            {
                Ps3.GetGameRecord(lblMaxPayne.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblMaxPayne.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(ps3Type);
            }

            if (cbSuperMario.Checked)
            {
                Wii.GetGameRecord(lblSuperMario.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblSuperMario.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(wiiType);
            }

            if (cbZelda.Checked)
            {
                Wii.GetGameRecord(lblZelda.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblZelda.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(wiiType);
            }

            if (cbMadagascar.Checked)
            {
                Wii.GetGameRecord(lblMadagascar.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblMadagascar.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(wiiType);
            }

            if (cbSpiderman.Checked)
            {
                Wii.GetGameRecord(lblSpiderman.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblSpiderman.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(wiiType);
            }

            if (cbJustDance.Checked)
            {
                Wii.GetGameRecord(lblJustDance.Text, ref price, ref id, ref subTotal);
                Invoice.SetTitle(lblJustDance.Text);
                Invoice.SetId(id);
                Invoice.SetPrice(price);
                Invoice.SetConsole(wiiType);
            }

            frmYourCart thirdForm = new frmYourCart();
            thirdForm.GetInvoice = Invoice;
            thirdForm.GetSubTotal = subTotal;
            thirdForm.GetUserName = userName;
            thirdForm.GetCount = Invoice.GetTitle().Count;

            //Send to review order form
            frmReviewOrder fifthForm = new frmReviewOrder();
            fifthForm.GetTotalCost = subTotal;
            fifthForm.GetUserName = userName;

            thirdForm.Show();
            this.Hide();
        }
Пример #3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            //declare variables for shipping adress
            string firstName, middleName, lastName, stAdress, city, state, zipCode;

            //declare variables for billing information
            string creditCardType, monthExpDate, yearExpDate, creditCardNumber, securityCode;
            const string blank = "";
            bool itemMissing = false;
            const int CREDITCARDLENGTH= 16;

            firstName = txtFirstName.Text;
            middleName = txtMiddleName.Text;
            lastName = txtLastName.Text;
            stAdress = txtAddress.Text;
            city = txtCity.Text;
            state = txtState.Text;
            zipCode = txtZipCode.Text;

            creditCardNumber = txtCreditCardNumber.Text;
            creditCardType = cbCardType.Text;
            securityCode = txtSecurityCode.Text;
            monthExpDate = cbMonth.Text;
            yearExpDate = cbYear.Text;

            if (firstName == blank)
            {
                MessageBox.Show("Please enter your first name");
                itemMissing = false;
                txtFirstName.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtFirstName.BackColor = Color.White;
            }

            if (middleName == blank)
            {
                MessageBox.Show("Please enter your middle initial");
                itemMissing = false;
                txtMiddleName.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtMiddleName.BackColor = Color.White;
            }
            if (lastName == blank)
            {
                MessageBox.Show("Please enter your last name");
                itemMissing = false;
                txtLastName.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtLastName.BackColor = Color.White;
            }
            if (stAdress == blank)
            {
                MessageBox.Show("Please enter your Street adress");
                itemMissing = false;
                txtAddress.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtAddress.BackColor = Color.White;
            }
            if (city == blank)
            {
                MessageBox.Show("Please enter your city");
                itemMissing = false;
                txtCity.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtCity.BackColor = Color.White;
            }
            if (state == blank)
            {
                MessageBox.Show("Please enter your state");
                itemMissing = false;
                txtState.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtState.BackColor = Color.White;
            }
            if (zipCode == blank)
            {
                MessageBox.Show("Please enter your zip code");
                itemMissing = false;
                txtZipCode.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtZipCode.BackColor = Color.White;
            }
            if (cbCardType.SelectedIndex == -1)
            {
                MessageBox.Show("Your credit card type is blank. Please select a valid credit card");
                itemMissing = false;
                cbCardType.BackColor = Color.PaleVioletRed;
            }
            else
            {
                cbCardType.BackColor = Color.White;
            }
            if (creditCardNumber.Length < CREDITCARDLENGTH)
            {
                MessageBox.Show("Your credit card number must be 16 digits. Please enter a valid credit card number");
                itemMissing = false;
                txtCreditCardNumber.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtCreditCardNumber.BackColor = Color.White;
            }
            if (cbMonth.SelectedIndex == -1)
            {
                MessageBox.Show("Your credit card month is blank. Please select a month");
                itemMissing = false;
                cbMonth.BackColor = Color.PaleVioletRed;
            }
            else
            {
                cbMonth.BackColor = Color.White;
            }
            if (cbYear.SelectedIndex == -1)
            {
                MessageBox.Show("Your credit card year is blank. Please select a year");
                itemMissing = false;
                cbYear.BackColor = Color.PaleVioletRed;
            }
            else
            {
                cbYear.BackColor = Color.White;
            }
            if (securityCode == blank)
            {
                MessageBox.Show("Your credit card security code is blank. Please enter your credit cards security code");
                itemMissing = false;
                txtSecurityCode.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtSecurityCode.BackColor = Color.White;
            }
            while (itemMissing)
                {
                    MessageBox.Show("One or more fields are missing.");
                }

            if (firstName != blank && middleName != blank && lastName != blank && stAdress != blank && city != blank && state != blank && zipCode != blank && creditCardNumber != blank && creditCardType != blank && securityCode != blank && monthExpDate != blank && yearExpDate != blank)
                {
                    itemMissing = true;
                    if (itemMissing)
                    {

                        FileStream outfile4 = new FileStream("CustomersShippingAndPaymentInfo.txt", FileMode.Create, FileAccess.Write);
                        StreamWriter writer4 = new StreamWriter(outfile4);
                        FileStream outFile = new FileStream("result.txt", FileMode.Append, FileAccess.Write);
                        StreamWriter writer = new StreamWriter(outFile);

                        writer4.WriteLine(firstName);
                        writer4.WriteLine(middleName);
                        writer4.WriteLine(lastName);
                        writer4.WriteLine(stAdress);
                        writer4.WriteLine(city);
                        writer4.WriteLine(state);
                        writer4.WriteLine(Convert.ToString(zipCode));

                        writer4.WriteLine(Convert.ToString(creditCardNumber));
                        writer4.WriteLine(creditCardType);
                        writer4.WriteLine(monthExpDate);
                        writer4.WriteLine(Convert.ToString(yearExpDate));

                        writer.WriteLine(firstName);
                        writer.WriteLine(lastName);

                        writer4.Close();
                        outfile4.Close();
                        writer.Close();
                        outFile.Close();

                        frmReviewOrder fifthForm = new frmReviewOrder();
                        fifthForm.Show();
                        this.Hide();
                    }
                }
        }
Пример #4
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            //declare variables for shipping adress
            string firstName, middleName, lastName, stAdress, city, state, zipCode;

            //declare variables for billing information
            string       creditCardType, monthExpDate, yearExpDate, creditCardNumber, securityCode;
            const string blank            = "";
            bool         itemMissing      = false;
            const int    CREDITCARDLENGTH = 16;


            firstName  = txtFirstName.Text;
            middleName = txtMiddleName.Text;
            lastName   = txtLastName.Text;
            stAdress   = txtAddress.Text;
            city       = txtCity.Text;
            state      = txtState.Text;
            zipCode    = txtZipCode.Text;

            creditCardNumber = txtCreditCardNumber.Text;
            creditCardType   = cbCardType.Text;
            securityCode     = txtSecurityCode.Text;
            monthExpDate     = cbMonth.Text;
            yearExpDate      = cbYear.Text;

            if (firstName == blank)
            {
                MessageBox.Show("Please enter your first name");
                itemMissing            = false;
                txtFirstName.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtFirstName.BackColor = Color.White;
            }

            if (middleName == blank)
            {
                MessageBox.Show("Please enter your middle initial");
                itemMissing             = false;
                txtMiddleName.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtMiddleName.BackColor = Color.White;
            }
            if (lastName == blank)
            {
                MessageBox.Show("Please enter your last name");
                itemMissing           = false;
                txtLastName.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtLastName.BackColor = Color.White;
            }
            if (stAdress == blank)
            {
                MessageBox.Show("Please enter your Street adress");
                itemMissing          = false;
                txtAddress.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtAddress.BackColor = Color.White;
            }
            if (city == blank)
            {
                MessageBox.Show("Please enter your city");
                itemMissing       = false;
                txtCity.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtCity.BackColor = Color.White;
            }
            if (state == blank)
            {
                MessageBox.Show("Please enter your state");
                itemMissing        = false;
                txtState.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtState.BackColor = Color.White;
            }
            if (zipCode == blank)
            {
                MessageBox.Show("Please enter your zip code");
                itemMissing          = false;
                txtZipCode.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtZipCode.BackColor = Color.White;
            }
            if (cbCardType.SelectedIndex == -1)
            {
                MessageBox.Show("Your credit card type is blank. Please select a valid credit card");
                itemMissing          = false;
                cbCardType.BackColor = Color.PaleVioletRed;
            }
            else
            {
                cbCardType.BackColor = Color.White;
            }
            if (creditCardNumber.Length < CREDITCARDLENGTH)
            {
                MessageBox.Show("Your credit card number must be 16 digits. Please enter a valid credit card number");
                itemMissing = false;
                txtCreditCardNumber.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtCreditCardNumber.BackColor = Color.White;
            }
            if (cbMonth.SelectedIndex == -1)
            {
                MessageBox.Show("Your credit card month is blank. Please select a month");
                itemMissing       = false;
                cbMonth.BackColor = Color.PaleVioletRed;
            }
            else
            {
                cbMonth.BackColor = Color.White;
            }
            if (cbYear.SelectedIndex == -1)
            {
                MessageBox.Show("Your credit card year is blank. Please select a year");
                itemMissing      = false;
                cbYear.BackColor = Color.PaleVioletRed;
            }
            else
            {
                cbYear.BackColor = Color.White;
            }
            if (securityCode == blank)
            {
                MessageBox.Show("Your credit card security code is blank. Please enter your credit cards security code");
                itemMissing = false;
                txtSecurityCode.BackColor = Color.PaleVioletRed;
            }
            else
            {
                txtSecurityCode.BackColor = Color.White;
            }
            while (itemMissing)
            {
                MessageBox.Show("One or more fields are missing.");
            }

            if (firstName != blank && middleName != blank && lastName != blank && stAdress != blank && city != blank && state != blank && zipCode != blank && creditCardNumber != blank && creditCardType != blank && securityCode != blank && monthExpDate != blank && yearExpDate != blank)
            {
                itemMissing = true;
                if (itemMissing)
                {
                    FileStream   outfile4 = new FileStream("CustomersShippingAndPaymentInfo.txt", FileMode.Create, FileAccess.Write);
                    StreamWriter writer4  = new StreamWriter(outfile4);
                    FileStream   outFile  = new FileStream("result.txt", FileMode.Append, FileAccess.Write);
                    StreamWriter writer   = new StreamWriter(outFile);

                    writer4.WriteLine(firstName);
                    writer4.WriteLine(middleName);
                    writer4.WriteLine(lastName);
                    writer4.WriteLine(stAdress);
                    writer4.WriteLine(city);
                    writer4.WriteLine(state);
                    writer4.WriteLine(Convert.ToString(zipCode));

                    writer4.WriteLine(Convert.ToString(creditCardNumber));
                    writer4.WriteLine(creditCardType);
                    writer4.WriteLine(monthExpDate);
                    writer4.WriteLine(Convert.ToString(yearExpDate));

                    writer.WriteLine(firstName);
                    writer.WriteLine(lastName);

                    writer4.Close();
                    outfile4.Close();
                    writer.Close();
                    outFile.Close();

                    frmReviewOrder fifthForm = new frmReviewOrder();
                    fifthForm.Show();
                    this.Hide();
                }
            }
        }