Beispiel #1
0
        private void btnPurchase_Click(object sender, EventArgs e)
        {
            if (txtLastB.Text != "" && txtFirstB.Text != "" && cmbCardType.Text != "" &&
                txtCardNum.Text != "" && cmbMonth.Text != "" && cmbYear.Text != "" &&
                txtSecCode.Text != "" && txtAddressB.Text != "" && txtCityB.Text != "" &&
                txtZipB.Text != "" && cmbStateB.Text != "" && txtPhoneB.Text != "" &&
                txtLastS.Text != "" && txtFirstS.Text != "" && txtAddressS.Text != "" && txtCityS.Text != "" &&
                txtZipS.Text != "" && cmbStateS.Text != "" && txtPhoneS.Text != "")
            {
                //creating file stream to create an order
                FileStream   outFile = new FileStream("Order.txt", FileMode.Create, FileAccess.Write);
                StreamWriter writer  = new StreamWriter(outFile);

                //recording data to text file and go to confirm purchase page


                writer.WriteLine(txtLastB.Text);
                writer.WriteLine(txtFirstB.Text);
                writer.WriteLine(cmbCardType.Text);
                writer.WriteLine(txtCardNum.Text);
                writer.WriteLine(cmbMonth.Text);
                writer.WriteLine(cmbYear.Text);
                writer.WriteLine(txtSecCode.Text);
                writer.WriteLine(txtAddressB.Text);
                writer.WriteLine(txtCityB.Text);
                writer.WriteLine(txtZipB.Text);
                writer.WriteLine(cmbStateB.Text);
                writer.WriteLine(txtPhoneB.Text);
                writer.WriteLine(txtLastS.Text);
                writer.WriteLine(txtFirstS.Text);
                writer.WriteLine(txtAddressS.Text);
                writer.WriteLine(txtCityS.Text);
                writer.WriteLine(txtZipS.Text);
                writer.WriteLine(cmbStateS.Text);
                writer.WriteLine(txtPhoneS.Text);


                //close streamfile
                writer.Close();
                outFile.Close();

                OrderConfirmation secondForm = new OrderConfirmation();
                secondForm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Fields are missing. Make sure to fill in all fields.");
            }
        }
Beispiel #2
0
        private void btnPurchase_Click(object sender, EventArgs e)
        {
            if (txtLastB.Text != "" && txtFirstB.Text != "" && cmbCardType.Text != "" &&
                txtCardNum.Text != "" && cmbMonth.Text != "" && cmbYear.Text != "" &&
                txtSecCode.Text != "" && txtAddressB.Text != "" && txtCityB.Text != "" &&
                txtZipB.Text != "" && cmbStateB.Text != "" && txtPhoneB.Text != "" &&
                txtLastS.Text != "" && txtFirstS.Text != "" && txtAddressS.Text != "" && txtCityS.Text != "" &&
                txtZipS.Text != "" && cmbStateS.Text != "" && txtPhoneS.Text != "")
            {
                //creating file stream to create an order
                FileStream outFile = new FileStream("Order.txt", FileMode.Create, FileAccess.Write);
                StreamWriter writer = new StreamWriter(outFile);

                //recording data to text file and go to confirm purchase page

                writer.WriteLine(txtLastB.Text);
                writer.WriteLine(txtFirstB.Text);
                writer.WriteLine(cmbCardType.Text);
                writer.WriteLine(txtCardNum.Text);
                writer.WriteLine(cmbMonth.Text);
                writer.WriteLine(cmbYear.Text);
                writer.WriteLine(txtSecCode.Text);
                writer.WriteLine(txtAddressB.Text);
                writer.WriteLine(txtCityB.Text);
                writer.WriteLine(txtZipB.Text);
                writer.WriteLine(cmbStateB.Text);
                writer.WriteLine(txtPhoneB.Text);
                writer.WriteLine(txtLastS.Text);
                writer.WriteLine(txtFirstS.Text);
                writer.WriteLine(txtAddressS.Text);
                writer.WriteLine(txtCityS.Text);
                writer.WriteLine(txtZipS.Text);
                writer.WriteLine(cmbStateS.Text);
                writer.WriteLine(txtPhoneS.Text);

                //close streamfile
                writer.Close();
                outFile.Close();

                OrderConfirmation secondForm = new OrderConfirmation();
                secondForm.Show();
                this.Hide();

            }
            else
            {
                MessageBox.Show("Fields are missing. Make sure to fill in all fields.");
            }
        }