Example #1
0
        private void comboBoxSelectProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            dt = retrieve.GetId("usp_GetProductID", comboBoxSelectProduct.Text);
            textBoxQuantity.Clear();
            textBoxTotalCost.Clear();
            textBoxProdCost.Clear();


            if (dt.Rows.Count > 0)
            {
                ProductId = Convert.ToInt32(dt.Rows[0][0].ToString());

                DataTable dtPrice = new DataTable();
                dtPrice = retrieve.GetProductPrice(ProductId);
                if (dtPrice.Rows.Count > 0)
                {
                    textBoxProdCost.Text = dtPrice.Rows[0][0].ToString();
                }
                foreach (DataGridViewRow row in dataGridViewPOLines.Rows)
                {
                    if (Convert.ToInt32(row.Cells["ProductIdGv"].Value) == ProductId)
                    {
                        textBoxQuantity.Text  = (row.Cells["ProductQuantityGv"].Value).ToString();
                        textBoxTotalCost.Text = (row.Cells["ProductTotalPrice"].Value).ToString();

                        break;
                    }
                }
            }
        }
        private void comboBoxSelectProduct_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            dt = retrieve.GetId("usp_GetProductID", comboBoxSelectProduct.Text);
            textBoxQuantity.Clear();
            textBoxTotalCost.Clear();
            textBoxProdCost.Clear();
            if (dt.Rows.Count > 0)
            {
                ProductId = Convert.ToInt32(dt.Rows[0][0].ToString());
                DataTable dtPrice = new DataTable();
                dtPrice = retrieve.GetProductPrice(ProductId);
                if (dtPrice.Rows.Count > 0)
                {
                    textBoxProdCost.Text = dtPrice.Rows[0][0].ToString();
                    textBoxUnit.Text     = dtPrice.Rows[0][1].ToString();
                }
            }
        }