private void AgentBookings_Load(object sender, EventArgs e) { listView1.Items.Clear(); List <Agent> agentList; try { agentList = CampusDatabase.GetAgent(); if (agentList.Count > 0) { //MessageBox.Show("good", "OK"); for (int i = 0; i < agentList.Count; i++) { Agent agent = agentList[i]; listView1.Items.Add(agent.AgentName); listView1.Items[i].SubItems.Add(agent.OfficeLocation); listView1.Items[i].SubItems.Add(agent.NumSales.ToString()); listView1.Items[i].SubItems.Add(agent.TotalSales.ToString()); } } else { MessageBox.Show("There are no any agents.", "Alert"); } } catch (Exception e1) { MessageBox.Show(e1.Message, e1.GetType().ToString()); } }
private void AddAgent_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'cAMPUSDataSet.OFFICE' table. You can move, or remove it, as needed. this.oFFICETableAdapter.Fill(this.cAMPUSDataSet.OFFICE); listView1.Items.Clear(); List <Agent> agentList; try { agentList = CampusDatabase.GetAgent(); if (agentList.Count > 0) { //MessageBox.Show("good", "OK"); for (int i = 0; i < agentList.Count; i++) { Agent agent = agentList[i]; listView1.Items.Add(agent.AgentName); listView1.Items[i].SubItems.Add(agent.OfficeLocation); listView1.Items[i].SubItems.Add(agent.NumSales.ToString()); listView1.Items[i].SubItems.Add(agent.TotalSales.ToString()); } } else { MessageBox.Show("There are no any agents.", "Alert"); } } catch (Exception e1) { MessageBox.Show(e1.Message, e1.GetType().ToString()); } }
private void SearchSales_Load(object sender, EventArgs e) { cbAgent.Items.Clear(); cbDestination.Items.Clear(); List <Agent> agentList = CampusDatabase.GetAgent(); List <Destination> destinationList = CampusDatabase.GetDestination(); try { if (agentList.Count > 0) { agentList.Insert(0, new Asisgnment6.Agent() { AgentID = 0, AgentName = "All Agents" }); cbAgent.DataSource = agentList; cbAgent.DisplayMember = "AgentName"; cbAgent.ValueMember = "AgentId"; } else { MessageBox.Show("There are no agents", "Alert"); } if (destinationList.Count > 0) { destinationList.Insert(0, new Asisgnment6.Destination() { DestinationId = 0, DestinationName = "All Destinations" }); cbDestination.DataSource = destinationList; cbDestination.DisplayMember = "DestinationName"; cbDestination.ValueMember = "DestinationId"; } else { MessageBox.Show("There are no Destinations", "Alert"); } } catch (Exception e1) { MessageBox.Show(e1.Message, e1.GetType().ToString()); } }