using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

using HCM.BajaWare.Services;

namespace HCM.BajaWare.TestHost
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("*************************HCM.BAJAWARE Services Versión 0.1.0****************************");
                Console.WriteLine("Iniciando servicios...");
                Console.WriteLine();

                using (ServiceHost host1 = new ServiceHost(typeof(InterfacesService)))
                {
                    host1.Open();
                    Console.WriteLine("InterfacesService Iniciado!");
                    Console.WriteLine();




                    using (ServiceHost host2 = new ServiceHost(typeof(InterfacesServicePersonas)))
                    {
                        host2.Open();
                        Console.WriteLine("InterfacesServicePersonas Iniciado!");
                        Console.WriteLine();



                        using (ServiceHost host3 = new ServiceHost(typeof(InterfacesServicesCatalogos)))
                        {
                            host3.Open();
                            Console.WriteLine("InterfacesServiceCatalogos Iniciado!");
                            Console.WriteLine();

                            using (ServiceHost host4 = new ServiceHost(typeof(CreditoEmpresarialService)))
                            {
                                host4.Open();
                                Console.WriteLine("CreditoEmpresarialService Iniciado!");
                                Console.WriteLine();

                                using (ServiceHost host5 = new ServiceHost(typeof(InterfacesServiceGarantias)))
                                {
                                    host5.Open();
                                    Console.WriteLine("InterfacesServiceGarantias Iniciado!");
                                    Console.WriteLine();



                                    using (ServiceHost host6 = new ServiceHost(typeof(InterfaceServicesAccionistas)))
                                    {
                                        host6.Open();
                                        Console.WriteLine("InterfacesServiceAccionistas Iniciado!");
                                        Console.WriteLine();

                                        using (ServiceHost host7 = new ServiceHost(typeof(InterfaceServicesAavales)))
                                        {
                                            host7.Open();
                                            Console.WriteLine("InterfaceServicesAavales Iniciado!");
                                            Console.WriteLine();
                                            using (ServiceHost host8 = new ServiceHost(typeof(InterfacesServiceCreditHipot)))
                                            {
                                                host8.Open();
                                                Console.WriteLine("InterfacesServiceCreditHipot Iniciado!");
                                                Console.WriteLine();
                                                
                                                using (ServiceHost host9 = new ServiceHost(typeof(MonitoreoDatosService)))
                                                {
                                                    host9.Open();
                                                    Console.WriteLine("MonitoreoDatosService Iniciado!");
                                                    Console.WriteLine();

                                                  
                                                    using (ServiceHost host10 = new ServiceHost(typeof(InterfacesServicePermisos)))
                                                    {
                                                        host10.Open();
                                                        Console.WriteLine("InterfacesServicePermisos Iniciado!");
                                                        Console.WriteLine();

                                                        Console.ReadKey();
                                                        host1.Close();
                                                        host2.Close();
                                                        host3.Close();
                                                        host4.Close();
                                                        host5.Close();
                                                        host6.Close();
                                                        host7.Close();
                                                        host8.Close();
                                                        host9.Close();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine("Error al iniciar servicios:");
                Console.WriteLine(ex.Message);
                Console.WriteLine("*****************************************************************");
                Console.WriteLine();
                Console.WriteLine("Presione cualquier tecla para terminar...");
                Console.ReadKey();
            }

        }


    }
}

