示例#1
0
 protected void btnExcluir_Click(object sender, EventArgs e)
 {
     if (Session["perfil"].ToString() != "Administrador")
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "acessoNegado();", true);
     }
     else
     {
         try
         {
             chamadoID = int.Parse((sender as LinkButton).CommandArgument);
             semaEntities ctx = new semaEntities();
             chamado      cha = ctx.chamadoes.First(p => p.id == chamadoID);
             ctx.chamadoes.Remove(cha);
             ctx.SaveChanges();
             GetChamados();
             mensagem = "Deletado com Sucesso !";
             ClientScript.RegisterStartupScript(GetType(), "Popup", "sucesso();", true);
         }
         catch (System.Exception ex)
         {
             mensagem = "Ocorreu o seguinte erro ao tentar deletar: " + ex.Message;
             ClientScript.RegisterStartupScript(GetType(), "Popup", "erro();", true);
         }
     }
 }
示例#2
0
        public Boolean Salvar()
        {
            try
            {
                semaEntities ctx = new semaEntities();
                chamado      ch  = new chamado();
                ch.data           = data;
                ch.status         = cboxStatus.SelectedValue;
                ch.secretariaID   = int.Parse(Session["secretaria"].ToString());
                ch.protocolo      = txtProtocolo.Text;
                ch.nome           = txtnome.Text;
                ch.telefone       = txttelefone.Text;
                ch.email          = txtemail.Text;
                ch.cpf            = txtcpf.Text;
                ch.assunto        = int.Parse(cboxAssunto.SelectedValue);
                ch.topico         = int.Parse(cboxTopico.SelectedValue);
                ch.img            = "user-800x600.png";
                ch.cep            = txtCEP.Text;
                ch.rua            = txtRua.Text;
                ch.numero         = txtNumero.Text;
                ch.bairro         = txtBairro.Text;
                ch.cidade         = txtCidade.Text;
                ch.user_cadastrou = int.Parse(Session["id"].ToString());
                if (checkDenuncia.Checked == true)
                {
                    ch.anonimo = "SIM";
                }
                if (checkDenuncia.Checked == false)
                {
                    ch.anonimo = "NAO";
                }
                if (checkWhatsapp.Checked == true)
                {
                    ch.envia_whatsapp = "SIM";
                }
                if (checkWhatsapp.Checked == false)
                {
                    ch.envia_whatsapp = "NAO";
                }
                ctx.chamadoes.Add(ch);
                ctx.SaveChanges();
                LastID = ch.id;
                if (LastID != 0)
                {
                    pushMensage();
                }

                ScriptManager.RegisterStartupScript(this, GetType(), "Click", "temporaryButtonClick();", true);
            }
            catch (System.Exception ex)
            {
                mensagem = "Ocorreu o seguinte erro: " + ex.Message;
                ClientScript.RegisterStartupScript(GetType(), "Popup", "erro();", true);
            }

            return(true);
        }
示例#3
0
 public Boolean Salvar()
 {
     try
     {
         semaEntities ctx = new semaEntities();
         chamado      cha = ctx.chamadoes.First(p => p.id == chamadoID);
         cha.usuario_responsavel = int.Parse(cboxUsuario.SelectedValue);
         cha.status = cboxStatus.SelectedValue;
         cha.img    = lblCaminhoImg.Text;
         ctx.SaveChanges();
         gravaHistorico();
         ClientScript.RegisterStartupScript(GetType(), "Popup", "MensagemOK();", true);
         //Response.Redirect(prevPage);
     }
     catch (System.Exception ex)
     {
         mensagem = "Ocorreu o Seguinte erro ao tentar gravar " + ex.Message;
         ClientScript.RegisterStartupScript(GetType(), "Popup", "erro();", true);
     }
     return(true);
 }
