Example #1
0
        private void loadFields()
        {
            int id = int.Parse(txtProductNumber.Text);

            tblProduct          = adpProduct.GetDataBy(id);
            Cache["tblProduct"] = tblProduct;

            var row = tblProduct;

            if (row.Count > 0)
            {
                if (row != null)
                {
                    string name = row[0].ProductName.ToString();
                    txtProductName.Text = name.Trim();
                    txtPrice.Text       = row[0].ProductPrice.ToString();
                    txtQuantity.Text    = row[0].ProductInStock.ToString();
                    int deptid = row[0].ProductCategory;
                    ddlCategory.SelectedValue = deptid.ToString();
                }
            }
            else
            {
                lblErrorMessage.Text      = " Product ID " + id + " is not found";
                lblErrorMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
Example #2
0
        private Products getProductInformation()
        {
            Products prod = new Products();

            int id = int.Parse(ddlProductName.SelectedValue);

            tblProduct = adpProduct.GetDataBy(id);

            var row = tblProduct;

            if (row != null)
            {
                prod.PName         = row[0].ProductName.ToString();
                prod.PProductID    = row[0].ProductId;
                prod.PPrice        = row[0].ProductPrice;
                prod.PQuantity     = row[0].ProductInStock;
                prod.PProductCateg = row[0].ProductCategory;
            }

            return(prod);
        }