public VMRutaDeVenta(Inteldev.Fixius.Servicios.DTO.Clientes.RutaDeVenta DTO)
            : base(DTO)
        {
            this.SetPresentadorEspecial <Cliente>("PresentadorClientes", DTO.Clientes);
            this.PresentadorClientes.PMB.cantidadNumeros = 5;
            //this.SetPresentador<Empresa>("PresentadorEmpresa", p => DTO.Empresa = p, DTO.Empresa);
            //this.PresentadorEmpresa.cantidadNumeros = 2;
            var servicioEmpresas = FabricaClienteServicio.Instancia.CrearCliente <IServicioABM <Empresa> >();

            this.Empresas = new ObservableCollection <Empresa>(servicioEmpresas.ObtenerLista(1, Core.CargarRelaciones.NoCargarNada, Sistema.Instancia.EmpresaActual.Codigo));
            if (this.Modelo.Empresa != null)
            {
                this.Modelo.Empresa = this.Empresas.FirstOrDefault(e => e.Codigo == this.Modelo.Empresa.Codigo);
            }
            var servicioDivisionesComerciales = FabricaClienteServicio.Instancia.CrearCliente <IServicioABM <DivisionComercial> >();

            this.Divisiones = new ObservableCollection <DivisionComercial>(servicioDivisionesComerciales.ObtenerLista(1, Core.CargarRelaciones.NoCargarNada, Sistema.Instancia.EmpresaActual.Codigo));
            if (this.Modelo.Division != null || this.Modelo.Division != string.Empty)
            {
                this.Division = this.Divisiones.FirstOrDefault(e => e.Codigo == this.Modelo.Division);
            }
            //this.SetPresentador<DivisionComercial>("PresentadorDivision", p => DTO.Division = p, DTO.Division);
            //this.PresentadorDivision.cantidadNumeros = 5;
            this.SetPresentador <Preventista>("PresentadorTitular", (p => DTO.Titular = p), DTO.Titular);
            this.PresentadorTitular.cantidadNumeros = 2;
            this.SetPresentador <Preventista>("PresentadorSuplente", (p => DTO.Suplente = p), DTO.Suplente);
            this.PresentadorSuplente.cantidadNumeros = 2;
            this.SetPresentador <Inteldev.Fixius.Servicios.DTO.Clientes.RegionDeVenta>("PresentadorRegionDeVenta", reg => this.Modelo.RegionDeVenta = reg, this.Modelo.RegionDeVenta);
            this.PresentadorRegionDeVenta.cantidadNumeros = 2;
        }
示例#2
0
        public Pedido CrearPedido(Cliente cliente, Preventista preventista, Empresa empresa, DivisionComercial divisionComercial)
        {
            var pedido  = new Pedido();
            var detalle = new DetallePedido();

            pedido.Cliente              = cliente;
            pedido.ClienteId            = cliente.Id;
            pedido.Preventista          = preventista;
            pedido.PreventistaId        = preventista.Id;
            detalle.Empresa             = empresa;
            detalle.DivisionComercial   = divisionComercial;
            detalle.DivisionComercialId = divisionComercial.Id;
            pedido.DetallePedido.Add(detalle);
            return(pedido);
        }