Пример #1
0
        //添加订单项
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //以新增模式打开窗口
            EditOrderDialog detailOrderDialog = new EditOrderDialog(1, -1);

            if (detailOrderDialog.ShowDialog() == DialogResult.OK)
            {
                bdsOrders.DataSource = Service.OrderList;
                bdsOrders.ResetBindings(false);
                bdsItems.ResetBindings(false);
            }
        }
Пример #2
0
        //修改订单项
        private void btnModify_Click(object sender, EventArgs e)
        {
            //获取订单号
            long orderCode = (long)dgvOrders.CurrentRow.Cells[0].Value;

            //获取订单
            Order order = (Order)Service.SelectOrder("Order Code", orderCode.ToString())[0];

            //模式代码0以修改模式打开窗口
            EditOrderDialog detailOrderDialog = new EditOrderDialog(0, order);

            if (detailOrderDialog.ShowDialog() == DialogResult.OK)
            {
                bdsOrders.DataSource = Service.SelectOrder("All", null);
                bdsOrders.ResetBindings(false);
                bdsItems.ResetBindings(false);
            }
        }
Пример #3
0
        //修改订单项
        private void btnModify_Click(object sender, EventArgs e)
        {
            //获取索引
            string orderCode = (string)dgvOrders.CurrentRow.Cells[0].Value;
            int    index     = Service.OrderList.IndexOf(new Order()
            {
                OrderCode = orderCode
            });

            //模式代码0以修改模式打开窗口
            EditOrderDialog detailOrderDialog = new EditOrderDialog(0, index);

            if (detailOrderDialog.ShowDialog() == DialogResult.OK)
            {
                bdsOrders.DataSource = Service.OrderList;
                bdsOrders.ResetBindings(false);
                bdsItems.ResetBindings(false);
            }
        }