コード例 #1
0
ファイル: MainForm.cs プロジェクト: yyang49/dot-net-homework
        private void button1_Click(object sender, EventArgs e)
        {
            if (searchType.Text != "" && filter.Text != "")
            {
                List <Order.Order> searchResult = new List <Order.Order>();
                switch (searchType.Text)
                {
                case "订单号":
                    searchResult = orderService.SelectOrder(1, filter.Text).ToList();
                    break;

                case "商品名":
                    searchResult = orderService.SelectOrder(2, filter.Text).ToList();
                    break;

                case "收货人":
                    searchResult = orderService.SelectOrder(3, filter.Text).ToList();
                    break;

                case "总价":
                    double total;
                    double.TryParse(filter.Text, out total);
                    searchResult = orderService.SelectOrder(4, total.ToString()).ToList();
                    break;
                }
                orderBindingSource.DataSource = searchResult;
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (searchType.Text != "" && filter.Text != "")
            {
                List <Order.Order> searchResult = new List <Order.Order>();
                switch (searchType.Text)
                {
                case "订单号":
                    searchResult = orderService.SelectOrder(1, filter.Text);
                    break;

                case "商品名":
                    searchResult = orderService.SelectOrder(2, filter.Text);
                    break;

                case "收货人":
                    searchResult = orderService.SelectOrder(3, filter.Text);
                    break;
                }
                orderBindingSource.DataSource = searchResult;
            }
        }