protected void GridView_Sorting(object sender, GridViewSortEventArgs e)
        {
            ChamadosBLL chamadosBLL = new ChamadosBLL();
            DataTable   dt          = new DataTable();

            Usuario usuario = null;

            usuario = (Usuario)Session["objetoUsuario"];

            dt = chamadosBLL.GetChamados(usuario);

            if (dt.Rows.Count > 0)
            {
                dt.DefaultView.Sort = e.SortExpression + " " + GetDirecaoSort(e.SortExpression);

                GrdChamados.DataSource = dt;

                //Validação para mudança de valores no grid referente a status do chamado
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["StatusChamado"].ToString() == "P ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Pendente";
                    }

                    if (dt.Rows[i]["StatusChamado"].ToString() == "A ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Em atendimento";
                    }

                    if (dt.Rows[i]["StatusChamado"].ToString() == "F ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Finalizado";
                    }
                }

                //Validação para mudança de valores no grid referente a prioridade do chamado
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["Prioridade"].ToString() == "0 ")
                    {
                        dt.Rows[i]["Prioridade"] = "Alta";
                    }

                    if (dt.Rows[i]["Prioridade"].ToString() == "1 ")
                    {
                        dt.Rows[i]["Prioridade"] = "Média";
                    }

                    if (dt.Rows[i]["Prioridade"].ToString() == "2 ")
                    {
                        dt.Rows[i]["Prioridade"] = "Baixa";
                    }
                }

                GrdChamados.DataBind();
            }
        }
        protected void GrdChamados_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            //Mudar código aqui para melhorar performance

            DataTable   dt          = new DataTable();
            ChamadosBLL chamadosBLL = new ChamadosBLL();

            dt = chamadosBLL.ListaChamadosPorId(Convert.ToInt32(Session["IdUsuario"].ToString()));

            GrdChamados.DataSource = dt;
            GrdChamados.PageIndex  = e.NewPageIndex;

            if (dt.Rows.Count > 0)
            {
                GrdChamados.DataSource = dt;

                //Validação para mudança de valores no grid referente a status do chamado
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["StatusChamado"].ToString() == "P ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Pendente";
                    }

                    if (dt.Rows[i]["StatusChamado"].ToString() == "A ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Em atendimento";
                    }

                    if (dt.Rows[i]["StatusChamado"].ToString() == "F ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Finalizado";
                    }
                }

                //Validação para mudança de valores no grid referente a prioridade do chamado
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["Prioridade"].ToString() == "0 ")
                    {
                        dt.Rows[i]["Prioridade"] = "Alta";
                    }

                    if (dt.Rows[i]["Prioridade"].ToString() == "1 ")
                    {
                        dt.Rows[i]["Prioridade"] = "Média";
                    }

                    if (dt.Rows[i]["Prioridade"].ToString() == "2 ")
                    {
                        dt.Rows[i]["Prioridade"] = "Baixa";
                    }
                }

                GrdChamados.DataBind();
            }
        }
Ejemplo n.º 3
0
        protected void GrdChamados_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            DataTable   dt          = new DataTable();
            ChamadosBLL chamadosBLL = new ChamadosBLL();
            Usuario     usuario     = null;

            usuario = (Usuario)Session["objetoUsuario"];

            dt = chamadosBLL.GetChamados(usuario);
            GrdChamados.DataSource = dt;
            GrdChamados.PageIndex  = e.NewPageIndex;

            if (dt.Rows.Count > 0)
            {
                GrdChamados.DataSource = dt;

                //Validação para mudança de valores no grid referente a status do chamado
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["StatusChamado"].ToString() == "P ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Pendente";
                    }

                    if (dt.Rows[i]["StatusChamado"].ToString() == "A ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Em atendimento";
                    }

                    if (dt.Rows[i]["StatusChamado"].ToString() == "F ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Finalizado";
                    }
                }

                //Validação para mudança de valores no grid referente a prioridade do chamado
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["Prioridade"].ToString() == "A ")
                    {
                        dt.Rows[i]["Prioridade"] = "Alta";
                    }

                    if (dt.Rows[i]["Prioridade"].ToString() == "M ")
                    {
                        dt.Rows[i]["Prioridade"] = "Média";
                    }

                    if (dt.Rows[i]["Prioridade"].ToString() == "B ")
                    {
                        dt.Rows[i]["Prioridade"] = "Baixa";
                    }
                }

                GrdChamados.DataBind();
            }
        }
        protected void AtenderChamado(GridViewRow oRow)
        {
            string IdChamado = ((Label)oRow.FindControl("IdChamado")).Text;

            if (!string.IsNullOrEmpty(IdChamado))
            {
                ChamadosBLL chamadoBLL = new ChamadosBLL();
                chamadoBLL.AtenderChamado(Convert.ToInt32(Session["IdUsuario"].ToString()), Convert.ToInt32(IdChamado));
                Response.Redirect("~/Meus-Chamados");
            }
        }
