protected void grdRequests_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType != DataControlRowType.DataRow)
            {
                return;
            }

            Model.Boloes.BolaoRequest request = (Model.Boloes.BolaoRequest)e.Row.DataItem;

            Label      lblStatus   = (Label)e.Row.FindControl("lblStatus");
            LinkButton lnkAprovar  = (LinkButton)e.Row.FindControl("lnkAprovar");
            LinkButton lnkRejeitar = (LinkButton)e.Row.FindControl("lnkRejeitar");


            lnkAprovar.CommandArgument  = e.Row.RowIndex.ToString();
            lnkRejeitar.CommandArgument = e.Row.RowIndex.ToString();



            if (request.StatusRequestID == BolaoNet.Model.Boloes.BolaoRequest.Status.Convidado)
            {
                lblStatus.Visible   = true;
                lnkAprovar.Visible  = false;
                lnkRejeitar.Visible = false;
            }
            else
            {
                lblStatus.Visible   = false;
                lnkAprovar.Visible  = true;
                lnkRejeitar.Visible = true;
            }
        }
Esempio n. 2
0
        public bool BolaoChangeStatus(Model.Boloes.BolaoRequest request)
        {
            int    errorNumber      = 0;
            string errorDescription = null;

            bool result = _daoBase.BolaoChangeStatus(
                _currentLogin, request, out errorNumber, out errorDescription);

            if (errorNumber != 0 || !string.IsNullOrEmpty(errorDescription))
            {
                return(false);
            }

            return(result);
        }
        protected void grdRequests_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Business.Boloes.Support.Bolao business = new BolaoNet.Business.Boloes.Support.Bolao(base.UserName, CurrentBolao.Nome);

            IList <Framework.DataServices.Model.EntityBaseData> list =
                (IList <Framework.DataServices.Model.EntityBaseData>)ViewState["RequestList"];

            int rowIndex = int.Parse(e.CommandArgument.ToString());

            Model.Boloes.BolaoRequest request = (Model.Boloes.BolaoRequest)list[rowIndex];
            request.AnsweredBy = base.UserName;


            switch (e.CommandName)
            {
            case "Rejeitar":

                if (business.BolaoChangeStatus(request))
                {
                    base.ShowMessages("Requisição rejeitada com sucesso.");
                }
                else
                {
                    base.ShowErrors("Erro ao rejeitar a requisição.");
                }


                break;

            case "Aprovar":

                if (business.BolaoAceitar(request))
                {
                    base.ShowMessages("Requisição aceita com sucesso.");
                }
                else
                {
                    base.ShowErrors("Erro ao aceitar a requisição.");
                }


                break;
            }
        }
Esempio n. 4
0
        public bool BolaoAceitar(Model.Boloes.BolaoRequest request)
        {
            int    errorNumber      = 0;
            string errorDescription = null;

            request.StatusRequestID = BolaoNet.Model.Boloes.BolaoRequest.Status.Aprovado;

            bool result = _daoBase.BolaoChangeStatus(
                _currentLogin, request, out errorNumber, out errorDescription);

            if (errorNumber != 0 || !string.IsNullOrEmpty(errorDescription))
            {
                return(false);
            }


            //Inserindo o membro
            result = InsertMembro(new Framework.Security.Model.UserData(request.RequestedBy));


            return(result);
        }