Пример #1
0
        public static string getItemId(string productId)
        {
            string itemId = string.Empty;
            SoapEntityRepository entityRepository = SoapEntityRepository.GetService();

            xrm.Product products = (xrm.Product)entityRepository.GetEntity(xrm.Product.EntityLogicalName, new Guid(productId), new ColumnSet("mzk_axitemid"));

            if (products != null)
            {
                itemId = products.mzk_AXItemId;
            }

            return(itemId);
        }
Пример #2
0
        public Products getProductDetails(string productId)
        {
            string itemId = string.Empty;
            SoapEntityRepository entityRepository = SoapEntityRepository.GetService();

            xrm.Product products = (xrm.Product)entityRepository.GetEntity(xrm.Product.EntityLogicalName, new Guid(productId), new ColumnSet(true));
            Products    model    = new Products();

            if (products != null)
            {
                if (products.Attributes.Contains("name"))
                {
                    model.Name = products.Name;
                }

                if (products.Attributes.Contains("productnumber"))
                {
                    model.ProductNumber = products.ProductNumber;
                }

                if (products.ProductId.HasValue)
                {
                    model.ProductId = products.ProductId.Value.ToString();
                }

                if (products.mzk_ProductType != null)
                {
                    model.Type = products.mzk_ProductType.Value.ToString();
                }

                if (products.mzk_Contrast.HasValue)
                {
                    model.contrastOrder = products.mzk_Contrast.Value;
                }

                if (products.Attributes.Contains("mzk_specimensource"))
                {
                    model.IsSpecimenSource = (bool)products.Attributes["mzk_specimensource"];
                }
            }

            return(model);
        }