Exemple #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            int position = OrderBindingSource.Position;

            os.RemoveOrder(Convert.ToUInt32(dataGridView1.Rows[position].Cells[0].Value));
            OrderBindingSource.ResetBindings(false);
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int selectedIndex = DetailGridView.CurrentCell.RowIndex;

            orderModified.RemoveDetails(orderModified.OrderDetails[selectedIndex]);
            OrderBindingSource.ResetBindings(false);
            OrderDetailBindingSource.ResetBindings(false);
        }
Exemple #3
0
        private void button5_Click(object sender, EventArgs e)
        {
            Form3 f3 = new Form3(this.orders);

            f3.Owner        = this; //设置查找窗体的父窗体为本窗体
            f3.UpdateOrder += new Form3.UpdateOrderHandler(UpdateOrder);
            f3.ShowDialog();
            OrderBindingSource.ResetBindings(false);
        }
Exemple #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form2 f = new Form2();

            f.Owner        = this; //设置查找窗体的父窗体为本窗体
            f.CreateOrder += new Form2.CreateOrderHandler(CreateOrder);
            f.ShowDialog();
            OrderBindingSource.ResetBindings(false);
        }
 private void btnImport_Click(object sender, EventArgs e)
 {
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         String fileName = openFileDialog.FileName;
         service.Import(fileName);
         OrderBindingSource.ResetBindings(true);
     }
 }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            EditForm form1 = new EditForm(new Order());

            if (form1.ShowDialog() == DialogResult.OK)
            {
                service.AddOrders(form1.CurrentOrder);
                OrderBindingSource.ResetBindings(false);
            }
        }
 private void btnModify_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < DetailGridView.Rows.Count - 1; i++)
     {
         orderModified.OrderDetails[i].Goods.GoodsName = DetailGridView.Rows[i].Cells[0].Value.ToString();
         orderModified.OrderDetails[i].Num             = int.Parse(DetailGridView.Rows[i].Cells[1].Value.ToString());
         orderModified.OrderDetails[i].GoodsTotalPrice = double.Parse(DetailGridView.Rows[i].Cells[2].Value.ToString());
     }
     OrderBindingSource.ResetBindings(false);
     OrderDetailBindingSource.ResetBindings(false);
 }
Exemple #8
0
        private void btnCreateOrder_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2(new Order());

            if (form2.ShowDialog() == DialogResult.OK)
            {
                os.AddOrder(form2.currentOrder);
                OrderBindingSource.DataSource = os.orders;
                OrderBindingSource.ResetBindings(false);
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            Order order = OrderBindingSource.Current as Order;

            if (order == null)
            {
                MessageBox.Show("请选择一个订单进行删除");
                return;
            }
            service.DeleteOrders(order);
            OrderBindingSource.ResetBindings(true);
        }
Exemple #10
0
        private void btnDeleteItem_Click(object sender, EventArgs e)
        {
            OrderItem item = ItemBindingSource.Current as OrderItem;

            if (item == null)
            {
                MessageBox.Show("请选择一件商品进行删除");
                return;
            }
            CurrentOrder.DeleteItem(item);
            OrderBindingSource.ResetBindings(true);
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FormAdd formAdd = (FormAdd)this.Owner;

            formAdd.Show();
            textBoxID.DataBindings.Add("Text", OrderDetailBindingSource, "OrderID");
            cbBoxMerchant.DataBindings.Add("SelectedItem", OrderDetailBindingSource, "Mechant");
            cbBoxCustomer.DataBindings.Add("SelectedItem", OrderDetailBindingSource, "Customer");
            orderModified.OrderDetails.Add(orderDetails);
            OrderBindingSource.ResetBindings(false);
            OrderDetailBindingSource.ResetBindings(false);
        }
Exemple #12
0
 private void btnCustomerQuery_Click(object sender, EventArgs e)
 {
     if (KeyWord == null || KeyWord == "")
     {
         OrderBindingSource.DataSource = os.orders;
     }
     else
     {
         OrderBindingSource.DataSource = os.orders
                                         .Where(s => s.Customer == KeyWord);
     }
     OrderBindingSource.ResetBindings(true);
 }
Exemple #13
0
        private void btnDeleteOrder_Click(object sender, EventArgs e)
        {
            Order currentOrder = OrderBindingSource.Current as Order;

            if (currentOrder == null)
            {
                MessageBox.Show("请选择一个订单进行删除");
                return;
            }
            os.RemoveOrder(currentOrder.OrderId);
            OrderBindingSource.DataSource = os.orders;
            OrderBindingSource.ResetBindings(false);
        }
        private void OptionList_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (ModeList.SelectedIndex)
            {
            case 1:
                OrderBindingSource.DataSource = service.SelectByOrderID(OptionList.Text);
                break;

            case 2:
                OrderBindingSource.DataSource = service.SelectByCustomer(OptionList.Text);
                break;
            }
            OrderBindingSource.ResetBindings(true);
        }
