public MainWindow()
        {
            #region Temporizador para la actualizacion automatica de datos
            aTimer          = new System.Timers.Timer(1000 * 55);
            aTimer.Elapsed += OnTimedEvent;
            //aTimer.Enabled = true;
            aTimer.Start();
            #endregion

            LogManager.Instancia.Mensajes.CollectionChanged += Mensajes_CollectionChanged;
            this.DataContext = this;
            Servidor.Instancia.PuertoHttp = 8000;
            Servidor.Instancia.PuertoTCP  = 8081;
            InitializeComponent();
            try
            {
                this.crearHosts();
                var reg = new Inteldev.Fixius.Negocios.RegistroNegocios();
                FabricaNegocios.Instancia.CargarRegistro(reg);

                //  Microsoft.Practices.Unity.ParameterOverride[] para = { new Microsoft.Practices.Unity.ParameterOverride("empresa", null), new Microsoft.Practices.Unity.ParameterOverride("entidad", typeof(Inteldev.Fixius.Modelo.Preventa.Preventista).Name.ToLower()) };
                //  var creprev = FabricaNegocios.Instancia.Resolver(typeof(ICreador<Inteldev.Fixius.Modelo.Preventa.Preventista>),para);

                //esto no me gusta mucho
                Inteldev.Fixius.Servicios.RegistroMapeos mapeos = new Inteldev.Fixius.Servicios.RegistroMapeos();
                mapeos.Configurar();
                var a = FabricaNegocios._Resolver <Inteldev.Core.Negocios.Menu.IGestorMenu>();
                var m = FabricaServicios._Resolver <Inteldev.Fixius.Servicios.DTO.Proveedores.Proveedor>();
                this.registro = new RegistroMapeadores();
                foreach (Mapeador item in registro.Mapeadores)
                {
                    this.dataGridMapaeadoresFox.ItemsSource = this.registro.Mapeadores;
                }
                a.Crear();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.ToString());
            }
            this.PresentadorContexto           = new PresentadorGrillaServidor <Inteldev.Fixius.Modelo.Contexto, Inteldev.Fixius.Servicios.DTO.Contexto, ItemContexto>();
            this.PresentadorEmpresaContexto    = new PresentadorEmpresaContexto();
            this.PresentadorEmpresaEntidad     = new PresentadorEmpresaEntidad();
            this.dataGridRegistros.ItemsSource = FabricaNegocios.Instancia.ObtenerRegistro();
        }
