Пример #1
0
        public void SearchAvailableProducts(int stateid, string productid, string productname)
        {
            client = new SQSAdminServiceClient();
            client.Endpoint.Address = new System.ServiceModel.EndpointAddress(CommonVariables.WcfEndpoint);
            DataSet ds = client.SQSAdmin_StudioM_GetStudioMProduct(stateid, productid, productname);

            AvailableProduct.Clear();
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                Product p = new Product();
                p.ProductID   = dr["productid"].ToString();
                p.ProductName = dr["productname"].ToString();
                //p.ProductDescription = dr["productdescription"].ToString();
                bool exists = false;
                foreach (Product prod in SelectedProduct)
                {
                    if (p.ProductID == prod.ProductID)
                    {
                        exists = true;
                        break;
                    }
                }
                if (!exists)
                {
                    AvailableProduct.Add(p);
                }
            }
        }
Пример #2
0
        private void AddToStock(Product product, int quantity, float costprice)
        {
            foreach (var item in AvailableProduct)
            {
                if (item.ProductName == product.ProductName)
                {
                    item.Quantity     += quantity;
                    item.BasePrice     = costprice;
                    item.DatePurchased = DateTime.Now.Date;
                    return;
                }
            }

            product.Quantity  = quantity;
            product.BasePrice = costprice;

            AvailableProduct.Add(product);
        }