public void VerifyGetMarketplaceAssetDetails()
        {
            //This is the id of the publishing activity
            long assetId = 16;

            assetSearchRequest = GenerateAssetSearchRequest(assetId);
            MarketplaceAssetDetails result = GetMarketplaceAssetDetails(assetSearchRequest);

            Assert.IsNotNull(result, "Failed to get asset details");
            Assert.AreEqual(result.Id, assetId, "Failed to get publishing activity.");
            Assert.AreEqual(result.Name, "Publishing", "Failed to get publishing activity.");
            Assert.AreEqual(result.Activities.Count, 2, "Failed to get the contained activities.");
        }
        /// <summary>
        /// This should return the fields from ActivityLibraries and StoreActivities tables 
        /// to match the MarketplaceAssetDetails data contract
        /// </summary>
        /// <param name="request"></param>
        /// <returns>MarketplaceAssetDetails object</returns>
        public static MarketplaceAssetDetails GetMarketplaceAssetDetails(MarketplaceSearchDetail request)
        {
            MarketplaceAssetDetails reply = null;
            List<ActivityQuickInfo> activities = new List<ActivityQuickInfo>();
            try
            {
                Database database = DatabaseFactory.CreateDatabase();
                DbCommand command = database.GetStoredProcCommand("[dbo].[Marketplace_GetAssetDetails]");
                database.AddParameter(command, StoredProcParamNames.Id, DbType.Int64, ParameterDirection.Input, null, DataRowVersion.Default, request.Id);
                database.AddParameter(command, "@AssetType", DbType.Int16, ParameterDirection.Input, null, DataRowVersion.Default, request.AssetType);

                using (IDataReader reader = database.ExecuteReader(command))
                {
                    if (reader.Read())
                    {
                        reply = new MarketplaceAssetDetails();
                        reply.Id = Convert.ToInt64(reader["Id"]);
                        reply.Name = Convert.ToString(reader["Name"]);
                        reply.Description = Convert.ToString(reader["Description"]);
                        reply.MetaTages = Convert.ToString(reader["MetaTags"]);
                        reply.CategoryName = Convert.ToString(reader["CategoryName"]);
                        reply.ThumbnailUrl = Convert.ToString(reader["ThumbnailUrl"]);
                        if (request.AssetType == AssetType.Activities)
                        {
                            reader.NextResult();
                            while (reader.Read())
                            {
                                ActivityQuickInfo activity = new ActivityQuickInfo();
                                activity.Version = Convert.ToString(reader["Version"]);
                                activity.Id = Convert.ToInt64(reader["ActivityId"]);
                                activity.Name = Convert.ToString(reader["ActivityName"]);
                                activities.Add(activity);
                            }
                            reply.Activities = activities;
                        }
                    }
                }
            }
            catch (SqlException e)
            {
                e.HandleException();
            }

            return reply;
        }
 private static MarketplaceSearchDetail CreateGetMarketplaceAssetDetailsGetRequest()
 {
     MarketplaceSearchDetail request = new MarketplaceSearchDetail();
     request.Id = 0;
     request.AssetType = AssetType.Project;
     return request;
 }
 /// <summary>
 /// This method invokes MarketplaceBusinessService.GetAssetDetails operation.
 /// </summary>
 /// <returns></returns>
 public MarketplaceAssetDetails GetMarketplaceAssetDetails(MarketplaceSearchDetail request)
 {
     return MarketplaceRepositoryService.GetMarketplaceAssetDetails(request);
 }
        /// <summary>
        /// load marketplace details data for UI displaying
        /// </summary>
        /// <param name="client"></param>
        public void SearchMarketplaceAssertDetails(IWorkflowsQueryService client)
        {
            if (assetItem == null)
                return;
            MarketplaceSearchDetail search = new MarketplaceSearchDetail();
            search.AssetType = assetItem.AssetType;
            search.Id = assetItem.Id;
            details = client.GetMarketplaceAssetDetails(search);
            RaisePropertyChanged(() => MetaDataVisible);
            RaisePropertyChanged(() => ActivitiesVisible);

            if (details != null)
            {
                this.MarketplaceAssetFieldValues.Clear();
                AssetName = this.details.Name;
                this.MarketplaceAssetFieldValues.Add(new FieldValue() { Field = "Type", Value = this.assetItem.AssetType.ToString() });
                this.MarketplaceAssetFieldValues.Add(new FieldValue() { Field = "Version", Value = this.assetItem.Version, });

                if (assetItem.AssetType == AssetType.Activities)
                {
                    this.MarketplaceAssetFieldValues.Add(new FieldValue() { Field = "Category", Value = details.CategoryName, });
                    if (details.Activities != null && details.Activities.Count > 0)
                    {
                        this.MarketplaceAssetFieldValues.Add(new FieldValue() { Field = "Activities", Value = details.Activities.Count.ToString(), });
                        this.IncludedActivities = new ObservableCollection<ActivityQuickInfo>(details.Activities);
                        this.RightPaneTitle = "INCLUDED ACTIVITIES(" + this.IncludedActivities.Count + ")";
                    }
                    else
                    {
                        this.RightPaneTitle = "INCLUDED ACTIVITIES(0)";
                        this.MarketplaceAssetFieldValues.Add(new FieldValue() { Field = "Activities", Value = "None", });
                    }
                }
                this.MarketplaceAssetFieldValues.Add(new FieldValue() { Field = "Description", Value = details.Description, });
                this.MarketplaceAssetFieldValues.Add(new FieldValue() { Field = "Tags", Value = details.MetaTages, });
                this.IconUrl = details.ThumbnailUrl;
            }
        }
 /// <summary>
 /// Get the marketplace asset details
 /// </summary>
 /// <param name="assetSearchRequest">MarketplaceSearchDetail</param>
 /// <returns>MarketplaceAssetDetails</returns>
 private MarketplaceAssetDetails GetMarketplaceAssetDetails(MarketplaceSearchDetail assetSearchRequest)
 {
     return devBranchProxy.GetMarketplaceAssetDetails(assetSearchRequest);
 }
        /// <summary>
        /// Generate MarketplaceAssetSearchDetail
        /// </summary>
        /// <param name="activityLibraryId">The id of the activity or project</param>
        /// <param name="assetType">Asset Type</param>
        /// <returns>MarketplaceSearchDetail</returns>
        private MarketplaceSearchDetail GenerateAssetSearchRequest(long id, AssetType assetType = AssetType.Activities)
        {
            MarketplaceSearchDetail request = new MarketplaceSearchDetail();
            request.Id = id;
            request.AssetType = assetType;

            return request;
        }
 /// <summary>
 /// This method invokes MarketplaceBusinessService.GetAssetDetails operation.
 /// </summary>
 /// <returns></returns>
 public static MarketplaceAssetDetails GetMarketplaceAssetDetails(MarketplaceSearchDetail request)
 {
     return Microsoft.Support.Workflow.Service.DataAccessServices.MarketplaceRepositoryService.GetMarketplaceAssetDetails(request);
 }