Esempio n. 1
0
        /// <summary>
        /// ActivityLibraryDependenciesCreateOrUpdate
        /// </summary>
        /// <param name="rootName"></param>
        /// <param name="rootVersion"></param>
        /// <param name="list"></param>
        /// <param name="incaller"></param>
        /// <param name="incallerVersion"></param>
        /// <param name="insertedByUserAlias"></param>
        /// <param name="updatedByUserAlias"></param>
        private static StatusReplyDC ActivityLibraryDependenciesCreateOrUpdate(string rootName,
            string rootVersion,
            List<StoreActivityLibraryDependenciesGroupsRequestDC> list,
            string incaller,
            string incallerVersion,
            string insertedByUserAlias,
            string updatedByUserAlias)
        {
            foreach (StoreActivityLibraryDependenciesGroupsRequestDC l1 in list)
            {
                StoreActivityLibrariesDependenciesDC reply = null;
                var storeActivityLibrariesDependenciesDC = new StoreActivityLibrariesDependenciesDC();
                var storeDependenciesDependentActiveLibrary = new StoreDependenciesDependentActiveLibrary();

                storeActivityLibrariesDependenciesDC.InsertedByUserAlias = insertedByUserAlias;
                storeActivityLibrariesDependenciesDC.UpdatedByUserAlias = updatedByUserAlias;
                storeActivityLibrariesDependenciesDC.Incaller = incaller;
                storeActivityLibrariesDependenciesDC.IncallerVersion = incallerVersion;
                storeActivityLibrariesDependenciesDC.StoreDependenciesRootActiveLibrary =
                    new StoreDependenciesRootActiveLibrary();
                storeActivityLibrariesDependenciesDC.StoreDependenciesRootActiveLibrary.ActivityLibraryName = rootName;
                storeActivityLibrariesDependenciesDC.StoreDependenciesRootActiveLibrary.ActivityLibraryVersionNumber =
                    rootVersion;

                storeDependenciesDependentActiveLibrary.ActivityLibraryDependentName = l1.Name;
                storeDependenciesDependentActiveLibrary.ActivityLibraryDependentVersionNumber = l1.Version;
                storeActivityLibrariesDependenciesDC.StoreDependenciesDependentActiveLibraryList =
                    new List<StoreDependenciesDependentActiveLibrary>();
                storeActivityLibrariesDependenciesDC.StoreDependenciesDependentActiveLibraryList.Add(
                    storeDependenciesDependentActiveLibrary);

                reply = ActivityLibraryDependency.StoreActivityLibraryDependenciesCreateOrUpdate(storeActivityLibrariesDependenciesDC);
                if (reply.StatusReply.Errorcode != 0)
                    return reply.StatusReply;
                // Write the dependency table entry
                if (l1.List != null)
                    ActivityLibraryDependenciesCreateOrUpdate(rootName, rootVersion, l1.List, incaller, incallerVersion,
                                                              insertedByUserAlias, updatedByUserAlias);
            }
            return new StatusReplyDC();
        }
