private IEnumerable <CatalogItem> GetFolderContent(string path, CatalogItemType type)
        {
            var ctx    = PortalAccessorV1.CreateContext();
            var folder = ctx.CatalogItemByPath(path).CastToFolder().GetValue();

            switch (type)
            {
            case CatalogItemType.Folder:
                return(GetCatalogItems <Folder>(ctx, folder.Id).Cast <CatalogItem>());

            case CatalogItemType.Report:
                return(GetCatalogItems <Report>(ctx, folder.Id).Cast <CatalogItem>());

            case CatalogItemType.LinkedReport:
                return(GetCatalogItems <LinkedReport>(ctx, folder.Id).Cast <CatalogItem>());

            case CatalogItemType.Kpi:
                return(GetCatalogItems <Kpi>(ctx, folder.Id).Cast <CatalogItem>());

            case CatalogItemType.MobileReport:
                return(GetCatalogItems <MobileReport>(ctx, folder.Id).Cast <CatalogItem>());

            case CatalogItemType.DataSet:
                return(GetCatalogItems <DataSet>(ctx, folder.Id).Cast <CatalogItem>());

            case CatalogItemType.DataSource:
                return(GetCatalogItems <DataSource>(ctx, folder.Id).Cast <CatalogItem>());

            case CatalogItemType.Resource:
                return(GetCatalogItems <Resource>(ctx, folder.Id).Cast <CatalogItem>());

            default:
                throw new NotSupportedException();
            }
        }
 private Action <List <PurchaseOrderItem> > GetProcessors(CatalogItemType catalogItemType)
 {
     if (_processors.TryGetValue(catalogItemType, out var processor))
     {
         return(processor);
     }
     throw new InvalidOperationException("Matching Processor not found");
 }
示例#3
0
 public CatalogItem AddCatalogItem(CatalogItemType catalogItemType)
 {
     try
     {
         return(new CatalogItem(this.VcloudClient, SdkUtil.Post <CatalogItemType>(this.VcloudClient, this.Reference.href.Replace("/admin", "") + "/catalogItems", SerializationUtil.SerializeObject <CatalogItemType>(catalogItemType, "com.vmware.vcloud.api.rest.schema"), "application/vnd.vmware.vcloud.catalogItem+xml", 201)));
     }
     catch (Exception ex)
     {
         throw new VCloudException(ex.Message);
     }
 }
示例#4
0
 public CatalogItemOrdered(int catalogItemId, CatalogItemType catalogItemType,
                           string productName, string pictureUri)
 {
     Guard.Against.OutOfRange(catalogItemId, nameof(catalogItemId), 1, int.MaxValue);
     Guard.Against.NullOrEmpty(productName, nameof(productName));
     Guard.Against.NullOrEmpty(pictureUri, nameof(pictureUri));
     Guard.Against.Null(catalogItemType, nameof(catalogItemType));
     CatalogItemId   = catalogItemId;
     CatalogItemType = catalogItemType;
     ProductName     = productName;
     PictureUri      = pictureUri;
 }
        private static bool MatchesTypeFilter(SsrsFilterObjectTypes filterTypes, CatalogItemType type)
        {
            if (filterTypes == SsrsFilterObjectTypes.All)
            {
                return(true);
            }
            switch (type)
            {
            case CatalogItemType.DataSource: return((filterTypes & SsrsFilterObjectTypes.DataSource) != 0);

            case CatalogItemType.Report:     return((filterTypes & SsrsFilterObjectTypes.Report) != 0);

            case CatalogItemType.DataSet:    return((filterTypes & SsrsFilterObjectTypes.DataSet) != 0);
            }
            return(false);
        }
