private void EmployeeSellTickets_Load(object sender, EventArgs e) { schedLB.Enabled = false; //avoids exception error on day not being selected first schedLB2.Enabled = false; //avoids exception error on day not being selected first schedLB3.Enabled = false; //avoids exception error on day not being selected first #region instantiate schedule.xml /*DateTime dt1 = new DateTime(2015, 5, 5, 15, 30, 00); * DateTime dt2 = new DateTime(2015, 5, 10, 17, 00, 00); * DateTime dt3 = new DateTime(2015, 5, 15, 20, 30, 00); * DateTime dt4 = new DateTime(2015, 5, 20, 10, 00, 00); * DateTime dt5 = new DateTime(2015, 5, 25, 12, 30, 00); * Show tab1sched1 = new Show(dt1, "Eragon","1"); * Show tab1sched2 = new Show(dt2, "Die by Fire","2"); * Show tab1sched3 = new Show(dt3, "The visit","3"); * Show tab1sched4 = new Show(dt4, "Wicked","4"); * Show tab1sched5 = new Show(dt5, "Something Rotten","5"); * List<Show> instant1 = new List<Show>(); * instant1.Add(tab1sched1); * instant1.Add(tab1sched2); * instant1.Add(tab1sched3); * instant1.Add(tab1sched4); * instant1.Add(tab1sched5); * EmployeeSellTickets.WriteXML<Show>("..\\..\\schedule.xml", instant1);*/ #endregion sched = EmployeeSellTickets.ReadXML <Show>("..\\..\\schedule.xml"); //default tab 1 reading }
private void Tab3_Click(object sender, MouseEventArgs e) { switch (TicketsTab.SelectedTab.Name) { case "Tab1": sched = EmployeeSellTickets.ReadXML <Show>(tab1path); break; case "Tab2": sched = EmployeeSellTickets.ReadXML <Show>(tab2path); break; case "Tab3": sched = EmployeeSellTickets.ReadXML <Show>(tab3path); break; } }
private void AddEdit_click(object sender, EventArgs e) { if ((FirstnameTBE.Text != "") && (LastnameTB.Text != "")) { EmployeeSellTickets employeeeselltickets = new EmployeeSellTickets(); employeeeselltickets.ShowDialog(); } else { EmployeeSellTickets employeeeselltickets = new EmployeeSellTickets(false); employeeeselltickets.ShowDialog(); } }
private void button5_Click(object sender, EventArgs e) { switch (TicketsTab.SelectedTab.Name) { case "Tab2": sched = EmployeeSellTickets.ReadXML <Show>(tab2path); if (schedLB2.SelectedItem != null) { Show selectedshow = (Show)schedLB2.SelectedItem; Theater1 theater1 = new Theater1(selectedshow, CUSTOMER, 2); theater1.ShowDialog(); } else { MessageBox.Show("Select a show please"); } break; case "Tab3": sched = EmployeeSellTickets.ReadXML <Show>(tab3path); if (schedLB3.SelectedItem != null) { Show selectedshow = (Show)schedLB3.SelectedItem; Theater1 theater1 = new Theater1(selectedshow, CUSTOMER, 3); theater1.ShowDialog(); } else { MessageBox.Show("Select a show please"); } break; default: sched = EmployeeSellTickets.ReadXML <Show>(tab1path); if (schedLB.SelectedItem != null) { Show selectedshow = (Show)schedLB.SelectedItem; Theater1 theater1 = new Theater1(selectedshow, CUSTOMER, 1); theater1.ShowDialog(); } else { MessageBox.Show("Select a show please"); } break; } }
private void SellTickets_Click(object sender, EventArgs e) { //FirstnameTBE.Text = SpaceStripper(FirstnameTBE.Text); //LastnameTB.Text = SpaceStripper(LastnameTB.Text); instant2 = EmployeePortal.ReadXML <Customer>(Custpath); int index = 0; foreach (Customer p in instant2) { if (FirstnameTBE.Text.ToUpper() == p.Firstname.ToUpper() && LastnameTB.Text.ToUpper() == p.Lastname.ToUpper()) { index = instant2.IndexOf(p); ok = true; viewer = p; } } if (ok) { EmployeeSellTickets employeeselltickets = new EmployeeSellTickets(false, false, false, viewer); employeeselltickets.ShowDialog(); ok = false; } else { if (FirstnameTBE.Text == "") { MessageBox.Show("Please fill in customer Firstname"); } else if (LastnameTB.Text == "") { MessageBox.Show("Please fill in customer Lastname"); } else { MessageBox.Show("Customer is not in directory."); } } }
private void Remove_Click(object sender, EventArgs e) { List <Show> NewSchedule = new List <Show>(); if (schedLB.SelectedItem != null || schedLB2.SelectedItem != null || schedLB3.SelectedItem != null) { switch (TicketsTab.SelectedTab.Name) { case "Tab2": NewSchedule = EmployeeSellTickets.ReadXML <Show>(tab2path); Show tab2 = (Show)schedLB2.SelectedItem; int index = 0; for (int a = 0; a < NewSchedule.Count; a++) { if (NewSchedule.ElementAt(a).Name == tab2.Name) { a = NewSchedule.Count(); } index++; } NewSchedule.Remove(NewSchedule.ElementAt(index)); EmployeeSellTickets.WriteXML <Show>(tab2path, NewSchedule); break; case "Tab3": NewSchedule = EmployeeSellTickets.ReadXML <Show>(tab3path); Show tab3 = (Show)schedLB3.SelectedItem; int ind = 0; for (int a = 0; a < NewSchedule.Count; a++) { if (NewSchedule.ElementAt(a).Name == tab3.Name) { a = NewSchedule.Count(); } ind++; } NewSchedule.Remove(NewSchedule.ElementAt(ind)); EmployeeSellTickets.WriteXML <Show>(tab3path, NewSchedule); break; default: NewSchedule = EmployeeSellTickets.ReadXML <Show>(tab1path); Show tab = (Show)schedLB.SelectedItem;//NewSchedule.ElementAt(schedLB.SelectedIndex); int inde = 0; for (int a = 0; a < NewSchedule.Count; a++) { if (NewSchedule.ElementAt(a).Name == tab.Name) { a = NewSchedule.Count(); } inde++; } NewSchedule.Remove(NewSchedule.ElementAt(inde - 1)); EmployeeSellTickets.WriteXML <Show>(tab1path, NewSchedule); break; } MessageBox.Show("Show has been removed."); switch (TicketsTab.SelectedTab.Name) { case "Tab2": sched = EmployeeSellTickets.ReadXML <Show>(tab2path); break; case "Tab3": sched = EmployeeSellTickets.ReadXML <Show>(tab3path); break; default: sched = EmployeeSellTickets.ReadXML <Show>(tab1path); break; } } else { MessageBox.Show("Please selected an item."); } }