コード例 #1
0
        private void btn_Order_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count == 1)
            {
                //Find index
                string identifier = listView1.SelectedItems[0].Text;
                label2.Text = "";

                //Get element selected
                Element element = db.List_of_stock.Find(x => x.Code == identifier);
                //Calculate best supplier
                string bestSupplier = element.ChooseBestSupplier();
                //find supplier from db
                Supplier best_Supplier = db.List_of_suppliers.Find(x => x.Name == bestSupplier);

                //Order
                this.Hide();
                Sudo_OrderElement order_element = new Sudo_OrderElement(db, element, best_Supplier);
                order_element.ShowDialog();
                Display();
                this.Show();
            }
            else
            {
                label2.ForeColor = Color.Red;
                label2.Text      = "Please select an element to order";
            }
        }
コード例 #2
0
 public Sudo_OrderElement(DbManager db, Element element, Supplier supplier)
 {
     Current       = this;
     this.db       = db;
     this.element  = element;
     this.supplier = supplier;
     InitializeComponent();
 }