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.º 2
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);
        }