예제 #1
0
        public SupplierCrmProductResponse AppUpdateProduct(SupplierCrmProduct product)
        {
            ProductOperation           po       = new ProductOperation();
            SupplierCrmProductResponse response = po.AppUpdateProduct(product);

            return(response);
        }
예제 #2
0
        public SupplierCrmProductResponse AppUpdateProduct(SupplierCrmProduct newProduct)
        {
            log.Info("CMS-->Product update:" + newProduct.ProductName);
            SupplierCrmProductResponse response = new SupplierCrmProductResponse();
            CrmUtil cu = new CrmUtil();
            OrganizationServiceProxy organizationProxy = cu.getCrmService();

            try
            {
                Entity    oldProduct = new Entity("product");
                ColumnSet attributes = new ColumnSet(new string[] { "quantityonhand" });

                oldProduct = organizationProxy.Retrieve(oldProduct.LogicalName, new Guid(newProduct.ProductId), attributes);

                //oldProduct["productnumber"] = newProduct.ProductName;
                //oldProduct["name"] = newProduct.ProductSku;
                //oldProduct["description"] = newProduct.ProductDescription;
                oldProduct["quantityonhand"] = Decimal.Parse(newProduct.Quantity);


                organizationProxy.Update(oldProduct);

                response.result = "success";
                return(response);
            }
            catch (Exception ex)
            {
                log.Info(ex.Message + "--" + ex.ToString());
            }
            return(null);
        }