Example #1
0
        private void RetrieveStockInfo()
        {
            try
            {
                UpdateStock stock = new UpdateStock();
                stock.Kwrd = txtSearch.Text;
                DataTable table = stock.dTable();

                ListViewItem entry = null;
                listViewStockSearch.Items.Clear();

                foreach (DataRow row in table.Rows)
                {
                    entry = new ListViewItem(row["ProductID"].ToString());
                    entry.SubItems.Add(row["ProductName"].ToString());
                    entry.SubItems.Add(row["ProductDescription"].ToString());
                    entry.SubItems.Add(row["SupplierID"].ToString());
                    entry.SubItems.Add(row["CategoryID"].ToString());
                    entry.SubItems.Add(row["Quantity"].ToString());
                    entry.SubItems.Add(row["UnitPrice"].ToString());
                    listViewStockSearch.Items.Add(entry);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void AddToSell()
        {
            string product_name = null;

            try
            {
                if (string.IsNullOrEmpty(listViewSearch.FocusedItem.Text))
                {
                }
                else
                {
                    product_name = listViewSearch.FocusedItem.Text;
                    UpdateStock getStocks = new UpdateStock();
                    getStocks.Kwrd = product_name;
                    DataTable Table = getStocks.dTable();

                    foreach (DataRow row in Table.Rows)
                    {
                        txtbProd.Text  = row["ProductName"].ToString();
                        txtbPrice.Text = row["UnitPrice"].ToString();
                    }
                    txtbSearch.Text = null;
                    listViewSearch.Items.Clear();
                }
            }
            catch
            {
                Interaction.MsgBox("Please select record to add", MsgBoxStyle.Exclamation, "Add to Cart");
                return;
            }
        }
Example #3
0
        double discount;          // Sets discount value as well as return the value to zero when necessary.
        //public string AmountPaid;
        //public string getAmountToPay;

        //public string displayChange;

        private void RetrieveStock()
        {
            UpdateStock getStocks = new UpdateStock();

            getStocks.Kwrd = txtbSearch.Text;
            DataTable Table = getStocks.dTable();

            ListViewItem entry = null;

            listViewSearch.Items.Clear();

            foreach (DataRow row in Table.Rows)
            {
                entry = new ListViewItem(row["ProductName"].ToString());
                entry.SubItems.Add(row["ProductDescription"].ToString());
                entry.SubItems.Add(row["UnitPrice"].ToString());
                listViewSearch.Items.Add(entry);
            }
        }
Example #4
0
        public void UpdateStockWithQuantityAfterSale()
        {
            int Quantity, saleQuantity; string prodname;
            int availQuantity = 0;

            foreach (ListViewItem Item in listViewPurchase.Items)
            {
                prodname     = Item.SubItems[0].Text;
                saleQuantity = Convert.ToInt32(Item.SubItems[1].Text);
                DataTable   stocktable;
                UpdateStock stockupdate = new UpdateStock();
                stockupdate.Kwrd = prodname;
                stocktable       = stockupdate.dTable();

                foreach (DataRow row in stocktable.Rows)
                {
                    availQuantity = Convert.ToInt32(row["Quantity"]);
                }

                Quantity = availQuantity - saleQuantity;
                //MessageBox.Show(Convert.ToString(Quantity));
                GetStockDetails update = new GetStockDetails(prodname, Quantity);
            }
        }