Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Session["perfil"].Equals("Gestor") && !Session["perfil"].Equals("Administrador"))
                {
                    Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                }

                if (!Page.IsPostBack)
                {
                    Mensagem = "Consulta de tipos de serviços.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }

                foreach (var Result in new ManterServico().ConsultaTpServicos())
                {
                    TipoServico Tp = FactoryServico.GetNewTpServico();
                    Tp.Id           = Result.Id;
                    Tp.NomeTipoServ = Result.NomeTipoServ;
                    ListaTpServicoSelect.Add(Tp);
                }

                if (Request.QueryString["OpInatTpServico"] != null && Request.QueryString["OpInatTpServico"].Equals("True"))
                {
                    Mensagem = "Tipo de serviço inativado com sucesso.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }
                else if (Request.QueryString["OpInatTpServico"] != null && Request.QueryString["OpInatTpServico"].Equals("False"))
                {
                    Mensagem = "Ocorreu um erro ao inativar o tipo de serviço.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (!Session["perfil"].Equals("Gestor") && !Session["perfil"].Equals("Administrador"))
                    {
                        Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                    }

                    if (Request.QueryString["Id"] != null)
                    {
                        Mensagem = "Alteração de informações de um serviço.";
                        ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);

                        ObjServico.Id = Convert.ToInt32(Request.QueryString["Id"]);

                        ObjServico = new ManterServico(ObjServico).ConsultaServicoById();

                        DropDownListTpServico.DataSource     = new ManterServico().ConsultaTpServicos();
                        DropDownListTpServico.DataTextField  = "NomeTipoServ";
                        DropDownListTpServico.DataValueField = "Id";
                        DropDownListTpServico.DataBind();
                        DropDownListTpServico.Items.Insert(0, new ListItem("Selecione o tipo de serviço", "0"));

                        DropDownListTpServico.SelectedValue = Convert.ToString(ObjServico.IdTipo);
                        Nome.Value     = ObjServico.NomeServ;
                        DescServ.Value = ObjServico.DescServ;
                        SLA.Value      = ObjServico.Sla.ToString();
                    }
                }
                catch (Exception Ex)
                {
                    LogException.InsereLogBd(Ex);
                    MsgLabel.Text = LogException.CodigoErroBd();
                }
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    if (Session["perfil"].Equals("Técnico"))
                    {
                        Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                    }

                    DropDownListTpServico.DataSource     = new ManterServico().ConsultaTpServicos();
                    DropDownListTpServico.DataTextField  = "NomeTipoServ";
                    DropDownListTpServico.DataValueField = "Id";
                    DropDownListTpServico.Items.Insert(0, new ListItem("Selecione o tipo de serviço", "0"));

                    if (PerfilFunc)
                    {
                        Perfis.Add("Cliente");

                        DropDownListCliente.DataSource     = new ManterUsuario(ObjUsuario).ConsultaUsuariosByPerfil(Perfis);
                        DropDownListCliente.DataTextField  = "Nome";
                        DropDownListCliente.DataValueField = "Id";
                        DropDownListCliente.Items.Insert(0, new ListItem("Selecione o cliente", "0"));
                    }

                    if (!Page.IsPostBack)
                    {
                        Mensagem = "Abertura de chamado.";
                        ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                    }
                }
                catch (Exception Ex)
                {
                    LogException.InsereLogBd(Ex);
                    MsgLabel.Text = LogException.CodigoErroBd();
                }
            }
        }
