Пример #1
0
    protected void btnAdicionarServico_Click(object sender, EventArgs e)
    {
        try
        {
            Servico servico = new Servico();

            servico.TipoServico = TipoServicoDB.Select(Convert.ToInt64(ddlSubTipoServico.SelectedValue));
            if (Session["ObjEst"] != null)
            {
                servico.Estabelecimento = (Estabelecimento)Session["ObjEst"];
            }

            servico.Nome  = txbNomeServico.Text;
            servico.Preco = Convert.ToDouble(txbValorServico.Text);

            if (ServicoDB.Insert(servico) == 0)
            {
                Session["ObjEst"] = EstabelecimentoDB.Select(servico.Estabelecimento.Codigo);

                txbValorServico.Text = "";
                txbNomeServico.Text  = "";

                Response.Redirect("/editar/meusservicos?n=d");
            }
            else
            {
                Response.Redirect("/editar/meusservicos?n=D");
            }
        }
        catch (Exception exc) { }
    }
Пример #2
0
    protected void btnEditConfirmar_Click(object sender, EventArgs e)
    {
        Estabelecimento est = new Estabelecimento();

        est.Codigo      = Convert.ToInt64(txbEditCodEst.Text);
        est.Cnpj        = txbEditCnpj.Text;
        est.Fantasia    = txbEditFantasia.Text;
        est.RazaoSocial = txbEditRazaoSocial.Text;
        est.Responsavel = txbEditNomeResponsavel.Text;
        est.Telefone    = txbEditTel.Text;
        est.Celular     = txbEditCel.Text;
        est.ImagemUrl   = txbImgUrl.Text;

        Endereco end = new Endereco();

        end.Logradouro = txbEditEnd.Text;
        end.Numero     = txbEditNum.Text;
        end.Bairro     = txbEditBairro.Text;
        end.Cep        = txbEditCep.Text;

        est.Endereco = end;

        if (EstabelecimentoDB.Update(est) == 0)
        {
            Response.Redirect("/estabelecimento/" + est.Codigo + "?n=a");
            Session["ObjEst"] = EstabelecimentoDB.Select(est.Codigo);
        }
        else
        {
            Response.Redirect("/editar/perfil?n=A");
        }
    }
Пример #3
0
    protected void btnEnviarImagem_Click(object sender, EventArgs e)
    {
        if (fupImagem.HasFile)
        {
            if (Utils.IsValidType(fupImagem.PostedFile.ContentType))
            {
                DirectoryInfo di = new DirectoryInfo(Request.PhysicalApplicationPath + "/Imagens/");
                di.FullName.Replace(" ", "_");
                if (!di.Exists)
                {
                    di.Create();
                }

                string fullName = di.FullName + "/" + fupImagem.FileName;
                fupImagem.SaveAs(fullName);
                UploadResult result = CloudinaryWrapper.UploadImage(fullName);
                File.Delete(fullName);
                string url = Convert.ToString(result.JsonObj["url"]);

                Estabelecimento estab = Session["ObjEst"] as Estabelecimento;
                estab.ImagemUrl = url;
                EstabelecimentoDB.Update(estab);
                Response.Redirect("/estabelecimento/" + estab.Codigo);
            }
        }
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["ObjAdm"] == null)
        {
            Response.Redirect("/");
        }

        if (Page.RouteData.Values["id"] == null)
        {
            Response.Redirect("/404");
        }

        long id = 0;

        try
        {
            id = Convert.ToInt64(Page.RouteData.Values["id"]);
        }
        catch
        {
            Response.Redirect("/404");
        }

        Estabelecimento estabelecimento = EstabelecimentoDB.Select(id);

        if (estabelecimento == null)
        {
            Response.Redirect("/404");
        }

        usuario = UsuarioDB.SelectByEstabelecimento(estabelecimento);

        if (usuario != null)
        {
            lblEmail.Text           = usuario.Email;
            lblNomeResponsavel.Text = usuario.Estabelecimento.Responsavel;
            lblTelefone.Text        = usuario.Estabelecimento.Telefone;
            lblCelular.Text         = usuario.Estabelecimento.Celular;
            lblNomeFantasia.Text    = usuario.Estabelecimento.Fantasia;
            lblRazaoSocial.Text     = usuario.Estabelecimento.RazaoSocial;
            lblCnpj.Text            = usuario.Estabelecimento.Cnpj;
            lblCep.Text             = usuario.Estabelecimento.Endereco.Cep;
            lblLogradouro.Text      = usuario.Estabelecimento.Endereco.Logradouro;
            lblNumero.Text          = usuario.Estabelecimento.Endereco.Numero;
            lblBairro.Text          = usuario.Estabelecimento.Endereco.Bairro;
            lblCidade.Text          = usuario.Estabelecimento.Endereco.Cidade.Nome;
            lblEstado.Text          = usuario.Estabelecimento.Endereco.Cidade.Estado.Nome;
        }
        else
        {
            Response.Redirect("/404");
        }
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ((HtmlHead)Master.FindControl("headMaster")).Title += " Plus";

        if (Session["ObjAdm"] == null)
        {
            Response.Redirect("/");
        }

        if (Page.RouteData.Values["id"] == null)
        {
            Response.Redirect("/404");
        }

        long id = 0;

        try
        {
            id = Convert.ToInt64(Page.RouteData.Values["id"]);
        }
        catch
        {
            Response.Redirect("/404");
        }

        Estabelecimento estabelecimento = EstabelecimentoDB.Select(id);

        if (estabelecimento == null)
        {
            Response.Redirect("/404");
        }

        usuario = UsuarioDB.SelectByEstabelecimento(estabelecimento);

        if (usuario != null)
        {
            lblNomeResponsavel.Text = usuario.Estabelecimento.Responsavel;
            lblTelefone.Text        = usuario.Estabelecimento.Telefone;
            lblCelular.Text         = usuario.Estabelecimento.Celular;
            lblNomeFantasia.Text    = usuario.Estabelecimento.Fantasia;
        }
        else
        {
            Response.Redirect("/404");
        }
    }
