Ejemplo n.º 1
0
        private void txtBCD_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                wrProducts.Server2Client spc = new wrProducts.Server2Client();
                wrProducts.wsProducts    prd = new wrProducts.wsProducts();
                wrProducts.Product       p   = new wrProducts.Product();

                p = prd.GetProductByBarCode(txtBCD.Text);
                if (p.Quantity < 1)
                {
                    lblInfo.Text = "Product not available!";
                    txtBCD.Text  = "";
                    txtBCD.Focus();
                    return;
                }
                if (p.Message == null)
                {
                    DataRow r = dt.NewRow();
                    r["ProductID"]    = p.ProductID;
                    r["ProductName"]  = p.ProductName;
                    r["BarCode"]      = p.BarCode;
                    r["BuyingValue"]  = p.BuyingValue;
                    r["SellingValue"] = p.SellingValue;
                    r["Quantity"]     = 1;
                    r["Amount"]       = 1 * p.SellingValue;

                    dt.Rows.Add(r);
                    grd.DataSource = dt;
                    grd.Refresh();

                    double TotalAmount = Convert.ToDouble(colAMT.SummaryText);
                    txtAMT.Text = TotalAmount.ToString();
                    txtPAM.Text = TotalAmount.ToString();

                    txtBCD.Text = "";
                    txtBCD.Focus();
                }
                else
                {
                    lblInfo.Text = p.Message;
                }
            }
        }