示例#4
0
 protected void btnEnviar_Click(object sender, EventArgs e)
 {
     if (editor1.Value == "")
     {
         mensagem = "Favor preencher o texto com sua pergunta!";
         ClientScript.RegisterStartupScript(GetType(), "Popup", "erro();", true);
         editor1.Focus();
     }
     else
     if (editor1.Value.Length < 200)
     {
         mensagem = "A descrição do chamado esta muito curta, deve conter no mínimo 200 caracteres !";
         ClientScript.RegisterStartupScript(GetType(), "Popup", "erro();", true);
         editor1.Focus();
     }
     if (resp_cboxStatus.Text == "Aberto")
     {
         mensagem = "Õ Chamado esta com status ABERTO aguardando analise!";
         ClientScript.RegisterStartupScript(GetType(), "Popup", "erro();", true);
     }
     else
     {
         try
         {
             semaEntities ctx = new semaEntities();
             chamado      cha = ctx.chamadoes.First(p => p.id == chamadoID);
             cha.status = "Retorno Cidadao";
             ctx.SaveChanges();
             pushMensage();
             gravaHistorico();
             mensagem = "Gravado com Sucesso!";
             ClientScript.RegisterStartupScript(GetType(), "Popup", "sucesso();", true);
         }
         catch (System.Exception ex)
         {
             mensagem = "Ocorreu o Seguinte erro ao tentar gravar " + ex.Message;
             ClientScript.RegisterStartupScript(GetType(), "Popup", "erro();", true);
         }
     }
 }
示例#5
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            if (descricao.Text == "")
            {
                valido   = "nao";
                mensagem = "Favor faça a descrição da solicitação !";
                ClientScript.RegisterStartupScript(GetType(), "Popup", "erro();", true);
                descricao.Focus();
            }
            else
            if (descricao.Text.Length < 200)
            {
                valido   = "nao";
                mensagem = "A descrição do chamado esta muito curta, deve conter no mínimo 200 caracteres !";
                ClientScript.RegisterStartupScript(GetType(), "Popup", "erro();", true);
                descricao.Focus();
            }
            else

            if ((txtemail.Text != "") && (ValidaEmail.ValidarEmail(txtemail.Text) == false))
            {
                valido   = "nao";
                mensagem = "O e-mail digitado esta incorreto !";
                ClientScript.RegisterStartupScript(GetType(), "Popup", "erro();", true);
                txtemail.Focus();
            }
            else
            {
                valido = "sim";
            }

            if (valido == "sim")
            {
                try
                {
                    semaEntities ctx = new semaEntities();
                    chamado      ch  = ctx.chamadoes.First(p => p.id == chamadoID);
                    ch.status       = cboxStatus.SelectedValue;
                    ch.secretariaID = int.Parse(Session["secretaria"].ToString());
                    ch.protocolo    = txtProtocolo.Text;
                    ch.nome         = txtnome.Text;
                    ch.telefone     = txttelefone.Text;
                    ch.email        = txtemail.Text;
                    ch.cpf          = txtcpf.Text;
                    ch.assunto      = int.Parse(cboxAssunto.SelectedValue);
                    ch.topico       = int.Parse(cboxTopico.SelectedValue);
                    ch.img          = "user-800x600.png";
                    ch.cep          = txtCEP.Text;
                    ch.rua          = txtRua.Text;
                    ch.numero       = txtNumero.Text;
                    ch.bairro       = txtBairro.Text;
                    ch.cidade       = txtCidade.Text;
                    if (checkDenuncia.Checked == true)
                    {
                        ch.anonimo = "SIM";
                    }
                    if (checkDenuncia.Checked == false)
                    {
                        ch.anonimo = "NAO";
                    }
                    if (checkWhatsapp.Checked == true)
                    {
                        ch.envia_whatsapp = "SIM";
                    }
                    if (checkWhatsapp.Checked == false)
                    {
                        ch.envia_whatsapp = "NAO";
                    }
                    ctx.SaveChanges();
                    pushMensage();
                    mensagem = "Alterado com sucesso !";
                    ClientScript.RegisterStartupScript(GetType(), "Popup", "sucesso();", true);
                }
                catch (System.Exception ex)
                {
                    mensagem = "Ocorreu o seguinte erro: " + ex.Message;
                    ClientScript.RegisterStartupScript(GetType(), "Popup", "erro();", true);
                }
            }
        }