Пример #6
0
    public void CarregarGrids()
    {
        DataSet ds  = EstabelecimentoDB.SelectByEstadoAtivacao(ddlEstadoAtivacao.SelectedValue);
        int     qtd = ds.Tables[0].Rows.Count;

        string mensagem;

        if (qtd > 0)
        {
            gdvEstabelecimentos.DataSource = ds.Tables[0].DefaultView;
            gdvEstabelecimentos.DataBind();
            mensagem = "Foram encontrados " + qtd + " registros";
        }
        else
        {
            mensagem = "Não há estabelecimentos que correspondam à filtragem";
        }
        gdvEstabelecimentos.Visible = (qtd > 0);
        lblResultEstAtivos.Text     = mensagem;
    }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ((HtmlHead)Master.FindControl("headMaster")).Title += " Perfil";
        if (!Page.IsPostBack)
        {
            if (Page.RouteData.Values["codigo"] == null)
            {
                Response.Redirect("/");
            }

            long            id    = Convert.ToInt64(Page.RouteData.Values["codigo"]);
            Estabelecimento estab = EstabelecimentoDB.Select(id);
            if (estab == null)
            {
                Response.Redirect("/404");
            }

            SetPageInfo(estab);
            verifyQueryString(Request.QueryString);
            if (Session["ObjEst"] != null)
            {
                Estabelecimento estabLogado = Session["ObjEst"] as Estabelecimento;
                linkAdicionaServico.Visible = estabLogado.Equals(estab);
                linkAdicionaGaleria.Visible = estabLogado.Equals(estab);
                enviarFoto.Visible          = estabLogado.Equals(estab);
                lblStatus.Visible           = estabLogado.Equals(estab);
                lblStatusFixo.Visible       = estabLogado.Equals(estab);
                lblPlus.Visible             = estabLogado.Equals(estab);
                lblPlusFixo.Visible         = estabLogado.Equals(estab);

                divMensagem.Visible = !estabLogado.Equals(estab);
            }
        }

        if (ViewState["ImagemUrl"] != null)
        {
            ImagemUrl = ViewState["ImagemUrl"] as string;
        }
    }
Пример #8
0
 protected void btnAguardar_Click(object sender, EventArgs e)
 {
     EstabelecimentoDB.UpdateStatusAguardando(usuario.Estabelecimento);
     Response.Redirect("/admin/cadastros?n=g");
 }
Пример #9
0
 protected void btnPlusDesativar_Click(object sender, EventArgs e)
 {
     EstabelecimentoDB.UpdateDesativarPlus(usuario.Estabelecimento);
     Response.Redirect("/admin/cadastros?n=C");
 }
Пример #10
0
    protected void btnEnviar_Click(object sender, EventArgs e)
    {
        Estabelecimento estab = new Estabelecimento();

        estab.Fantasia    = txbFantasia.Text;
        estab.RazaoSocial = txbRazaoSocial.Text;
        estab.Cnpj        = txbCnpj.Text.Replace("-", "").Replace(".", "").Replace("/", "");

        Endereco endereco = new Endereco();

        endereco.Logradouro = txbLogradouro.Text;
        endereco.Numero     = txbNumero.Text;
        endereco.Cep        = txbCep.Text.Replace("-", "");
        endereco.Bairro     = txbBairro.Text;
        estab.Endereco      = endereco;

        Cidade cidade = new Cidade();

        cidade.Nome           = txbCidade.Text;
        estab.Endereco.Cidade = CidadeDB.Select(cidade);

        estab.Responsavel = txbResponsavel.Text;
        estab.Telefone    = txbTelefone.Text;
        estab.Celular     = txbCelular.Text;

        long codigo;

        if ((codigo = EstabelecimentoDB.Insert(estab)) != -2)
        {
            estab.Codigo = codigo;
        }
        else
        {
            Response.Redirect("/?n=Q");
            return;
        }

        Usuario usuario = new UsuarioCrypto();

        usuario.Email           = txbEmail.Text;
        usuario.Senha           = txbSenha.Text;
        usuario.Estabelecimento = estab;
        //USUARIO está sendo inserido como ativo, mediante a testes.
        //usuario.Ativo = false;


        if (UsuarioDB.Insert(usuario) != -2)
        {
            txbBairro.Text        = "";
            txbCep.Text           = "";
            txbCnpj.Text          = "";
            txbConfirmaEmail.Text = "";
            txbEmail.Text         = "";
            txbFantasia.Text      = "";
            txbLogradouro.Text    = "";
            txbNumero.Text        = "";
            txbRazaoSocial.Text   = "";

            Response.Redirect("/?n=q");
        }
        else
        {
            Response.Redirect("/?n=Q");
        }
    }