示例#6
0
        private void AddResourceToCatalog(ReferenceType resourceRef, Catalog catalog)
        {
            CatalogItemType catalogItemType = new CatalogItemType();

            catalogItemType.name   = resourceRef.name;
            catalogItemType.Entity = resourceRef;
            CatalogItem catalogItem;

            try
            {
                catalogItem = catalog.AddCatalogItem(catalogItemType);
            }
            catch (VCloudException ex)
            {
                throw new ResourceNotAddedException(ex, resourceRef);
            }
            if (catalogItem.Tasks.Count <= 0)
            {
                return;
            }
            catalogItem.Tasks[0].WaitForTask(0L);
        }
        /// <summary>
        /// Verifies Po Posting with CBL3.
        /// </summary>
        /// <param name="qatoolsTargetUrl"></param>
        /// <param name="fileName"></param>
        /// <param name="poRefNum"></param>
        /// <param name="identityName"></param>
        /// <param name="supplierPartIdExt"></param>
        /// <param name="unitPrice"></param>
        /// <param name="quantity"></param>
        public string VerifyDownloadAndPoPostingwithCxml(B2BEnvironment environment, CatalogItemType itemType, CatalogType type, CatalogStatus status, Region region, CRTStatus crtStatus,
                                                         string fileName, string poRefNum, string profileName, string identityName, string quantity)
        {
            //uniquePoRefNum = poRefNum + DateTime.Today.ToString("yyMMdd") + DateTime.Now.ToString("HHmmss");
            uniquePoRefNum = poRefNum + DateTime.Now.ToString("ffffff");
            ChannelCatalogWorkflow uxWorkFlow = new ChannelCatalogWorkflow(webDriver);
            CatalogItem            item       = uxWorkFlow.GetCatalogItem(environment, itemType, type, status, region, profileName, identityName);

            webDriver = webDriver.SwitchBrowser(BrowserName.InternetExplorer);
            webDriver.Navigate().GoToUrl(Convert.ToString(ConfigurationManager.AppSettings["BasePOURL"]));
            B2BQaToolsPage = new B2BQaToolsPage(webDriver);

            B2BQaToolsPage.PasteTargetUrl((environment == B2BEnvironment.Production) ? Convert.ToString(ConfigurationManager.AppSettings["QAToolsTargetUrlProd"])
                : Convert.ToString(ConfigurationManager.AppSettings["QAToolsTargetUrlPrev"]));

            string supplierPartIdExt = string.Empty;

            supplierPartIdExt = (crtStatus == CRTStatus.OFF) ? item.PartId : item.ManufacturerPartNumber;
            var unitPrice = Convert.ToString(item.UnitPrice);
            var file      = PoXmlGenerator.GeneratePoCxmll(fileName, uniquePoRefNum, profileName, identityName, supplierPartIdExt, unitPrice, quantity);

            B2BQaToolsPage.PasteInputXml(file);
            webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromMinutes(2));
            B2BQaToolsPage.ClickSubmitMessage();
            if (B2BQaToolsPage.GetSubmissionResult().Equals("XML Response received from server Code: 200. Message: PO = " + uniquePoRefNum))
            {
                webDriver.Quit();
                Console.WriteLine("Success: PO Number: " + uniquePoRefNum);
                return(uniquePoRefNum);
            }
            else
            {
                Console.WriteLine("Error while posting PO: " + B2BQaToolsPage.GetSubmissionResult());
                Console.WriteLine("Fail: PO Number: " + uniquePoRefNum);
                throw new Exception("Error while posting PO: " + uniquePoRefNum);
            }
        }
示例#8
0
 public CatalogItemInfoBuilder WithType(CatalogItemType type)
 {
     _type = type;
     return(this);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CatalogItemUrlData"/> class.
 /// </summary>
 /// <param name="itemType">Type of the item.</param>
 /// <param name="catalogItemId">The catalog item identifier.</param>
 public CatalogItemUrlData(CatalogItemType itemType, string catalogItemId)
 {
     this.ItemType      = itemType;
     this.CatalogItemId = catalogItemId;
 }
示例#10
0
 public CatalogItemInfo(string name, string path, CatalogItemType type)
 {
     Name = name;
     Path = path;
     Type = type;
 }
示例#11
0
 public CatalogItemInfoBuilder WithType(CatalogItemType type)
 {
     _type = type;
     return this;
 }
示例#12
0
        private ICatalogItemContext CreateCatalogContextFromCatalogItemRoute(RouteData routeData, CatalogItemType itemType, Database database)
        {
            var data = new CatalogRouteData
            {
                ItemType = itemType
            };

            if (routeData.Values.ContainsKey("id"))
            {
                data.Id = CatalogUrlRepository.ExtractItemId(routeData.Values["id"].ToString());
            }

            if (string.IsNullOrWhiteSpace(data.Id))
            {
                return(null);
            }

            if (routeData.Values.ContainsKey("catalog"))
            {
                data.Catalog = routeData.Values["catalog"].ToString();
            }
            if (string.IsNullOrEmpty(data.Catalog))
            {
                data.Catalog = CatalogManager.CatalogContext?.CurrentCatalog?.Name;
            }
            if (string.IsNullOrEmpty(data.Catalog))
            {
                return(null);
            }

            var item = GetCatalogItem(data, database);

            if (item == null)
            {
                return(null);
            }
            data.Item = item;

            if (routeData.Values.ContainsKey("category"))
            {
                data.CategoryId = CatalogUrlRepository.ExtractItemId(routeData.Values["category"].ToString());
            }
            if (string.IsNullOrEmpty(data.CategoryId))
            {
                data.CategoryId = GetCategoryIdFromItem(data.Item);
            }

            return(data);
        }
示例#13
0
 public CatalogItemInfo(string name, string path, CatalogItemType type)
 {
     Name = name;
     Path = path;
     Type = type;
 }