Ejemplo n.º 4
0
        protected void SalvarSenhaButton_Click(object sender, EventArgs e)
        {
            try
            {
                ObjUsuario.Id = Convert.ToInt32(Session["id"]);
                ObjUsuario    = new ManterUsuario(ObjUsuario).ConsultaUsuarioById();

                ObjUsuario.Senha = Senha.Value;

                if (new ManterUsuario(ObjUsuario).AlteraSenha())
                {
                    Mensagem = "Senha alterada com sucesso.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                    Nome.Value        = ObjUsuario.Nome;
                    Endereco.Value    = ObjUsuario.Endereco;
                    Telefone.Value    = ObjUsuario.Telefone;
                    Complemento.Value = ObjUsuario.Complemento;
                    CEP.Value         = ObjUsuario.Cep;
                    Email.Value       = ObjUsuario.Email;
                }
                else
                {
                    Mensagem = "Não foi possível alterar sua senha.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                    Nome.Value        = ObjUsuario.Nome;
                    Endereco.Value    = ObjUsuario.Endereco;
                    Telefone.Value    = ObjUsuario.Telefone;
                    Complemento.Value = ObjUsuario.Complemento;
                    CEP.Value         = ObjUsuario.Cep;
                    Email.Value       = ObjUsuario.Email;
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 5
0
        protected void AlterarButton_Click(object sender, EventArgs e)
        {
            try
            {
                ObjUsuario.Id = Convert.ToInt32(Session["id"]);
                ObjUsuario    = new ManterUsuario(ObjUsuario).ConsultaUsuarioById();

                ObjUsuario.Nome        = Nome.Value;
                ObjUsuario.Endereco    = Endereco.Value;
                ObjUsuario.Telefone    = Telefone.Value;
                ObjUsuario.Complemento = Complemento.Value;
                ObjUsuario.Cep         = CEP.Value;

                Usuario = Membership.GetUser(ObjUsuario.Login);

                if (new ManterUsuario(ObjUsuario).AlteraUsuario())
                {
                    if (!Usuario.Email.Equals(Email.Value))
                    {
                        Usuario.Email = Email.Value;
                        Membership.UpdateUser(Usuario);
                    }

                    Mensagem = "Seus dados foram alterado com sucesso.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }
                else
                {
                    Mensagem = "Não foi possível alterar seus dados.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool OperInativar = false;

            try
            {
                if (!Session["perfil"].Equals("Gestor") && !Session["perfil"].Equals("Administrador"))
                {
                    Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                }

                if (Request.QueryString["Id"] != null)
                {
                    ObjTpServico.Id = Convert.ToInt32(Request.QueryString["Id"]);
                    OperInativar    = new ManterServico(ObjTpServico).InativaTpServico();
                    Response.Redirect("\\Views\\SGA\\VTipoServico\\ConsultaTipoServicos.aspx?OpInatTpServico=" + OperInativar.ToString());
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
            }
        }
Ejemplo n.º 7
0
        protected void CadastrarButton_Click(object sender, EventArgs e)
        {
            try
            {
                ObjTpServico.NomeTipoServ = Nome.Value;

                if (new ManterServico(ObjTpServico).CadastraTpServico())
                {
                    Mensagem = "Serviço cadastrado com sucesso.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }
                else
                {
                    Mensagem = "Não foi possível cadastrar o serviço";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Session["perfil"].Equals("Gestor") && !Session["perfil"].Equals("Administrador"))
                {
                    Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                }

                if (!Page.IsPostBack)
                {
                    Mensagem = "Consulta de região de atendimento";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }

                foreach (var ObjAT in new ManterRegiaoAtendimento(ObjRegiao).ConsultaRegiaoAtendimentos())
                {
                    ListaAreaSelect.Add(ObjAT);
                }

                if (Request.QueryString["OpInatArea"] != null && Request.QueryString["OpInatArea"].Equals("True"))
                {
                    Mensagem = "Área inativada com sucesso!";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }
                else if (Request.QueryString["OpInatArea"] != null && Request.QueryString["OpInatArea"].Equals("False"))
                {
                    Mensagem = "Ocorreu um erro ao inativar a área!";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Session["perfil"].Equals("Cliente Físico") && Session["perfil"].Equals("Cliente Jurídico"))
                {
                    Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                }

                foreach (var ObjChat in new ManterChat(ObjChat).RetornaChat())
                {
                    ListaMensagens.Add(ObjChat);
                }

                ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "checa(0)", true);

                ListaMensagens.Reverse();
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 10
0
        protected void Tramite_Click(object sender, EventArgs e)
        {
            try
            {
                TramiteClick = true;

                if (!TramiteTextBox.Value.Equals(""))
                {
                    ObjChamado.Tramite = "  " + DateTime.Now + " " + Membership.GetUser() + ": " + TramiteTextBox.Value;
                    new ManterChamado(ObjChamado).AtualizaTramite();
                    Response.Redirect("\\Views\\SGA\\VChamado\\ConsultaChamado.aspx?IdChamado=" + ObjChamado.Id + "&Mensagem=Tramite", false);
                }
                else
                {
                    Mensagem = "Digite alguma informação para adicionar ao chamado.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('Digite alguma informação para adicionar ao chamado.')", true);
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 11
0
 protected void CheckBoxPend_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (CheckBoxPend.Checked)
         {
             PendBox         = true;
             EnceButtonClick = true;
             CancButtonClick = false;
         }
         else
         {
             PendBox         = false;
             EnceButtonClick = true;
             CancButtonClick = false;
         }
     }
     catch (Exception Ex)
     {
         LogException.InsereLogBd(Ex);
         ObjChamado    = null;
         MsgLabel.Text = LogException.CodigoErroBd();
     }
 }
Ejemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Session["perfil"].Equals("Técnico") && !Session["perfil"].Equals("Administrador"))
                {
                    Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                }
                if (!"".Equals(Request.QueryString["IdChamado"]) && !"".Equals(Request.QueryString["StatusChamado"]) && !"Cancelado".Equals(Request.QueryString["StatusChamado"]))
                {
                    ObjAtend.IdChamado = Convert.ToInt32(Request.QueryString["IdChamado"]);
                    ObjAtend.IdTecnico = (int)(Session["id"]);

                    if (new ManterAtendimento(ObjAtend).IniciaAtendimento())
                    {
                        Response.Redirect("\\Views\\SGA\\VChamado\\ConsultaChamado.aspx?IdChamado=" + ObjAtend.IdChamado, false);
                    }
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
            }
        }
Ejemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Session["perfil"].Equals("Cliente Físico") && !Session["perfil"].Equals("Cliente Jurídico") && !Session["perfil"].Equals("Administrador"))
                {
                    Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                }

                if (Request.QueryString["IdChamado"] != null)
                {
                    ObjAtend.IdChamado = Convert.ToInt32(Request.QueryString["IdChamado"]);
                    ObjAtend           = new ManterAtendimento(ObjAtend).ConsultaAtendimentoByIdChamado();

                    if (!ObjAtend.IdCliente.Equals(Session["id"]))
                    {
                        Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                    }

                    if (!Page.IsPostBack)
                    {
                        Mensagem = "Favor selecionar a nota.";
                        ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                    }
                }
                else
                {
                    Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 14
0
        protected void DropDownListTpServico_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                ObjServico.IdTipo = Convert.ToInt32(DropDownListTpServico.SelectedValue);

                DropDownListServico.DataSource     = new ManterServico(ObjServico).ConsultaServicosByTipo();
                DropDownListServico.DataTextField  = "NomeServ";
                DropDownListServico.DataValueField = "Id";
                DropDownListServico.DataBind();
                DropDownListServico.Items.Insert(0, new ListItem("Selecione o serviço", "0"));

                DropDownListPrioridade.DataSource     = new ManterPrioridadeChamado().ConsultaPrioridadesChamado();
                DropDownListPrioridade.DataTextField  = "DescPrioridade";
                DropDownListPrioridade.DataValueField = "Id";
                DropDownListPrioridade.DataBind();
                DropDownListPrioridade.Items.Insert(0, new ListItem("Selecione a prioridade do chamado", "0"));
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                try
                {
                    Mensagem = "Alteração de dados do usuário.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);

                    if (Request.QueryString["Id"] != null)
                    {
                        MensagemTela  = "Usuário do sistema";
                        ObjUsuario.Id = Convert.ToInt32(Request.QueryString["Id"]);

                        ObjUsuario = new ManterUsuario(ObjUsuario).ConsultaUsuarioById();

                        Nome.Value        = ObjUsuario.Nome;
                        Endereco.Value    = ObjUsuario.Endereco;
                        Telefone.Value    = ObjUsuario.Telefone;
                        Complemento.Value = ObjUsuario.Complemento;
                        CEP.Value         = ObjUsuario.Cep;

                        if (ObjUsuario.IdStatus.Equals(1))
                        {
                            Ausente.Text = "Ausentar usuário";
                        }
                        else if (ObjUsuario.IdStatus.Equals(4))
                        {
                            Ausente.Text = "Ativar usuário";
                        }

                        if (!string.IsNullOrWhiteSpace(Request.QueryString["Consulta"]))
                        {
                            if (Request.QueryString["Consulta"].Equals("true") && Session["perfil"].Equals("Técnico") || Session["perfil"].Equals("Técnico"))
                            {
                                Nome.Disabled         = true;
                                Endereco.Disabled     = true;
                                Telefone.Disabled     = true;
                                Complemento.Disabled  = true;
                                CEP.Disabled          = true;
                                AlterarButton.Enabled = false;
                                Ausente.Enabled       = false;
                                Mensagem     = "Consulta de dados do cliente.";
                                MensagemTela = "Consulta de dados do cliente";
                                ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                            }
                        }
                        else if (Session["perfil"].Equals("Técnico"))
                        {
                            Nome.Disabled         = true;
                            Endereco.Disabled     = true;
                            Telefone.Disabled     = true;
                            Complemento.Disabled  = true;
                            CEP.Disabled          = true;
                            AlterarButton.Enabled = false;
                            Ausente.Enabled       = false;
                            Mensagem     = "Consulta de dados do cliente.";
                            MensagemTela = "Consulta de dados do cliente";
                            ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                        }
                    }
                }
                catch (Exception Ex)
                {
                    LogException.InsereLogBd(Ex);
                    MsgLabel.Text = LogException.CodigoErroBd();
                }
            }
        }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!"".Equals(Request.QueryString["IdChamado"]))
                {
                    ObjChamado    = FactoryChamado.GetNew();
                    ObjChamado.Id = Convert.ToInt32(Request.QueryString["IdChamado"]);
                    ObjChamado    = new ManterChamado(ObjChamado).ConsultaChamadoById();

                    if (ObjChamado != null)
                    {
                        if (!Page.IsPostBack)
                        {
                            if (Request.QueryString.AllKeys.Contains("Mensagem"))
                            {
                                if (Request.QueryString["Mensagem"].Equals("Cancelado"))
                                {
                                    Mensagem = "Chamado cancelado com sucesso.";
                                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                                }
                                else if (Request.QueryString["Mensagem"].Equals("Encerrado"))
                                {
                                    Mensagem = "Chamado encerrado com sucesso.";
                                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                                }
                                else if (Request.QueryString["Mensagem"].Equals("Tramite"))
                                {
                                    Mensagem = "Trâmite adicionado com sucesso.";
                                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                                }
                                else if (Request.QueryString["Mensagem"].Equals("Reaberto"))
                                {
                                    Mensagem = "Chamado reaberto com sucesso.";
                                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                                }
                                else if (Request.QueryString["Mensagem"].Equals("Recusado"))
                                {
                                    Mensagem = "Atendimento deste chamado recusado.";
                                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                                }
                                else if (Request.QueryString["Mensagem"].Equals("Avaliado"))
                                {
                                    Mensagem = "Avaliado com sucesso!";
                                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                                }
                                else if (Request.QueryString["Mensagem"].Equals("AvaliadoAnt"))
                                {
                                    Mensagem = "Este chamado já foi avaliado.";
                                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                                }
                            }
                            else
                            {
                                Mensagem = "Informações do chamado.";
                                ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                            }
                        }

                        if (Request.QueryString.AllKeys.Contains("Troca"))
                        {
                            if (Request.QueryString["Troca"].Equals("true"))
                            {
                                Mensagem = "Técnico alocado com sucesso.";
                                ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                            }
                        }

                        ObjServico.Id      = ObjChamado.IdServico;
                        ObjStatusChm.Id    = ObjChamado.IdStatus;
                        ObjAtend.IdChamado = ObjChamado.Id;

                        ObjAtend     = new ManterAtendimento(ObjAtend).ConsultaAtendimentoByIdChamado();
                        ObjRegiao.Id = ObjAtend.IdRegiaoAtendimento;

                        ObjUsuario.Id = ObjAtend.IdTecnico;

                        ObjUsuario  = new ManterUsuario(ObjUsuario).ConsultaUsuarioById();
                        NomeTecnico = ObjUsuario.Nome;

                        ObjUsuario.Id = ObjAtend.IdCliente;

                        ObjUsuario  = new ManterUsuario(ObjUsuario).ConsultaUsuarioById();
                        NomeCliente = ObjUsuario.Nome;

                        ObjPrioridade.Id = ObjChamado.IdPrioridade;

                        ObjPrioridade = new ManterPrioridadeChamado(ObjPrioridade).ConsultaPrioridadeChamadoById();
                        ObjRegiao     = new ManterRegiaoAtendimento(ObjRegiao).ConsultaRegiaoAtendimentoById();
                        ObjServico    = new ManterServico(ObjServico).ConsultaServicoById();
                        ObjStatusChm  = new ManterStatusChamado(ObjStatusChm).ConsultaStatusChamadoById();

                        if (Session["perfil"].Equals("Cliente Físico") || Session["perfil"].Equals("Cliente Jurídico"))
                        {
                            if (!ObjAtend.IdCliente.Equals(Session["id"]))
                            {
                                Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                            }
                        }

                        if (ObjStatusChm.Id.Equals(3))
                        {
                            ObjAvaliacao.IdChamado = ObjChamado.Id;
                            ObjAvaliacao           = new ManterAvaliacao(ObjAvaliacao).ConsultaAvaliacao();
                        }

                        if (new ManterChamado(ObjChamado).ValidaTempoFechamento())
                        {
                            AvaliarChamadoButton.Enabled = true;
                            ReaberturaButton.Enabled     = true;
                        }
                        else
                        {
                            AvaliarChamadoButton.Enabled = false;
                            ReaberturaButton.Enabled     = false;
                        }
                    }
                    else
                    {
                        ObjChamado = null;
                        Mensagem   = "Chamado não encontrado ou inexistente.";
                        ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                    }
                }
                else
                {
                    Mensagem = "Nenhum número de chamado foi informado.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                ObjChamado    = null;
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 17
0
        protected void Encerrar_Click(object sender, EventArgs e)
        {
            try
            {
                EnceButtonClick = true;

                if (!EnceRelat.Value.Equals("") && !CheckBoxPend.Checked || !PendRelat.Value.Equals("") && CheckBoxPend.Checked)
                {
                    ObjAtend   = FactoryAtendimento.GetNew();
                    ObjChamado = FactoryChamado.GetNew();

                    ObjChamado.Id      = Convert.ToInt32(Request.QueryString["IdChamado"]);
                    ObjAtend.IdChamado = ObjChamado.Id;
                    ObjAtend           = new ManterAtendimento(ObjAtend).ConsultaAtendimentoByIdChamado();

                    if (CheckBoxPend.Checked && !PendRelat.Value.Equals(""))
                    {
                        ObjAtend.Relatorio       = PendRelat.Value;
                        ObjChamado.Pendencia     = true;
                        ObjChamado.InfoPendencia = PendRelat.Value;

                        if (new ManterAtendimento(ObjAtend, ObjChamado).EncerraAtendimento())
                        {
                            Response.Redirect("\\Views\\SGA\\VChamado\\ConsultaChamado.aspx?IdChamado=" + ObjChamado.Id + "&Mensagem=Encerrado", false);
                        }
                        else
                        {
                            Mensagem = "Ocorreu um problema no encerramento do chamado.";
                            ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                        }
                    }
                    else
                    {
                        Mensagem = "Informe as pendências.";
                        ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                    }

                    if (!CheckBoxPend.Checked)
                    {
                        ObjAtend.Relatorio = EnceRelat.Value;

                        if (new ManterAtendimento(ObjAtend, ObjChamado).EncerraAtendimento())
                        {
                            Response.Redirect("\\Views\\SGA\\VChamado\\ConsultaChamado.aspx?IdChamado=" + ObjChamado.Id + "&Mensagem=Encerrado", false);
                        }
                        else
                        {
                            Mensagem = "Ocorreu um problema no encerramento do chamado.";
                            ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                        }
                    }
                }
                else
                {
                    Mensagem = "Informe o relatório do atendimento.";
                    ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                ObjChamado    = null;
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Session["perfil"].Equals("Cliente Físico") && Session["perfil"].Equals("Cliente Jurídico"))
                {
                    Response.Redirect("\\Views\\SGA\\Inicio.aspx", false);
                }

                if (!Request.QueryString.Count.Equals(0))
                {
                    if (Request.QueryString.AllKeys.Contains("Chat"))
                    {
                        if (!Request.QueryString["Chat"].Equals(""))
                        {
                            Usuarios    = Request.QueryString["Chat"];
                            UsuariosAux = Usuarios.Split('!');

                            foreach (var Usr in UsuariosAux)
                            {
                                if (ObjChat.ObjChatPrivado.IdUsrMBOrig == null)
                                {
                                    ObjChat.ObjChatPrivado.IdUsrMBOrig = Usr;
                                }
                                else
                                {
                                    ObjChat.ObjChatPrivado.IdUsrMBDest = Usr;
                                    ObjUsuario.IdMS = Usr;
                                }
                            }

                            if (!new ManterChat(ObjChat).ValidaChatCriado())
                            {
                                if (new ManterChat().CriaSalaPrivada(ObjChat))
                                {
                                    ObjNotificacao            = FactoryNotificacao.GetNew();
                                    ObjNotificacao.IdOrigem   = (int)Session["id"];
                                    ObjNotificacao.IdMensagem = 2;
                                    ObjNotificacao.IdTipo     = 2;

                                    if (new ManterNotificacao(ObjNotificacao, ObjUsuario).NotificaUsuariosChat())
                                    {
                                        ChatCriado = true;
                                    }
                                }
                            }
                        }
                    }

                    if (Request.QueryString.AllKeys.Contains("Conversa"))
                    {
                        if (!Request.QueryString["Conversa"].Equals(""))
                        {
                            ConversaIniciada = true;
                            IdPrivado        = Request.QueryString["Conversa"];
                            ObjChat.ObjChatPrivado.IdPrivado = Convert.ToInt32(IdPrivado);

                            foreach (var ObjChat in new ManterChat(ObjChat).RetornaChatPrivado())
                            {
                                ListaMensagens.Add(ObjChat);
                            }

                            ListaMensagens.Reverse();
                        }
                    }
                }

                ObjChat.ObjChatPrivado.IdUsrMBOrig = (string)Session["idms"];

                foreach (var Salas in new ManterChat(ObjChat).RetornaSalas())
                {
                    if (!Salas.ObjChatPrivado.IdUsrDest.Equals((int)Session["id"]))
                    {
                        ListaSalas.Add(Salas);
                    }
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Create safe error messages.
            string generalErrorMsg = "Ops, ocorreu um erro no sistema. Favor tente novamente. " +
                                     "Se persistir, favor contatar o suporte técnico.";
            string httpErrorMsg      = "Ops, ocorreu um problema. Tente novamente.";
            string unhandledErrorMsg = "Ops, ocorreu um erro no sistema. Contate o suporte técnico.";

            // Display safe error message.
            FriendlyErrorMsg.Text = generalErrorMsg;

            // Determine where error was handled.
            string errorHandler = Request.QueryString["handler"];

            if (errorHandler == null)
            {
                errorHandler = "Error Page";
            }

            // Get the last error from the server.
            Exception Ex = Server.GetLastError();

            // Get the error number passed as a querystring value.
            string errorMsg = Request.QueryString["msg"];

            if (errorMsg == "404")
            {
                Ex = new HttpException(404, httpErrorMsg, Ex);
                FriendlyErrorMsg.Text = Ex.Message;
            }

            // If the exception no longer exists, create a generic exception.
            if (Ex == null)
            {
                Ex = new Exception(unhandledErrorMsg);
            }

            // Show error details to only you (developer). LOCAL ACCESS ONLY.
            if (Request.IsLocal)
            {
                // Detailed Error Message.
                ErrorDetailedMsg.Text = Ex.Message;

                // Show where the error was handled.
                ErrorHandler.Text = errorHandler;

                // Show local access details.
                DetailedErrorPanel.Visible = true;

                if (Ex.InnerException != null)
                {
                    InnerMessage.Text = Ex.GetType().ToString() + "<br/>" +
                                        Ex.InnerException.Message;
                    //InnerTrace.Text = Ex.InnerException.StackTrace;
                }
                else
                {
                    InnerMessage.Text = Ex.GetType().ToString();
                    if (Ex.StackTrace != null)
                    {
                        //InnerTrace.Text = Ex.StackTrace.ToString().TrimStart();
                    }
                }
            }

            LogException.InsereLogBd(Ex);

            Server.ClearError();
        }
Ejemplo n.º 20
0
        protected void BotaoCriarUsuario_OnClick(object sender, EventArgs e)
        {
            try
            {
                if (DropDownListTipo.Text.Equals("Administrador"))
                {
                    ObjUsuario = FactoryUsuario.GetNew(TipoUsuario.Usuario);
                    ValidaInfo = true;
                }
                else if (DropDownListTipo.Text.Equals("Técnico") && DropDownListEspec.SelectedIndex > 0 && DropDownListArea.SelectedIndex > 0)
                {
                    ObjUsuario             = FactoryUsuario.GetNew(TipoUsuario.UsuarioFuncionario);
                    ObjUsuario.ObjEspec.Id = Convert.ToInt32(DropDownListEspec.SelectedValue);
                    ValidaInfo             = true;

                    if (!IdEmpresa.Equals(0) || !IdEmpresa.Equals(null))
                    {
                        ObjUsuario.IdEmpresa = (int)(Session["idEmpresa"]);
                    }
                    else
                    {
                        ObjUsuario.IdEmpresa = Convert.ToInt32(DropDownListEmpresa.SelectedValue);
                    }
                }
                else if (DropDownListTipo.Text.Equals("Gestor") || DropDownListTipo.Text.Equals("Atendente"))
                {
                    ObjUsuario = FactoryUsuario.GetNew(TipoUsuario.UsuarioFuncionario);
                    ValidaInfo = true;

                    if (!IdEmpresa.Equals(0) || !IdEmpresa.Equals(null))
                    {
                        ObjUsuario.IdEmpresa = (int)(Session["idEmpresa"]);
                    }
                    else
                    {
                        ObjUsuario.IdEmpresa = Convert.ToInt32(DropDownListEmpresa.SelectedValue);
                    }
                }
                else if (DropDownListTipo.Text.Equals("Cliente Físico") && DropDownListArea.SelectedIndex > 0)
                {
                    ObjUsuario = FactoryUsuario.GetNew(TipoUsuario.UsuarioClienteFisico);
                    ObjUsuario.ObjCF.DocIdent = Doc.Value;
                    ObjUsuario.ObjCF.OrgEmiss = EmissDoc.Value;

                    CPFValido = ValidaDocumento.ValidaCPF(CPF.Value);

                    if (CPFValido)
                    {
                        ObjUsuario.ObjCF.Cpf = CPF.Value;
                        ValidaInfo           = true;
                    }
                    else
                    {
                        CNPJValido = true;
                        ValidaInfo = false;
                    }
                }
                else if (DropDownListTipo.Text.Equals("Cliente Jurídico") && DropDownListArea.SelectedIndex > 0)
                {
                    ObjUsuario = FactoryUsuario.GetNew(TipoUsuario.UsuarioClienteJuridico);
                    CNPJValido = ValidaDocumento.ValidaCNPJ(CNPJ.Value);

                    if (CNPJValido)
                    {
                        ObjUsuario.ObjCJ.Cnpj = CNPJ.Value;
                        ValidaInfo            = true;
                    }
                    else
                    {
                        CPFValido  = true;
                        ValidaInfo = false;
                    }
                }
                else
                {
                    ValidaInfo = false;
                }

                if (ValidaInfo)
                {
                    ObjUsuario.Login        = UserName.Value;
                    ObjUsuario.Senha        = Password.Value;
                    ObjUsuario.Email        = Email.Value;
                    ObjUsuario.Regra        = DropDownListTipo.SelectedValue;
                    ObjUsuario.Nome         = Nome.Value;
                    ObjUsuario.Endereco     = ValidaCEP.GetCEPCorreios(CEP.Value, Complemento.Value);
                    ObjUsuario.Complemento  = Complemento.Value;
                    ObjUsuario.Cep          = CEP.Value;
                    ObjUsuario.Telefone     = Telefone.Value;
                    ObjUsuario.ObjRegiao.Id = Convert.ToInt32(DropDownListArea.SelectedValue);

                    if (ObjUsuario.Endereco != null)
                    {
                        Mensagem = new ManterUsuario(ObjUsuario).CadastraUsuario();

                        if (Mensagem.Equals("Usuário cadastrado com sucesso!"))
                        {
                            Endereco.Disabled = false;
                            Endereco.Value    = ObjUsuario.Endereco;
                            ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                        }
                    }
                    else
                    {
                        Mensagem = "CEP inválido ou incorreto. Favor verificar.";
                        ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                    }
                }
                else
                {
                    if (!CPFValido)
                    {
                        Mensagem = "O CPF é invalido. Favor verificar.";
                        ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                    }
                    else if (!CNPJValido)
                    {
                        Mensagem = "O CNPJ é invalido. Favor verificar.";
                        ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                    }
                    else
                    {
                        Mensagem = "Informações obrigatórias não preenchidas.";
                        ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true);
                    }
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                MsgLabel.Text = LogException.CodigoErroBd();
            }
        }
Ejemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Roles.GetRolesForUser(Membership.GetUser().ToString())[0].Equals("Administrador") || Roles.GetRolesForUser(Membership.GetUser().ToString())[0].Equals("Gestor"))
                {
                    ListaGeo = new ManterGeo(ObjGeo).InformaGeo();

                    foreach (var Lista in new ManterRelatorio(ObjRelatorio).GetQtdChamados())
                    {
                        ObjRelatorio = Lista;
                    }

                    ObjRelatorioDonut.RelatMes = true;

                    foreach (var Lista in new ManterRelatorio(ObjRelatorioDonut).GetQtdChamados())
                    {
                        ObjRelatorioDonut = Lista;
                    }

                    ObjRelatorioChart.RelatAno = true;

                    ListAux = new List <Relatorio>();
                    ListAux = new ManterRelatorio(ObjRelatorioChart).GetQtdChamados();
                    Count   = 0;

                    foreach (var Lista in ListAux)
                    {
                        Relatorio Obj = FactoryRelatorio.GetNew();

                        if (Lista.Status.Equals(1))
                        {
                            Obj.Mes             = Lista.Mes;
                            Obj.QtdChamadosAber = Lista.QtdChamadosAber;
                        }

                        if (!ListAux.Count.Equals(Count + 1))
                        {
                            if (ListAux[Count + 1].Mes.Equals(Obj.Mes) && ListAux[Count + 1].Status.Equals(3))
                            {
                                Obj.QtdChamadosConc = ListAux[Count + 1].QtdChamadosConc;
                            }
                        }

                        ListRelat.Add(Obj);
                        Count += 1;
                    }

                    ListTopAtend = new ManterRelatorio(ObjRelatorio).GetTopTecnicos();

                    ListTopSoluc = new ManterRelatorio(ObjRelatorio).GetTopSolucoes();

                    ListServico = new ManterRelatorio(ObjRelatorio).GetQtdPorServico();

                    ListRegiao = new ManterRelatorio(ObjRelatorio).GetAtendimentoPorRegiao();

                    ListTopTempo = new ManterRelatorio(ObjRelatorio).GetRelatorioTempoAtendimento();

                    ListTopTempo.RemoveRange(5, ListTopTempo.Count - 5); //Verificar quando a lista tem menos de 5 da erro

                    ObjRelatorioTempoMedio = new ManterRelatorio(ObjRelatorioTempoMedio).GetTempoMedioAtendimento();
                }
            }
            catch (Exception Ex)
            {
                LogException.InsereLogBd(Ex);
                //MsgLabel.Text = LogException.CodigoErroBd();
            }
        }