public static void RespondToRequest(ReservationResponse response)
 {
     if (_app != null)
     {
         _app.RespondToRequest(response);
     }
 }
Пример #2
0
        public void RespondToRequest(ReservationResponse response)
        {
            Guid id = response.RequestID;

            WorkflowApplication i = _outgoingRequests[id];

            try
            {
                i.ResumeBookmark("GetResponse", response);
            }
            catch (Exception e2)
            {
                AddEvent(e2.Message);
            }
        }
        protected override void Execute(CodeActivityContext context)
        {
            // Open the config file
            Configuration config = ConfigurationManager
                .OpenExeConfiguration(ConfigurationUserLevel.None);
            AppSettingsSection app =
                (AppSettingsSection)config.GetSection("appSettings");

            // Create the ReservationResponse class and populate it
            ReservationResponse r = new ReservationResponse
                (
                    Request.Get(context),
                    Reserved.Get(context),
                    new Branch
                    {
                        BranchName = app.Settings["Branch Name"].Value,
                        BranchID = new Guid(app.Settings["ID"].Value),
                        Address = app.Settings["Address"].Value
                    }
                );

            // Store the Response in the OutArgument
            Response.Set(context, r);
        }
        protected override void Execute(CodeActivityContext context)
        {
            // Open the config file
            Configuration config = ConfigurationManager
                                   .OpenExeConfiguration(ConfigurationUserLevel.None);
            AppSettingsSection app =
                (AppSettingsSection)config.GetSection("appSettings");

            // Create the ReservationResponse class and populate it
            ReservationResponse r = new ReservationResponse
                                    (
                Request.Get(context),
                Reserved.Get(context),
                new Branch
            {
                BranchName = app.Settings["Branch Name"].Value,
                BranchID   = new Guid(app.Settings["ID"].Value),
                Address    = app.Settings["Address"].Value
            }
                                    );

            // Store the Response in the OutArgument
            Response.Set(context, r);
        }
 public static void RespondToRequest(ReservationResponse response)
 {
     if (_app != null)
         _app.RespondToRequest(response);
 }
        public void RespondToRequest(ReservationResponse response)
        {
            Guid id = response.RequestID;

            WorkflowApplication i = _outgoingRequests[id];
            try
            {
                i.ResumeBookmark("GetResponse", response);
            }
            catch (Exception e2)
            {
                AddEvent(e2.Message);
            }
        }
Пример #7
0
        static void Main(string[] args)
        {
            // Open the config file and get the name for this branch
            // and its network address
            Configuration config = ConfigurationManager
                                   .OpenExeConfiguration(ConfigurationUserLevel.None);
            AppSettingsSection app =
                (AppSettingsSection)config.GetSection("appSettings");

            string adr = app.Settings["Address"].Value;

            Console.WriteLine(app.Settings["Branch Name"].Value);

            // Create a service to handle incoming requests
            WorkflowService service = new WorkflowService
            {
                Name      = "LibraryReservation",
                Body      = new ProcessRequest(),
                Endpoints =
                {
                    new Endpoint
                    {
                        ServiceContractName = "ILibraryReservation",
                        AddressUri          = new Uri("http://localhost:" + adr +
                                                      "/LibraryReservation"),
                        Binding = new BasicHttpBinding(),
                    }
                }
            };

            // Create a WorkflowServiceHost that listens for incoming messages
            System.ServiceModel.Activities.WorkflowServiceHost wsh =
                new System.ServiceModel.Activities.WorkflowServiceHost(service);

            wsh.Open();

            Console.WriteLine
                ("Waiting for requests, press ENTER to send a request.");
            Console.ReadLine();

            // Create dictionary with input arguments for the workflow
            IDictionary <string, object> input = new Dictionary <string, object>
            {
                { "Title", "Gone with the Wind" },
                { "Author", "Margaret Mitchell" },
                { "ISBN", "9781416548898" }
            };

            // Invoke the SendRequest workflow
            IDictionary <string, object> output =
                WorkflowInvoker.Invoke(new SendRequest(), input);
            ReservationResponse resp = (ReservationResponse)output["Response"];

            // Display the response
            Console.WriteLine("Response received from the {0} branch",
                              resp.Provider.BranchName);

            Console.WriteLine();
            Console.WriteLine("Press ENTER to exit");
            Console.ReadLine();

            // Close the WorkflowServiceHost
            wsh.Close();
        }
 public void RespondToRequest(ReservationResponse response)
 {
     ApplicationInterface.RespondToRequest(response);
 }