Пример #1
0
        public static void viewFormat(int id, ScmStockItem item, ScmView gui)
        {
            string status_msg;

            if (item.stockQty == 0)
            {
                status_msg = "Out of Stock";
                gui.listView1.Items[id].BackColor = Color.LightPink;
            }
            else if (item.stockQty < 1.25f * item.stockMin)
            {
                status_msg = "Stock Low";
                gui.listView1.Items[id].BackColor = Color.Yellow;
            }
            else if (item.stockQty <= item.stockMax)
            {
                status_msg = "In Stock";
            }
            else
            {
                status_msg = "Surplus";
                gui.listView1.Items[id].BackColor = Color.Yellow;
            }

            gui.listView1.Items[id].SubItems.Add(status_msg);
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Get event sender as button via cast
            Button temp_button = (Button)sender;
            Form   temp_form;

            //Behaviour is determined by button name
            switch (temp_button.Name)
            {
            case "AddButton":
                //Switch to Add Stock GUI by creating a new GUI and hiding this one
                temp_form = new ScmAdd();
                temp_form.Show();
                this.Hide();
                break;

            case "ViewButton":
                temp_form = new ScmView();
                temp_form.Show();
                this.Hide();
                break;

            case "ReportButton":
                temp_form = new ScmReport();
                temp_form.Show();
                this.Hide();
                break;
            }
        }
Пример #3
0
        public static void ViewConvert(ScmView gui)
        {
            gui.listView1.Columns.Add("Stock ID", 60);
            gui.listView1.Columns.Add("Item Name", 85);
            gui.listView1.Columns.Add("Price", 55);
            gui.listView1.Columns.Add("Arrival Date", 120);
            gui.listView1.Columns.Add("Quantity", 60);
            gui.listView1.Columns.Add("Min Quantity", 75);
            gui.listView1.Columns.Add("Max Quantity", 75);
            gui.listView1.Columns.Add("Status", 85);

            int i = 0;

            foreach (ScmStockItem item in gui.viewList)
            {
                gui.listView1.Items.Add(item.stockId);
                gui.listView1.Items[i].SubItems.Add(item.stockName);
                gui.listView1.Items[i].SubItems.Add("£" + item.stockPrice.ToString("N2"));
                gui.listView1.Items[i].SubItems.Add(item.stockDate.ToString());
                gui.listView1.Items[i].SubItems.Add(item.stockQty.ToString());
                gui.listView1.Items[i].SubItems.Add(item.stockMin.ToString());
                gui.listView1.Items[i].SubItems.Add(item.stockMax.ToString());

                ScmDataFormat.viewFormat(i, item, gui);
                i++;
            }
        }
Пример #4
0
        private void panel5_Click(object sender, EventArgs e)
        {
            Form temp_form = new ScmView();

            temp_form.Show();
            this.Hide();
        }
Пример #5
0
        public static void OnStockView(object sender, EventArgs e)
        {
            ScmView gui = (ScmView)sender;

            gui.viewList = ScmDataAccess.readStock();
            ScmDataConvert.ViewConvert(gui);
        }