Beispiel #1
0
        private void butSearch_Click(object sender, EventArgs e)
        {
            List <Sale>   sales      = CampusDatabase.GetSale(Convert.ToInt32(cbAgent.SelectedValue), Convert.ToInt32(cbDestination.SelectedValue), textBox1.Text, textBox2.Text);
            SearchResults resultForm = new SearchResults(sales);

            resultForm.Show();
        }
Beispiel #2
0
        private void UpdateSale_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'cAMPUSDataSet8.AGENT' table. You can move, or remove it, as needed.
            this.aGENTTableAdapter1.Fill(this.cAMPUSDataSet8.AGENT);
            // TODO: This line of code loads data into the 'cAMPUSDataSet7.AGENT' table. You can move, or remove it, as needed.
            this.aGENTTableAdapter.Fill(this.cAMPUSDataSet7.AGENT);
            // TODO: This line of code loads data into the 'cAMPUSDataSet6.DESTINATION' table. You can move, or remove it, as needed.
            this.dESTINATIONTableAdapter.Fill(this.cAMPUSDataSet6.DESTINATION);
            Sale sale = CampusDatabase.GetSale(saleId);

            listView1.Items.Clear();

            try
            {
                //display the sale on listView1
                if (sale != null)
                {
                    listView1.Items.Add(sale.SaleDate.ToShortDateString());
                    listView1.Items[0].SubItems.Add(sale.Amount.ToString());
                    listView1.Items[0].SubItems.Add(sale.DestinationName);
                    listView1.Items[0].SubItems.Add(sale.AgentName);
                    listView1.Items[0].SubItems.Add(sale.OfficeLocation);
                    listView1.Items[0].SubItems.Add(sale.SaleId.ToString());
                    cbAgent.SelectedValue       = sale.AgentKey;
                    cbDestinaiton.SelectedValue = sale.DestinationKey;
                }
                else
                {
                    MessageBox.Show("the sale ID is not exist.", "Alert");
                }
            }
            catch (Exception e1)
            { MessageBox.Show(e1.Message, e1.GetType().ToString()); }



            //show amount
            txtAmount.Text = sale.Amount.ToString();
            //show date
            labDate.Text = sale.SaleDate.ToLongDateString();
            //showdate
            monthCalendar1.SetDate(sale.SaleDate);
        }