示例#1
0
        private void bnLoadStock_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "Stock Items|*.txt";
            openFileDialog.InitialDirectory = Application.StartupPath;
            try
            {
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    consoleController.LoadStockItems_Handler(openFileDialog.FileName);

                    bnListStockBelowTH.Enabled      = bnListAllStock.Enabled = bnListAllSuppliers.Enabled = true;
                    bnListOutstandingOrders.Enabled = bnOrder.Enabled = bnRestock.Enabled = true;
                    bnLoadSuppliers.Enabled         = bnLoadStock.Enabled = false;

                    till = new Till(consoleController.stockList);  // you can pass any argument
                    till.Show();
                }
            }
            catch (Exception ex)
            {
                DisplayErrorMessage(ex.Message);
            }
        }
示例#2
0
        private void btnLoadStock_Click(object sender, EventArgs e)
        {
            loadFile("StockItems|*.txt", 7, control.loadStock);
            Till till = new Till();

            till.Show();
        }
示例#3
0
 public TillController(Till till)
 {
     this.till    = till;
     transList    = new List <Transaction>();
     currentTrans = new Transaction();
 }
示例#4
0
文件: Console.cs 项目: alex606/cis501
        private void bnLoadStock_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "Stock Items|*.txt";
            openFileDialog.InitialDirectory = Application.StartupPath;
            try
            {
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    consoleController.LoadStockItems_Handler(openFileDialog.FileName);

                    bnListStockBelowTH.Enabled = bnListAllStock.Enabled = bnListAllSuppliers.Enabled = true;
                    bnListOutstandingOrders.Enabled = bnOrder.Enabled = bnRestock.Enabled = true;
                    bnLoadSuppliers.Enabled = bnLoadStock.Enabled = false;

                    till = new Till( SupplierList, StockItemList);  // you can pass any argument
                    till.Show();
                }
            }
            catch (Exception ex)
            {
                DisplayErrorMessage(ex.Message);
            }
        }
示例#5
0
文件: Computer.cs 项目: Ripper555/SCS
        private void bnLoadStock_Click(object sender, EventArgs e)
        {
            // load stock file
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "StockItems|*.sti";
            openFileDialog.InitialDirectory = Application.StartupPath;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    TextReader trs = new StreamReader(openFileDialog.FileName);
                    string s;
                    string[] properties = new string[7];
                    char[] spliter = { '&' };
                    while ((s = trs.ReadLine()) != null)
                    {
                        properties = s.Split(spliter);

                        int k = int.Parse(properties[0]);
                        string n = properties[1];
                        int bc = int.Parse(properties[2]);
                        double p = double.Parse(properties[3]);
                        int t = int.Parse(properties[4]);
                        int q = int.Parse(properties[5]);
                        int sk = int.Parse(properties[6]);

                        syst.addItem(new Item(bc, n, q, t, p, k, syst.locateSupplier(sk)));
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Exception is caught (LoadSuppliers)");
                }
            }

            bnListStockBelowTH.Enabled = bnListAllStock.Enabled = bnListAllSuppliers.Enabled = true;
            bnListOutstandingOrders.Enabled = bnOrder.Enabled = bnRestock.Enabled = true;
            bnLoadSuppliers.Enabled = bnLoadStock.Enabled = false;

            if (!tillLoaded)
            {
                Till ts = new Till(syst);
                ts.Show();
                tillLoaded = true;
            }
            // I display Till here (using Show() since Till is a modeless dialog box
        }
示例#6
0
 // Add necessary fields
 public TillController(Till till)
 {
     this.till = till;
     //
 }