示例#1
0
    protected void Concluir_Click(object sender, EventArgs e)
    {
        if (VtPessoa.PessoaJaECadastrada == VtWizardPessoaPessoaJaECadastradaTabItens.ItemSim)
        {
            var request = new NovaReservaRequest();
            request.HandlePessoa      = VtPessoa.PessoaHandle;
            request.HandleModeloCarro = VtReserva.ModeloCarroHandle;
            request.HandlePlano       = VtReserva.PlanoHandle;
            request.DataInicio        = VtReserva.DataInicio.Value;
            request.DataFim           = VtReserva.DataFim != null ? VtReserva.DataFim.Value : VtReserva.DataInicio.Value.AddDays(7);

            var response = BennerContext.BusinessComponent.Call("Benner.Reservas.Componentes.GerenciadorReservas, Benner.Reservas.Componentes",
                                                                "CriarNovaReserva",
                                                                (object)request) as NovaReservaResponse;

            FormLinkDefinition linkDef = new FormLinkDefinition();
            linkDef.Url = "~/Pages/Reservas/Form.aspx";
            linkDef.TargetSystemInstanceName   = BennerContext.Administration.DefaultSystemInstanceName;
            linkDef.TargetEntityDefinitionName = "RESERVAS";
            linkDef.TargetFormMode             = FormLinkDefinition.FormMode.View;
            linkDef.TargetEntityHandle         = response.HandleReservaCriada;

            Response.Redirect(Benner.Tecnologia.Wes.Components.UriBuilder.Create(linkDef));
        }
        else
        {
            var request = new NovaPessoaNovaReservaRequest();
            request.Nome              = VtPessoa.Nome;
            request.Cpf               = VtPessoa.Cpf;
            request.Email             = VtPessoa.Email;
            request.TelefoneMovel     = VtPessoa.TelefoneMovel;
            request.HandleModeloCarro = VtReserva.ModeloCarroHandle;
            request.HandlePlano       = VtReserva.PlanoHandle;
            request.DataInicio        = VtReserva.DataInicio.Value;
            request.DataFim           = VtReserva.DataFim != null ? VtReserva.DataFim.Value : VtReserva.DataInicio.Value.AddDays(7);

            var response = BennerContext.BusinessComponent.Call("Benner.Reservas.Componentes.GerenciadorReservas, Benner.Reservas.Componentes",
                                                                "CriarNovaPessoaEReserva",
                                                                (object)request) as NovaPessoaNovaReservaResponse;

            FormLinkDefinition linkDef = new FormLinkDefinition();
            linkDef.Url = "~/Pages/Pessoas/Form.aspx?novaReserva";
            linkDef.TargetSystemInstanceName   = BennerContext.Administration.DefaultSystemInstanceName;
            linkDef.TargetEntityDefinitionName = "PESSOAS";
            linkDef.TargetFormMode             = FormLinkDefinition.FormMode.View;
            linkDef.TargetEntityHandle         = response.HandlePessoaCriada;

            Response.Redirect(Benner.Tecnologia.Wes.Components.UriBuilder.Create(linkDef));
        }
    }
        public NovaReservaResponse CriarNovaReserva(NovaReservaRequest request)
        {
            NovaReservaResponse response = new NovaReservaResponse();

            var reserva = _reservasDao.Create();

            reserva.ModeloCarroHandle = request.HandleModeloCarro;
            reserva.PessoaHandle      = request.HandlePessoa;
            reserva.PlanoHandle       = request.HandlePlano;
            reserva.DataInicio        = request.DataInicio;
            reserva.DataFim           = request.DataFim;

            _reservasDao.Save(reserva);

            response.HandleReservaCriada = reserva.Handle;

            return(response);
        }
示例#3
0
    protected void Concluir_Click(object sender, EventArgs e)
    {
        var request = new NovaReservaRequest();

        request.HandlePessoa      = VtPessoa.PessoaHandle;
        request.HandleModeloCarro = VtReserva.ModeloCarroHandle;
        request.HandlePlano       = VtReserva.PlanoHandle;
        request.DataInicio        = VtReserva.DataInicio.Value;
        request.DataFim           = VtReserva.DataFim.Value;

        var response = BennerContext.BusinessComponent.Call("Benner.Reservas.Componentes.GerenciadorReservas, Benner.Reservas.Componentes",
                                                            "CriarNovaReserva",
                                                            (object)request) as NovaReservaResponse;

        FormLinkDefinition linkDef = new FormLinkDefinition();

        linkDef.Url = "~/Pages/Reservas/Form.aspx";
        linkDef.TargetSystemInstanceName   = BennerContext.Administration.DefaultSystemInstanceName;
        linkDef.TargetEntityDefinitionName = "RESERVAS";
        linkDef.TargetFormMode             = FormLinkDefinition.FormMode.View;
        linkDef.TargetEntityHandle         = response.HandleReservaCriada;

        Response.Redirect(Benner.Tecnologia.Wes.Components.UriBuilder.Create(linkDef));
    }