Exemple #15
0
        private void btnAddItem_Click(object sender, EventArgs e)
        {
            ItemEditForm form2 = new ItemEditForm(new OrderItem());

            try
            {
                if (form2.ShowDialog() == DialogResult.OK)
                {
                    CurrentOrder.AddItem(form2.CurrentItem);
                    OrderBindingSource.ResetBindings(true);
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Exemple #16
0
        private void btnEditItem_Click(object sender, EventArgs e)
        {
            OrderItem item = ItemBindingSource.Current as OrderItem;

            if (item == null)
            {
                MessageBox.Show("请选择一件商品进行修改");
                return;
            }
            ItemEditForm form2 = new ItemEditForm(item, true);

            if (form2.ShowDialog() == DialogResult.OK)
            {
                CurrentOrder.AddItem(item);
                OrderBindingSource.ResetBindings(true);
            }
        }
Exemple #17
0
        private void btnMedifyOrder_Click(object sender, EventArgs e)
        {
            Order currentOrder = OrderBindingSource.Current as Order;

            if (currentOrder == null)
            {
                MessageBox.Show("请选择一个订单进行修改");
                return;
            }
            Form2 form2 = new Form2();

            if (form2.ShowDialog() == DialogResult.OK)
            {
                os.UpdateOrder(currentOrder, form2.currentOrder);
                OrderBindingSource.DataSource = os.orders;
                OrderBindingSource.ResetBindings(false);
            }
        }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            Order order = OrderBindingSource.Current as Order;

            service.Get(order.ID, out Order t, out int index);
            if (order == null)
            {
                MessageBox.Show("请选择一个订单进行修改");
                return;
            }
            EditForm form1 = new EditForm(order, true);

            if (form1.ShowDialog() == DialogResult.OK)
            {
                service.EditOrders(order, index);
                OrderBindingSource.ResetBindings(true);
            }
        }
Exemple #19
0
        private void button1_Click(object sender, EventArgs e)
        {
            switch (SearchWay.SelectedItem)
            {
            case "商品名称":
                if (KeyWord == null || KeyWord == "")
                {
                    OrderBindingSource.DataSource = orders;
                }
                else
                {
                    OrderBindingSource.DataSource =
                        os.QueryOrdersByGoodsName(KeyWord);
                }
                OrderBindingSource.ResetBindings(false);
                itemsBindingSource.ResetBindings(false);
                break;

            case "客户名称":
                if (KeyWord == null || KeyWord == "")
                {
                    OrderBindingSource.DataSource = orders;
                }
                else
                {
                    OrderBindingSource.DataSource =
                        os.QueryOrdersByCustomerName(KeyWord);
                }
                OrderBindingSource.ResetBindings(false);
                itemsBindingSource.ResetBindings(false);
                break;

            case "订单价格":
            default:

                os.Sort((o1, o2) => o1.TotalPrice.CompareTo(o2.TotalPrice));
                orders = os.Orders;
                OrderBindingSource.DataSource = orders;
                OrderBindingSource.ResetBindings(false);
                itemsBindingSource.ResetBindings(false);
                break;
            }
        }
        private void RefreshView(int pageNo, int pageSize)
        {
            Pagination pagination = coreService.FindSystemOrderList(pageNo, pageSize);

            OrderBindingSource.Clear();
            for (int i = 0; i < pagination.Records.Count; i++)
            {
                OrderBindingSource.Add(pagination.Records[i]);
            }

            if (pagination.PageNo <= 1)
            {
                ForwardFirstLabel.Enabled = false;
                ForwardPrevLabel.Enabled  = false;
            }
            else
            {
                ForwardFirstLabel.Enabled = true;
                ForwardPrevLabel.Enabled  = true;
            }

            if (pageNo >= pagination.getTotalPage())
            {
                ForwardNextLabel.Enabled = false;
                ForwardLastLabel.Enabled = false;
            }
            else
            {
                ForwardNextLabel.Enabled = true;
                ForwardLastLabel.Enabled = true;
            }

            StatisticLabel.Text  = String.Format("页次:{0}/{1} 共{2}条数据", pagination.PageNo, pagination.getTotalPage(), pagination.TotalCount);
            PagingPanel.Tag      = pagination;
            ForwardPageText.Text = pagination.PageNo.ToString();
            OrderTable.ClearSelection();
        }