Beispiel #1
0
            private static LIType LoadModels()
            {
                var tabelas  = new LIType();
                var campanha = new Campanha(201);

                campanha.Get();

                if (campanha.IDCampanha == null)
                {
                    throw new TradeVisionValidationError("Campanha não encontrada");
                }

                tabelas.Add(new Usuario(campanha));
                tabelas.Add(new PessoaJuridica(campanha));

                var classesDidoxBusiness = CType.GetAllClassesOfAssembly(new Usuario());
                var listaTabelas         = getListaTabelasXLS();

                foreach (string tabela in listaTabelas)
                {
                    foreach (IType iType in classesDidoxBusiness)
                    {
                        if (CType.GetTableName(iType).ToLower() == tabela.ToLower())
                        {
                            if (!tabelas.Exists(it => it.GetType().Name == iType.GetType().Name))
                            {
                                tabelas.Add(iType);
                                break;
                            }
                        }
                    }
                }
                return(tabelas);
            }
Beispiel #2
0
    protected void btnSalvar_Click(object sender, EventArgs e)
    {
        var Campanha = new Campanha();

        try
        {
            if (txtId.Text != "")
            {
                Campanha.IDCampanha = int.Parse(txtId.Text);
                Campanha.Get();
            }

            Campanha.Descricao           = txtDescricao.Text;
            Campanha.IDPrograma          = int.Parse(ddlIDPrograma.SelectedValue);
            Campanha.Slug                = txtSlug.Text;
            Campanha.DataInicioFormatada = txtDataInicio.Text;
            Campanha.DataFimFormatada    = txtDataFim.Text;

            Campanha.Save();
            GetCampanha((int)Campanha.IDCampanha);

            Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('Registro salvo.')</script>");
        }
        catch (Exception err)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('" + FormatError.FormatMessageForJAlert(err.Message) + "')</script>");
        }
    }
Beispiel #3
0
    private void GetCampanha(int idCampanha)
    {
        dvSalvarCampanha.Visible  = true;
        dvListarCampanhas.Visible = false;

        var Campanha = new Campanha();

        Campanha.IDCampanha = idCampanha;
        Campanha.Get();

        txtId.Text                  = Campanha.IDCampanha.ToString();
        txtDescricao.Text           = Campanha.Descricao.ToString();
        ddlIDPrograma.SelectedValue = Campanha.IDPrograma.ToString();
        txtSlug.Text                = Campanha.Slug.ToString();
        txtDataInicio.Text          = Campanha.DataInicioFormatada;
        txtDataFim.Text             = Campanha.DataFimFormatada;
    }
Beispiel #4
0
        public void SetAcesso(string slugCliente, string slugPrograma, string slugCampanha)
        {
            if (slugCliente.Contains('.') || slugPrograma.Contains('.') || slugCampanha.Contains('.'))
            {
                return;
            }
            Cliente cliente = new Cliente(slugCliente);

            cliente.Get();
            if (cliente.IDCliente != null)
            {
                Cliente.Dispose();
                Programa.Dispose();
                Campanha.Dispose();

                cliente.BuscaAdicionaCurrent();

                Programa programa = new Programa(slugPrograma);
                programa.Cliente = cliente;
                programa.Get();

                if (programa.IDPrograma != null)
                {
                    programa.BuscaAdicionaCurrent();


                    Campanha campanha = new Campanha(slugCampanha);
                    campanha.Programa = programa;
                    campanha.Get();

                    if (campanha.IDCampanha != null)
                    {
                        campanha.BuscaAdicionaCurrent();
                    }
                }
            }
            else
            {
                Cliente.Dispose();
            }
        }