Пример #2
0
        static void Main(string[] args)
        {
            FabricaNegocios.Instancia.CargarRegistro(new RegistroNegocios());

            Inteldev.Fixius.Servicios.RegistroMapeos mapeos = new Inteldev.Fixius.Servicios.RegistroMapeos();

            mapeos.Configurar();

            //var contextoInicial = new ContextoInicial();

            //var empresa = new Empresa();

            //empresa.Codigo = "01";
            //empresa.Nombre = "Hola";

            // contextoInicial.Insertar<Empresa>(empresa, new Usuario());
            // contextoInicial.SaveChanges();

            //var configuracion = new RelacionEmpresaEntidad();

            //var relacion = new ConfiguraEmpresa();
            //relacion.Empresa = contextoInicial.Consultar<Empresa>(CargarRelaciones.CargarEntidades).FirstOrDefault(p=>p.Id==1);
            //relacion.Contexto.StringConnecion= "Inteldev.Fixius.Datos.Extra";

            ////contextoInicial.ConfiguraEmpresa.Add(relacion);

            //var relacion2 = new ConfiguraEmpresa();
            //relacion2.Empresa = contextoInicial.Consultar<Empresa>(CargarRelaciones.CargarEntidades).FirstOrDefault(p => p.Id == 1);
            //relacion2.Contexto.StringConnecion = "Inteldev.Fixius.Datos.ContextoGenerico";

            ////contextoInicial.ConfiguraEmpresa.Add(relacion2);

            //configuracion.Relacion = relacion;
            //configuracion.Entidad = "provincia";
            //configuracion.Grupo = 0;

            //contextoInicial.RelacionEmpresaEntida.Add(configuracion);

            //configuracion = new RelacionEmpresaEntidad();
            //configuracion.Relacion = relacion2;
            //configuracion.Entidad = "provincia";
            //configuracion.Grupo = 0;

            //contextoInicial.RelacionEmpresaEntida.Add(configuracion);

            //contextoInicial.SaveChanges();

            //var grabador = new Grabador<Provincia>("Provincia", "01");

            //var provincia = new Provincia();
            //provincia.Nombre = "Hola";


            //grabador.Insertar(provincia, new Usuario());
            //grabador.SaveChanges();

            //Console.WriteLine("Termine");
            //Console.Read();
            //ParameterOverride[] para = {new ParameterOverride("empresa","01"), new ParameterOverride("entidad","empresa")};
            //var buscadorDTO = FabricaNegocios.Instancia.Resolver(typeof(IBuscadorDTO<Empresa, Inteldev.Core.DTO.Organizacion.Empresa>),para);

            //var contexto = new ContextoGenerico(@"Server=.\SQLEXPRESS;Initial Catalog=Inteldev.Fixius.Datos.ContextoGenerico; Integrated Security=SSPI");
            //var contexto = new Grabador<Localidad>("localidad","01");
            //var contexto2 = new Grabador<Provincia>("provincia", "01");
            //var contexto = new GrabadorGenerico<Localidad>("01", "localidad");


            //var localidad = new Localidad();
            //localidad.Nombre = "prueba grabador generico 3";
            //var prov = contexto2.BuscarPorId(1, CargarRelaciones.CargarTodo);
            //localidad.Provincia = prov;

            //contexto.Grabar(localidad,new Usuario());
            //contexto.Insertar(localidad,new Usuario());
            //contexto.SaveChanges();

            //List<string> Entidades = (from asm in AppDomain.CurrentDomain.GetAssemblies()
            //                  from type in asm.GetTypes()
            //                  where type.IsSubclassOf(typeof(EntidadBase))
            //                  select type.Name).ToList();

            //ParameterOverride[] parameters = { new ParameterOverride("empresa", "01"), new ParameterOverride("entidad", "Localidad") };
            //var grabador = (IGrabador<Localidad>)FabricaNegocios.Instancia.Resolver(typeof(IGrabador<Localidad>), parameters);

            //var numerador = new Inteldev.Core.Negocios.Numerador<Localidad>("01","Localidad");
            //numerador.TamañoMaximo = 4;
            //var codigo = numerador.ProximoCodigo();
            //Console.WriteLine("tamaño maximo: {0}",numerador.TamañoMaximo);
            //Console.WriteLine(codigo);
            //while (true)
            //{
            //    Console.WriteLine("Ingrese Numero: ");
            //    var numero = Console.ReadLine();
            //    //Console.WriteLine("Ingrese tamaño maximo: ");
            //    //var tamaño = Console.ReadLine();
            //    Console.WriteLine(getNumero(numero.ToString()));
            //}

            //IDbContext contextoInicial = new ContextoInicial();
            //var switchHelper = new Inteldev.Fixius.DataSwitch.SwitcherHelper(contextoInicial.GetType());

            //Console.WriteLine("Termine");
            //Console.ReadLine();
            //var servicio = new ServicioABM<Inteldev.Core.DTO.Locacion.Provincia, Inteldev.Core.Modelo.Locacion.Provincia>();
            //try
            //{
            //    var nuevo = servicio.Crear("01");
            //}
            //catch(System.ServiceModel.FaultException<FaultTesting> ee)
            //{
            //    Console.WriteLine(ee.Detail.Reason);
            //}
            //Console.ReadLine();

            //var rutaDeVentaDTO = new Inteldev.Fixius.Servicios.DTO.Clientes.RutaDeVenta();
            //Inteldev.Fixius.Modelo.Clientes.RutaDeVenta rutaDeVentaEntidad;

            //ParameterOverride[] pararu = { new ParameterOverride("empresa", "01"), new ParameterOverride("entidad", "rutadeventa") };

            //var mapeador = (IMapeadorGenerico<Inteldev.Fixius.Modelo.Clientes.RutaDeVenta, Inteldev.Fixius.Servicios.DTO.Clientes.RutaDeVenta>)FabricaNegocios.Instancia.Resolver(typeof(IMapeadorGenerico<Inteldev.Fixius.Modelo.Clientes.RutaDeVenta, Inteldev.Fixius.Servicios.DTO.Clientes.RutaDeVenta>), pararu);

            //ParameterOverride[] para = { new ParameterOverride("empresa", ""), new ParameterOverride("entidad", "empresa") };
            //var buscador = (IBuscadorDTO<Inteldev.Core.Modelo.Organizacion.Empresa, Inteldev.Core.DTO.Organizacion.Empresa>)FabricaNegocios.Instancia.Resolver(typeof(IBuscadorDTO<Inteldev.Core.Modelo.Organizacion.Empresa, Inteldev.Core.DTO.Organizacion.Empresa>), para);

            //rutaDeVentaDTO.Empresa = buscador.BuscarPorCodigo<Inteldev.Core.Modelo.Organizacion.Empresa>("01",CargarRelaciones.CargarTodo,null);
            //rutaDeVentaEntidad = mapeador.DtoToEntidad(rutaDeVentaDTO);
            //Console.WriteLine(rutaDeVentaEntidad.Empresa);



            Console.ReadLine();
        }