Example #1
0
 public ticketForm(Customer selectedCustomer)
 {
     customer = selectedCustomer;
     InitializeComponent();
     List<Shows> showList = Shows.LoadShows();
     foreach (Shows s in showList)
     {
         comboBox1.Items.Add(s);
     }
     comboBox1.DisplayMember = "Name";
 }
        private void CreateUserButton_Click(object sender, EventArgs e)
        {
            try
            {
                Customer cumstomertemp = new Customer(this.nameBox.Text, this.addressBox.Text, this.phoneNumberBox.Text, this.creditCardBox.Text, this.emailBox.Text, int.Parse(this.familySizeBox.Text));
                if (tempIndex != -1) cumstomertemp.Tickets = selectedCustomer.Tickets;
                else cumstomertemp.Tickets = new List<Ticket>();
                List<Customer> templist = Customer.LoadCustomers();
                if(tempIndex !=-1) templist.RemoveAt(tempIndex);
                templist.Add(cumstomertemp);
                Customer.SaveCustomers(templist);

                this.Close();

            }
            catch (FormatException) { MessageBox.Show("Please Complete All Fields", "Field Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
 public UserAccountForm(Customer c,bool a=false)
 {
     InitializeComponent();
     nameBox.Text = c.Name;
     addressBox.Text = c.Address;
     emailBox.Text = c.Email;
     phoneNumberBox.Text = c.Phone;
     familySizeBox.Text = c.Size.ToString();
     creditCardBox.Text = c.Credit;
     CreateUserButton.Text = "Save Info";
     removeButton.Visible = a;
     selectedCustomer = c;
     if (a)
         CreateUserButton.Location = new Point(30, 270);
     else
         CreateUserButton.Location = new Point(66, 270);
     tempIndex = templist.FindIndex(i => i.Name == c.Name);
 }
Example #4
0
        private void SeatForm_Load(object sender, EventArgs e)
        {
            //currentCustomer = UserForm.selectedCustomer;

            currentShow = UserForm.selectedShow;
            foreach (Customer q in customerList)
            {
                if (q.Name == UserForm.selectedCustomer.Name)
                    currentCustomer = q;
            }
            customerIndex = customerList.IndexOf(currentCustomer);

            foreach (Venue q in venueList)
            {
                if (q.Name == currentShow.VenueName)
                    currentVenue = q;
            }
            venueIndex = venueList.IndexOf(currentVenue);
            CreateButtons();
            panel1.SendToBack();
        }
Example #5
0
 private void UserList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (editEventButton.Text == "Edit User")
     {
         try
         {
             selectedCustomer = UserForm.customerList.Find(item => item == UserList.SelectedItems[0]);
             tempIndex = UserForm.customerList.IndexOf(selectedCustomer);
             TicketBox.Items.Clear();
             foreach (Ticket t in selectedCustomer.Tickets)
                 TicketBox.Items.Add(t);
             TicketBox.DisplayMember = "ShowName";
             addTicketButton.Enabled = true;
             removeTicketButton.Enabled = false;
         }
         catch (Exception ex)
         {
             if (ex is NullReferenceException || ex is ArgumentOutOfRangeException)
                   selectedCustomer = new Customer();
         }
      }
      else
      {
         try
         {
             selectedShow = UserForm.showList.Find(item => item == UserList.SelectedItems[0]);
         }
         catch (Exception ex)
         {
             if (ex is NullReferenceException || ex is ArgumentOutOfRangeException)
                   selectedShow = new Shows();
         }
      }
 }
Example #6
0
 public static void XMLInit()
 {
     List<Customer> C = new List<Customer>();
        Customer Customer0 = new Customer("William Shakespeare", "Church of the Holy Trinity, Stratford-upon-Avon, United Kingdom", "7815553460", "1234567890123456", "*****@*****.**", 1);
        Customer Customer1 = new Customer("Oscar Wilde", "Père Lachaise Cemetery, France", "1345456782", "2345678901234567", "*****@*****.**", 3);
        Customer Customer2 = new Customer("Edward Albee", "Somewhere in Virginia", "3334445555", "1234567887654321", "*****@*****.**", 5);
        Customer Customer3 = new Customer("Pompus White Guy", "Practically Everywhere", "3456547753", "1222555567678221", "*****@*****.**", 1);
        Customer[] Customerz = { Customer0, Customer1, Customer2, Customer3 };
        C.AddRange(Customerz);
        using (var stream = new FileStream("../../customers.xml", FileMode.Create))
        {
        XmlSerializer XML = new XmlSerializer(typeof(List<Customer>));
        XML.Serialize(stream, C);
        }
 }