Ejemplo n.º 5
0
        protected void BtnFinalizar_ServerClick(object sender, EventArgs e)
        {
            string valorUrlIdChamado = Request.QueryString["IdChamado"];

            Chamado     chamado     = new Chamado();
            ChamadosBLL chamadosBLL = new ChamadosBLL();

            chamado.IdChamado = Convert.ToInt32(valorUrlIdChamado);

            chamado = chamadosBLL.FinalizarChamado(Convert.ToInt32(Session["IdUsuario"].ToString()), chamado.IdChamado);
            ScriptManager.RegisterClientScriptBlock(BtnFinalizar, BtnFinalizar.GetType(), "msgSucesso", "alert('Chamado finalizado com sucesso.');", true);
        }
Ejemplo n.º 6
0
        protected void ListaComentarios(int idChamado)
        {
            DataTable   dt         = new DataTable();
            ChamadosBLL chamadoBLL = new ChamadosBLL();

            dt = chamadoBLL.ListaHistoricoComentario(idChamado);

            if (dt.Rows.Count > 0)
            {
                rptComentarios.DataSource = dt;
                rptComentarios.DataBind();
            }
        }
Ejemplo n.º 7
0
        protected void BtnEnviarComentario_ServerClick(object sender, EventArgs e)
        {
            ChamadosBLL chamadoBLL = new ChamadosBLL();
            Chamado     chamado    = new Chamado();

            chamado.IdChamado       = Convert.ToInt32(Request.QueryString["IdChamado"]);
            chamado.Solicitante     = Convert.ToInt32(Session["IdUsuario"]);
            chamado.Observacao      = TxtComentario.Value;
            chamado.DataModificacao = DateTime.Now;

            chamadoBLL.InsereComentarioChamado(chamado);

            ScriptManager.RegisterClientScriptBlock(BtnEnviar, BtnEnviar.GetType(), "msgAlerta", "alert('Comentário enviado com sucesso.');", true);
            LimparCampos();
            ListaComentarios(Convert.ToInt32(Request.QueryString["IdChamado"]));
            OcultaPainelComentario();
        }
