Exemple #1
0
        private void insertProduct()
        {
            tblProduct          = adpProduct.GetData();
            Cache["tblProduct"] = tblProduct;

            string  name    = txtProductName.Text;
            decimal price   = decimal.Parse(txtPrice.Text);
            int     quant   = int.Parse(txtQuantity.Text);
            int     categID = int.Parse(ddlCategory.SelectedValue);

            int result = adpProduct.Insert(name, price, quant, categID);

            if (result == 1)
            {
                lblErrorMessage.Text      = "Product Inserted ";
                lblErrorMessage.ForeColor = System.Drawing.Color.Yellow;
                txtProductName.Text       = "";
                txtProductNumber.Text     = "";
                ddlCategory.SelectedIndex = -1;
                txtPrice.Text             = "";
                txtQuantity.Text          = "";
            }
            else
            {
                lblErrorMessage.Text      = "Product NOT Inserted";
                lblErrorMessage.ForeColor = System.Drawing.Color.Red;
            }
            Refresh();
        }
        public IEnumerable <Product> GetallData()
        {
            List <Product> li   = new List <Product>();
            var            data = from c in _product.GetData() select c;

            foreach (var item in data)
            {
                var colordata = (from c in _color.GetallData() where c.Colourname == item.Colour && c.ProductId == item.ProductId select c).SingleOrDefault();

                li.Add(new Product
                {
                    BrandId     = item.BrandId,
                    CategoryId  = item.CaregoryId,
                    Colour      = item.Colour,
                    Description = item.Description,
                    Name        = item.ProductName,
                    Price       = Convert.ToSingle(item.Price),
                    ProductId   = item.ProductId,
                    Stock       = item.Stock,
                    Size        = item.Size,
                    MyColorId   = colordata.ColourId
                });
            }
            return(li);
        }
Exemple #3
0
        public List <ProductInfo> GetallProduct()
        {
            List <ProductInfo> infos  = new List <ProductInfo>();
            IDataReader        reader = db.GetData().CreateDataReader();

            while (reader.Read())
            {
                infos.Add(ProductInfo.Populate(reader));
            }
            return(infos);
        }
 /// <summary>
 /// GetDestinationNotes
 /// Function of Get Destination Notes
 /// </summary>
 /// <param name="destID">Destination ID</param>
 /// <param name="session">Session object</param>
 /// <returns>List of Destination Notes</returns>
 public static List <DAL.ProductRow> GetProducts(ISession session, String VersionNo = "")
 {
     try
     {
         ProductTableAdapter ta = new ProductTableAdapter();
         ta.CurrentConnection = session;
         return(ta.GetData().Select().Cast <DAL.ProductRow>().ToList());
     }
     catch (Exception ex)
     {
         throw;
     }
 }