Ejemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            string name, address, number;
            int    CustNum;
            bool   onMailList;
            double saleAmmount;

            try
            {
                name        = PrefCustName.Text;
                address     = PrefCustAddress.Text;
                number      = PrefCustPhoneNum.Text;
                CustNum     = int.Parse(PrefCustNum.Text);
                saleAmmount = double.Parse(PurchaseAmmnt.Text);

                if (PrefCustEmailRdBttn.Checked)
                {
                    onMailList = true;
                }
                else
                {
                    onMailList = false;
                }

                PreferedCustomer newCustomer = new PreferedCustomer(name, address, number, CustNum, onMailList, saleAmmount);

                custList.Add(newCustomer);

                PrefCiustLstBx.Items.Add(newCustomer);

                ClearTextBoxes();
            }
            catch
            {
                MessageBox.Show("Please fill out all information");
            }
        }
Ejemplo n.º 2
0
        private void AddPrefCustomers()
        {
            StreamReader inputFile = File.OpenText("PrefCustomers.txt");
            string       line;

            while (!inputFile.EndOfStream)
            {
                line = inputFile.ReadLine();

                string[] users = line.Split(',');


                PreferedCustomer cust = new PreferedCustomer();
                cust.Name       = users[0];
                cust.Address    = users[1];
                cust.Number     = users[2];
                cust.OnMailList = bool.Parse(users[3]);
                cust.CustNum    = int.Parse(users[4]);
                cust.Discount   = double.Parse(users[5]);

                custList.Add(cust);
                PrefCiustLstBx.Items.Add(cust);
            }
        }