Ejemplo n.º 8
0
        //protected void BtnAtender_ServerClick(object sender, EventArgs e)
        //{
        //    int nIndice = ((GridViewRow)((Control)sender).NamingContainer).RowIndex;
        //    GridViewRow gvr = GrdChamados.Rows[nIndice];
        //    Chamado chamado = new Chamado();
        //    chamado = AtenderChamado(gvr);

        //    if (chamado.Ok == true)
        //    {
        //        //Chamado Pode ser atendido pelo usuário logado no sistema
        //        ScriptManager.RegisterClientScriptBlock(GrdChamados, GrdChamados.GetType(), "msgSucesso", "alert('Sucesso.');", true);
        //        Response.Redirect("~/Meus-Chamados");
        //    }

        //    else
        //    {
        //        //Mensagem erro aqui
        //        ScriptManager.RegisterClientScriptBlock(GrdChamados, GrdChamados.GetType(), "msgFalha", "alert('Não é possivel atender um chamado aberto por você.');", true);
        //    }

        //}

        protected Chamado AtenderChamado(GridViewRow oRow)
        {
            string  IdChamado = ((Label)oRow.FindControl("IdChamado")).Text;
            Chamado chamado   = new Chamado();

            if (!string.IsNullOrEmpty(IdChamado))
            {
                chamado.IdChamado   = Convert.ToInt32(IdChamado);
                chamado.Solicitante = Convert.ToInt32(Session["IdUsuario"].ToString());

                ChamadosBLL chamadoBLL = new ChamadosBLL();

                chamado = chamadoBLL.AtenderChamado(chamado.Solicitante, chamado.IdChamado);
            }

            return(chamado);
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["IdUsuario"] != null)
                {
                    string valorUrlIdChamado = Request.QueryString["IdChamado"];

                    if (valorUrlIdChamado != "")
                    {
                        DataTable   dt         = new DataTable();
                        ChamadosBLL chamadoBLL = new ChamadosBLL();
                        dt = chamadoBLL.ListaDetalheChamados(Convert.ToInt32(valorUrlIdChamado));

                        if (dt.Rows.Count > 0)
                        {
                            Preencher(dt, Convert.ToInt32(Session["IdUsuario"].ToString()));

                            ListaComentarios(Convert.ToInt32(valorUrlIdChamado));

                            //Oculta filtro de chamados
                            Label lblOrdenar = (Label)Master.FindControl("LblOrdenar");
                            lblOrdenar.Visible = false;

                            DropDownList drpFiltro = (DropDownList)Master.FindControl("drpPrioridade");
                            drpFiltro.Visible = false;
                        }
                    }
                }

                else
                {
                    Session.RemoveAll();
                    Response.Redirect("~/Conta");
                }
            }
        }
        protected void BtnCadastrar_ServerClick(object sender, EventArgs e)
        {
            //Instância de chamadoBLL
            ChamadosBLL chamadoBLL = new ChamadosBLL();

            //Instância de novo chamado
            Chamado chamado = new Chamado();

            //Preenche objeto com dados da página
            chamado = Preencher();

            //Chama BLL e insere chamado
            chamado = chamadoBLL.InserirChamado(chamado);

            if (UploadImagem.HasFile)
            {
                UploadImagem.SaveAs(Server.MapPath("~/Uploads/") + chamado.Anexo);
            }

            //Exibe mensagem de cadastro realizado com sucesso
            ScriptManager.RegisterClientScriptBlock(BtnCadastrar, BtnCadastrar.GetType(), "msgSucesso", "alert('Chamado aberto com sucesso.');", true);

            Response.Redirect("~/Chamados-Fila");
        }
        public DataTable CarregaRelatorio(int idEmpresa, string statusFiltro)
        {
            DataTable dt = new DataTable();
            //Instância de ChamadosBLL
            ChamadosBLL chamadosBLL = new ChamadosBLL();

            //Chama método BLL GetNumeroChamados
            dt = chamadosBLL.GetNumeroChamados(idEmpresa, statusFiltro);

            //Se o objeto dt não estiver vazio
            if (dt.Rows.Count > 0)
            {
                ChartReport.DataSource = dt;

                ChartReport.ChartAreas["ChartAreaReport"].AxisY.Title           = "Número de Chamados";
                ChartReport.ChartAreas["ChartAreaReport"].AxisX.Title           = "Categoria do Chamado";
                ChartReport.ChartAreas["ChartAreaReport"].AxisY.TitleFont       = new System.Drawing.Font("Verdana, Geneva, sans-serif", 9.50F, System.Drawing.FontStyle.Bold);
                ChartReport.ChartAreas["ChartAreaReport"].AxisX.TitleFont       = new System.Drawing.Font("Verdana, Geneva, sans-serif", 9.50F, System.Drawing.FontStyle.Bold);
                ChartReport.ChartAreas["ChartAreaReport"].AxisY.LabelStyle.Font = new System.Drawing.Font("Verdana, Geneva, sans-serif;", 9.05F, System.Drawing.FontStyle.Regular);
                ChartReport.ChartAreas["ChartAreaReport"].AxisX.LabelStyle.Font = new System.Drawing.Font("Verdana, Geneva, sans-serif;", 9.05F, System.Drawing.FontStyle.Regular);

                ChartReport.Series["SeriesReport"].YValueMembers = "NumeroOcorrencias";
                ChartReport.Series["SeriesReport"].XValueMember  = "CategoriaDoChamado";

                ChartReport.DataBind();
            }

            else
            {
                //Exibe mensagem
                LblMsgmChamados.Text    = "Existem" + " " + Convert.ToString(dt.Rows.Count.ToString()) + " " + "chamados abertos no momento";
                LblMsgmChamados.Visible = true;
            }

            return(dt);
        }
        protected void CarregaChamados(int IdUsuario)
        {
            DataTable   dt          = new DataTable();
            ChamadosBLL chamadosBLL = new ChamadosBLL();

            dt = chamadosBLL.ListaChamadosPorId(Convert.ToInt32(Session["IdUsuario"].ToString()));

            GrdChamados.DataSource = dt;

            //Validação para mudança de valores no grid referente a status do chamado

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["StatusChamado"].ToString() == "P ")
                {
                    dt.Rows[i]["StatusChamado"] = "Pendente";
                }

                if (dt.Rows[i]["StatusChamado"].ToString() == "A ")
                {
                    dt.Rows[i]["StatusChamado"] = "Em atendimento";
                }

                if (dt.Rows[i]["StatusChamado"].ToString() == "FA")
                {
                    dt.Rows[i]["StatusChamado"] = "Aguardando Aprovação";
                }

                if (dt.Rows[i]["StatusChamado"].ToString() == "F ")
                {
                    dt.Rows[i]["StatusChamado"] = "Finalizado";
                }
            }

            //Validação para mudança de valores no grid referente a prioridade do chamado

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["Prioridade"].ToString() == "A ")
                {
                    dt.Rows[i]["Prioridade"] = "Alta";
                }

                if (dt.Rows[i]["Prioridade"].ToString() == "M ")
                {
                    dt.Rows[i]["Prioridade"] = "Média";
                }

                if (dt.Rows[i]["Prioridade"].ToString() == "B ")
                {
                    dt.Rows[i]["Prioridade"] = "Baixa";
                }
            }

            GrdChamados.DataBind();

            if (dt.Rows.Count < 1)
            {
                //Oculta filtro de chamados
                Label lblOrdenar = (Label)Master.FindControl("LblOrdenar");
                lblOrdenar.Visible = false;

                DropDownList drpFiltro = (DropDownList)Master.FindControl("drpPrioridade");
                drpFiltro.Visible = false;

                //Exibe mensagem
                LblMsgmChamados.Text    = "Você não possui chamados em atendimento no momento";
                LblMsgmChamados.Visible = true;
            }

            else
            {
                //Exibe mensagem
                LblMsgmChamados.Text    = "Existem" + " " + Convert.ToString(dt.Rows.Count.ToString()) + " " + "chamados abertos no momento";
                LblMsgmChamados.Visible = true;
            }
        }
        protected void CarregaChamadosPorPalavraChave(string palavraChave)
        {
            DataTable   dt          = new DataTable();
            ChamadosBLL chamadosBLL = new ChamadosBLL();

            dt = chamadosBLL.GetChamadosPorPalavra(palavraChave);

            if (dt.Rows.Count > 0)
            {
                GrdChamados.DataSource = dt;

                //Validação para mudança de valores no grid referente a status do chamado
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["StatusChamado"].ToString() == "P ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Pendente";
                    }

                    if (dt.Rows[i]["StatusChamado"].ToString() == "A ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Em atendimento";
                    }

                    if (dt.Rows[i]["StatusChamado"].ToString() == "FA")
                    {
                        dt.Rows[i]["StatusChamado"] = "Aguardando Aprovação";
                    }

                    if (dt.Rows[i]["StatusChamado"].ToString() == "F ")
                    {
                        dt.Rows[i]["StatusChamado"] = "Finalizado";
                    }
                }

                //Validação para mudança de valores no grid referente a prioridade do chamado
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["Prioridade"].ToString() == "A ")
                    {
                        dt.Rows[i]["Prioridade"] = "Alta";
                    }

                    if (dt.Rows[i]["Prioridade"].ToString() == "M ")
                    {
                        dt.Rows[i]["Prioridade"] = "Média";
                    }

                    if (dt.Rows[i]["Prioridade"].ToString() == "B ")
                    {
                        dt.Rows[i]["Prioridade"] = "Baixa";
                    }
                }

                GrdChamados.DataBind();
            }

            else
            {
                //Oculta filtro de chamados
                Label lblOrdenar = (Label)Master.FindControl("LblOrdenar");
                lblOrdenar.Visible = false;

                DropDownList drpFiltro = (DropDownList)Master.FindControl("drpPrioridade");
                drpFiltro.Visible = false;
            }

            //Exibe mensagem com número de resultados encontrados
            LblMsgmChamados.Text = "Sua pesquisa retornou" + " " + Convert.ToString(dt.Rows.Count.ToString()) + " " + "resultados";
            //Exibe mensagem
            LblMsgmChamados.Visible = true;
        }