Esempio n. 1
0
    protected void btnAddServico_Click(object sender, EventArgs e)
    {
        if (txbAddServico.Text == "")
        {
            Response.Redirect("/admin/servicos?n=X");
            return;
        }
        TipoServico servico = new TipoServico();

        servico.Descricao = txbAddServico.Text;

        long codigo;

        if (TipoServicoDB.NomeIsValid(servico.Descricao) == true)
        {
            if ((codigo = TipoServicoDB.Insert(servico)) != -2)
            {
                servico.Codigo     = codigo;
                txbAddServico.Text = "";

                bindDdlServicoContent();
                Response.Redirect("/admin/servicos?n=s");
            }
            else
            {
                Response.Redirect("/admin/servicos?n=S");
                return;
            }
        }
        else
        {
            Response.Redirect("/admin/servicos?n=X");
            return;
        }
    }
Esempio n. 2
0
    protected void btnAddTipoServico_Click(object sender, EventArgs e)
    {
        if (txbAddTipoServico.Text == "")
        {
            Response.Redirect("/admin/servicos?n=X");
            return;
        }

        TipoServico tipoServico    = new TipoServico();
        TipoServico tipoServicoPai = new TipoServico();

        tipoServicoPai = TipoServicoDB.Select(Convert.ToInt32(ddlServico.SelectedValue));

        tipoServico.Descricao = txbAddTipoServico.Text;
        tipoServico.TipoPai   = tipoServicoPai;
        long codigo;

        if (TipoServicoDB.NomeIsValid(tipoServico.Descricao) == true)
        {
            if ((codigo = TipoServicoDB.Insert(tipoServico)) != -2)
            {
                tipoServico.Codigo = codigo;
                txbAddServico.Text = "";

                bindDdlServicoContent();
                Response.Redirect("/admin/servicos?n=j");
            }
            else
            {
                Response.Redirect("/admin/servicos?n=J");
                return;
            }
        }
        else
        {
            Response.Redirect("/admin/servicos?n=X");
            return;
        }
    }