Esempio n. 2
0
        public static StoreActivityLibrariesDependenciesDC StoreActivityLibraryDependencyList(StoreActivityLibrariesDependenciesDC request)
        {
            var statusReply = new StatusReplyDC();
            //// StoreDependenciesDependentActiveLibrary  dal = null;
            var storeActivityLibrariesDependenciesDC = new StoreActivityLibrariesDependenciesDC();
            storeActivityLibrariesDependenciesDC.StoreDependenciesDependentActiveLibraryList =
                new List<StoreDependenciesDependentActiveLibrary>();
            storeActivityLibrariesDependenciesDC.StoreDependenciesRootActiveLibrary =
                request.StoreDependenciesRootActiveLibrary;
            StoreActivityLibrariesDependenciesDC reply = null;

            using (var transaction = new TransactionScope())
            {
                try
                {
                    if (request == null)
                    {
                        statusReply.Errorcode = SprocValues.REQUEST_OBJECT_IS_NULL_ID;
                        statusReply.ErrorMessage = SprocValues.REQUEST_OBJECT_IS_NULL_MSG;
                        throw new Exception(statusReply.ErrorMessage);
                    }

                    if (request.StoreDependenciesRootActiveLibrary == null)
                    {
                        statusReply.Errorcode =
                            SprocValues.REQUEST_ACTION_STORE_DEPENDENCIES_ROOTACTIVITY_LIBRARY_IS_NULL_ID;
                        statusReply.ErrorMessage =
                            SprocValues.REQUEST_ACTION_STORE_DEPENDENCIES_ROOTACTIVITY_LIBRARY_IS_NULL_MSG;
                        throw new Exception(statusReply.ErrorMessage);
                    }

                    if (request.StoreDependenciesDependentActiveLibraryList == null)
                    {
                        statusReply.Errorcode =
                            SprocValues.REQUEST_ACTION_STORE_DEPENDENCIES_DEPENDENT_ACTIVITY_LIBRARY_IS_NULL_ID;
                        statusReply.ErrorMessage =
                            SprocValues.REQUEST_ACTION_STORE_DEPENDENCIES_DEPENDENT_ACTIVITY_LIBRARY_IS_NULL_MSG;
                        throw new Exception(statusReply.ErrorMessage);
                    }

                    storeActivityLibrariesDependenciesDC.StoreDependenciesRootActiveLibrary =
                        request.StoreDependenciesRootActiveLibrary;
                    //// CreateOrUpdate ActivityLibraryDependencies
                    foreach (var dependentLibrary in request.StoreDependenciesDependentActiveLibraryList)
                    {
                        storeActivityLibrariesDependenciesDC.StoreDependenciesDependentActiveLibraryList.Add(
                            dependentLibrary);
                        storeActivityLibrariesDependenciesDC.Incaller = request.Incaller;
                        storeActivityLibrariesDependenciesDC.IncallerVersion = request.IncallerVersion;
                        storeActivityLibrariesDependenciesDC.InsertedByUserAlias = request.InsertedByUserAlias;
                        storeActivityLibrariesDependenciesDC.UpdatedByUserAlias = request.UpdatedByUserAlias;
                        reply = ActivityLibraryDependency.StoreActivityLibraryDependenciesCreateOrUpdate(storeActivityLibrariesDependenciesDC);
                        if (reply.StatusReply.Errorcode != 0)
                            throw new Exception(reply.StatusReply.ErrorMessage);
                        storeActivityLibrariesDependenciesDC.StoreDependenciesDependentActiveLibraryList.Remove(dependentLibrary);
                    }
                }
                catch (TransactionAbortedException)
                {
                    //// TODO temp removal of faults tex case
                    //// throw new FaultException(new FaultReason(Convert.ToString(reply.StatusReply.Errorcode) + "|" + reply.StatusReply.ErrorMessage));
                    statusReply.ErrorMessage = reply.StatusReply.ErrorMessage;
                    statusReply.Errorcode = reply.StatusReply.Errorcode;
                }
                catch (Exception)
                {
                    //// TODO temp removal of faults ex case
                    //// throw new FaultException(new FaultReason(Convert.ToString(reply.StatusReply.Errorcode) + "|" + reply.StatusReply.ErrorMessage));
                    statusReply.ErrorMessage = reply.StatusReply.ErrorMessage;
                    statusReply.Errorcode = reply.StatusReply.Errorcode;
                }

                transaction.Complete();
            }

            return reply;
        }
        /// <summary>
        /// Gets the list of all the dependencies in the dependency hierarchy for an an activity library while handling any exceptions to return
        /// them as service faults to the caller.
        /// </summary>
        /// <param name="request">Request that defines the root activity library for which the dependencies are to be found.</param>
        /// <returns>Response that contains a list of dependencies.</returns>
        public List<StoreActivityLibrariesDependenciesDC> StoreActivityLibraryDependenciesTreeGet(StoreActivityLibrariesDependenciesDC request)
        {
            List<StoreActivityLibrariesDependenciesDC> reply = null;

            try
            {
                reply = ActivityLibraryDependencyBusinessService.GetActivityLibraryDependencyTree(request);
            }
            catch (BusinessException e)
            {
                e.HandleException();
            }
            catch (Exception e)
            {
                // Handles unhandled exception.
                e.HandleException();
            }
            return reply;
        }
        /// <summary>
        /// Stores the ActivityLibrary dependency list pairs (ActivityLibrary and dependent ActivityLibrary)
        /// </summary>
        /// <param name="request">request object</param>
        /// <returns>StoreActivityLibrariesDependenciesDC object</returns>
        public StoreActivityLibrariesDependenciesDC StoreActivityLibraryDependencyList(StoreActivityLibrariesDependenciesDC request)
        {
            //// Eliminate with validation pipeline implementation
            if (request == null)
            {
                StoreActivityLibrariesDependenciesDC reply = new StoreActivityLibrariesDependenciesDC();
                reply.StatusReply = SetupStatusreplyNullRequestError();
                return reply;
            }

            return BAL.Services.StoreActivityLibraryDependencyList(request);
        }
Esempio n. 5
0
        /// <summary>
        /// Download dependencies and copy them to the deploy directory's \bin subdirectory
        /// </summary>
        /// <param name="client"></param>
        /// <param name="destinationDirectoryPath"></param>
        /// <param name="dependencies"></param>
        public static void DownloadDependencies(IWorkflowsQueryService client, string destinationDirectoryPath, StoreActivityLibrariesDependenciesDC dependencies)
        {
            // IIS needs assemblies to go under bin subdirectory whereas .xamlx goes in the root
            string binPath = Path.Combine(destinationDirectoryPath, "bin");
            Directory.CreateDirectory(binPath);

            foreach (var dependentAssembly in dependencies.StoreDependenciesDependentActiveLibraryList)
            {
                var reply = client.ActivityLibraryGet(new ActivityLibraryDC
                {
                    Incaller = "DeployToIIS Activity",
                    IncallerVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                    Id = dependentAssembly.activityLibraryDependentId
                }).Single();
                string destFile = Path.Combine(binPath, reply.Name + ".dll");
                File.WriteAllBytes(destFile, reply.Executable);
            }
        }