Пример #1
0
 public MainForm()
 {
     InitializeComponent();
     orderService.AddOrder(new Customer("yyang", "111-1111"), new OrderDetails(new Commodity(1001, "护摩之杖", 5000), 1), new OrderDetails(new Commodity(1002, "狼的末路", 3000), 2));
     orderService.AddOrder(new Customer("Amber", "222-2222"), new OrderDetails(new Commodity(1003, "四风原典", 4000), 1), new OrderDetails(new Commodity(1004, "决斗之枪", 2000), 1));
     orderService.AddOrder(new Customer("Kaeya", "333-3333"), new OrderDetails(new Commodity(1001, "护摩之杖", 5000), 1), new OrderDetails(new Commodity(1005, "天空之翼", 3000), 1));
     orderService.AddOrder(new Customer("Hutao", "444-4444"), new OrderDetails(new Commodity(1002, "狼的末路", 3000), 1), new OrderDetails(new Commodity(1006, "火之高兴", 5000), 1));
     orderService.AddOrder(new Customer("Klee", "555-5555"), new OrderDetails(new Commodity(1003, "四风原典", 4000), 1), new OrderDetails(new Commodity(1007, "阿莫斯之弓", 4000), 1));
     orderBindingSource.DataSource = orderService.GetAll();
 }
Пример #2
0
        public DetailForm(bool isEdit, int index)
        {
            InitializeComponent();
            this.isEdit = isEdit;
            switch (isEdit)
            {
            case true:
                order = (Order.Order)orderService.GetAll()[index];
                break;

            case false:
                break;
            }
            bindingSource1.DataSource = order;
            bindingSource1.DataMember = "orderDetails";
            textNo.DataBindings.Add("Text", order, "orderNo");
            textName.DataBindings.Add("Text", order, "customerName");
            textInfo.DataBindings.Add("Text", order, "customerInfo");
        }