Пример #1
0
    private void Retrieve(int cod)
    {
        t07_restricao t07 = new t07_restricao();
        {
            t07.t07_cd_restricao = cod;
            t07.Retrieve();
            if (t07.Found)
            {
                lblds_restricao.Text = t07.ds_restricao;
                lblds_medida.Text = t07.ds_medida;
                lbldt_limite.Text = t07.dt_limite.ToShortDateString();
                lbldt_cadastro.Text = t07.dt_cadastro.ToShortDateString();

                t29_acaorestricao t29 = new t29_acaorestricao();
                {
                    t29.t07_cd_restricao = t07.t07_cd_restricao;
                    t29.Retrieve();
                    if (t29.Found)
                    {
                        t08_acao t08 = new t08_acao();
                        {
                            t08.t08_cd_acao = t29.t08_cd_acao;
                            t08.Retrieve();
                            if (t08.Found)
                            {
                                trAcao.Visible = true;
                                lblnm_acao.Text = t08.nm_acao;
                            }

                        }
                    }
                    else
                    {
                        trProjeto.Visible = true;
                    }
                }
            }
        }
    }
Пример #2
0
    protected string statusAcao(int cd_acao)
    {
        string cor = "";
        bool r = false;
        bool g = false;
        bool b = false;
        t09_marco t09 = new t09_marco();
        {
            t09.t08_cd_acao = cd_acao;
            foreach (DataRow dr in t09.List().Tables[0].Rows)
            {
                switch (dr["fl_status"].ToString())
                {
                    case "R":
                        r = true;
                        break;
                    case "G":
                        g = true;
                        break;
                    case "B":
                        b = true;
                        break;
                }
            }
        }
        if (r)
        {
            cor = "<img src=\"images/R.gif\" />";
        }
        else if (g)
        {
            cor = "<img src=\"images/G.gif\" />";
        }
        else if (b)
        {
            cor = "<img src=\"images/B.gif\" />";
        }
        else
        {
            cor = "";
        }
        if (!r)
        {
            t29_acaorestricao t29 = new t29_acaorestricao();
            {
                t29.t08_cd_acao = cd_acao;
                t29.RetrieveAcao();
                if (t29.Found)
                {
                    cor = "<img src=\"images/Y.gif\" />";
                }
            }
        }

        return cor;
    }
Пример #3
0
    protected string restricaoAcao(int cd_acao)
    {
        string str = "";
        t29_acaorestricao t29 = new t29_acaorestricao();
        {
            t29.t08_cd_acao = cd_acao;
            t29.RetrieveAcao();
            if (t29.Found)
            {
                str = "<div style='font-weight:bold;text-align:center'>R</div>";
            }
        }

        return str;
    }
Пример #4
0
    public string Status(int cd_projeto)
    {
        StringBuilder sb = new StringBuilder();
        string fl_status;
        int azul = 0;
        int amarelo = 0;
        int vermelho = 0;
        int verde = 0;
        int total = 0;

        t08_acao t08 = new t08_acao();
        {
            //t08.order = " and t08_cd_acao not in (select t08_cd_acao from t29_acaorestricao)";
            t08.t03_cd_projeto = cd_projeto;
            foreach (DataRow dra in t08.List().Tables[0].Rows)
            {

                bool r = false;
                bool g = false;
                bool b = false;
                bool nenhum = false;
                t09_marco t09 = new t09_marco();
                {
                    t09.order = " and t08_cd_acao not in (select t08_cd_acao from t29_acaorestricao where t08_cd_acao not in (select t08_cd_acao from t09_marco where fl_ativa=1 and fl_status='R'))";
                    t09.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString());
                    foreach (DataRow dr in t09.List().Tables[0].Rows)
                    {
                        switch (dr["fl_status"].ToString())
                        {
                            case "R":
                                r = true;
                                break;
                            case "G":
                                g = true;
                                break;
                            case "B":
                                b = true;
                                break;
                        }
                    }
                }
                if (r)
                {
                    vermelho++;
                }
                else if (g)
                {
                    verde++;
                }
                else if (b)
                {
                    azul++;
                }
                else
                {
                    nenhum = true;
                }

                if (!r)
                {
                    t29_acaorestricao t29 = new t29_acaorestricao();
                    {
                        t29.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString());
                        t29.RetrieveAcao();
                        if (t29.Found)
                        {
                            amarelo++;
                            nenhum = false;
                        }
                        else
                        {
                            nenhum = true;
                        }
                    }
                }
                //if (!nenhum)
                //{
                //    total++;
                //}
            }

            total = verde + vermelho + amarelo + azul;

            //t09_marco t09 = new t09_marco();
            //{
            //    t09.order = " and t08_cd_acao in (select t08_cd_acao from t08_acao where fl_ativa=1 and t03_cd_projeto=" + cd_projeto.ToString() + ")";
            //    foreach (DataRow dr in t09.ListStatus().Tables[0].Rows)
            //    {
            //        fl_status = dr["fl_status"].ToString().Trim();
            //        switch (fl_status)
            //        {
            //            case ("Y"):
            //                amarelo += Int32.Parse(dr["nu_esforco"].ToString());
            //                break;

            //            case ("B"):
            //                azul += Int32.Parse(dr["nu_esforco"].ToString());
            //                break;

            //            case ("G"):
            //                verde += Int32.Parse(dr["nu_esforco"].ToString());
            //                break;

            //            case ("R"):
            //                vermelho += Int32.Parse(dr["nu_esforco"].ToString());
            //                break;
            //        }
            //        total += Int32.Parse(dr["nu_esforco"].ToString());
            //    }
            //}
            if (total > 0)
            {
                sb.Append("<table width=100% height=17 border=0 cellpadding=0 cellspacing=0><tr>");
                if (azul != 0)
                {
                    sb.Append("<td style=\"border:none;background:url('images/B.gif');width:" + (azul * 100) / total + "%\" title='" + (azul * 100) / total + "%'>&nbsp;</td>");
                }
                if (verde != 0)
                {
                    sb.Append("<td style=\"border:none;background:url('images/G.gif');width:" + (verde * 100) / total + "%\" title='" + (verde * 100) / total + "%'>&nbsp;</td>");
                }
                if (amarelo != 0)
                {
                    sb.Append("<td style=\"border:none;background:url('images/Y.gif');width:" + (amarelo * 100) / total + "%\" title='" + (amarelo * 100) / total + "%'>&nbsp;</td>");
                }
                if (vermelho != 0)
                {
                    sb.Append("<td style=\"border:none;background:url('images/R.gif');width:" + (vermelho * 100) / total + "%\" title='" + (vermelho * 100) / total + "%'>&nbsp;</td>");
                }
                sb.Append("</tr></table>");
            }
            else
            {
                sb.Append("&nbsp;");
            }

        }

        return sb.ToString();
    }
Пример #5
0
    public void AcaoStatus(Panel pn)
    {
        try
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            int azul = 0;
            int amarelo = 0;
            int vermelho = 0;
            int verde = 0;
            int total = 0;

            t03_projeto t03 = new t03_projeto();
            {
                t03.order = "select * from t03_projeto where (fl_ativa=1)   " + pb.sqlfiltro() + " order by t03_cd_projeto";
                foreach (DataRow drp in t03.ListQuery().Tables[0].Rows)
                {
                    t08_acao t08 = new t08_acao();
                    {
                        t08.t03_cd_projeto = (int)drp["t03_cd_projeto"];
                        foreach (DataRow dra in t08.List().Tables[0].Rows)
                        {

                            bool r = false;
                            bool g = false;
                            bool b = false;
                            t09_marco t09 = new t09_marco();
                            {
                                t09.order = " and t08_cd_acao not in (select t08_cd_acao from t29_acaorestricao where t08_cd_acao not in (select t08_cd_acao from t09_marco where fl_ativa=1 and fl_status='R')) ";
                                t09.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString());
                                foreach (DataRow dr in t09.List().Tables[0].Rows)
                                {
                                    switch (dr["fl_status"].ToString())
                                    {
                                        case "R":
                                            r = true;
                                            break;
                                        case "G":
                                            g = true;
                                            break;
                                        case "B":
                                            b = true;
                                            break;
                                    }
                                }
                            }
                            if (r)
                            {
                                vermelho++;
                            }
                            else if (g)
                            {
                                verde++;
                            }
                            else if (b)
                            {
                                azul++;
                            }

                            if (!r)
                            {
                                t29_acaorestricao t29 = new t29_acaorestricao();
                                {
                                    t29.t08_cd_acao = Int32.Parse(dra["t08_cd_acao"].ToString());
                                    t29.RetrieveAcao();
                                    if (t29.Found)
                                    {
                                        amarelo++;
                                    }

                                }
                            }
                        }

                    }
                }

                total = verde + vermelho + amarelo + azul;
                if (total > 0)
                {

                    lblAzul.Text = azul.ToString();
                    lblVerde.Text = verde.ToString();
                    lblAmarela.Text = amarelo.ToString();
                    lblVermelha.Text = vermelho.ToString();

                    lblFatiaAzul.Text = ((azul * 100) / total).ToString();
                    lblFatiaVerde.Text = ((verde * 100) / total).ToString();
                    lblFatiaAmarela.Text = ((amarelo * 100) / total).ToString();
                    lblFatiaVermelha.Text = ((vermelho * 100) / total).ToString();

                    if (azul == 0) linkConcluidos.NavigateUrl = "";
                    if (verde == 0) linkPrazos.NavigateUrl = "";
                    if (amarelo == 0) linkComRestricoes.NavigateUrl = "";
                    if (vermelho == 0) linkAtraso.NavigateUrl = "";

                    sb.Append("<table width=100% height=20 border=0 cellpadding=0 cellspacing=0><tr>");
                    if (azul != 0)
                    {
                        sb.Append("<td style=\"border:none;background:url('images/B.gif');width:" + (azul * 100) / total + "%\" title='" + (azul * 100) / total + "%'>&nbsp;</td>");
                    }
                    if (verde != 0)
                    {
                        sb.Append("<td style=\"border:none;background:url('images/G.gif');width:" + (verde * 100) / total + "%\" title='" + (verde * 100) / total + "%'>&nbsp;</td>");
                    }
                    if (amarelo != 0)
                    {
                        sb.Append("<td style=\"border:none;background:url('images/Y.gif');width:" + (amarelo * 100) / total + "%\" title='" + (amarelo * 100) / total + "%'>&nbsp;</td>");
                    }
                    if (vermelho != 0)
                    {
                        sb.Append("<td style=\"border:none;background:url('images/R.gif');width:" + (vermelho * 100) / total + "%\" title='" + (vermelho * 100) / total + "%'>&nbsp;</td>");
                    }
                    sb.Append("</tr></table>");
                }
                else
                {

                    lblAzul.Text = "0";
                    lblVerde.Text = "0";
                    lblAmarela.Text = "0";
                    lblVermelha.Text = "0";

                    lblFatiaAzul.Text = "0";
                    lblFatiaVerde.Text = "0";
                    lblFatiaAmarela.Text = "0";
                    lblFatiaVermelha.Text = "0";

                    linkConcluidos.NavigateUrl = "";
                    linkPrazos.NavigateUrl = "";
                    linkComRestricoes.NavigateUrl = "";
                    linkAtraso.NavigateUrl = "";
                }
            }
            pn.Controls.Add(pb.GetLiteral(sb.ToString()));
        }
        catch (Exception ex)
        {
            Response.Write("AcaoStatus: " + ex.Message);
        }
    }
Пример #6
0
    private void Retrieve()
    {
        t07_restricao t07 = new t07_restricao();
        {
            t07.t07_cd_restricao = Int32.Parse(cod.Value);
            t07.Retrieve();
            if (t07.Found)
            {

                txtds_restricao.Text = t07.ds_restricao;
                txtds_medida.Text = t07.ds_medida;
                txtdt_limite.Text = t07.dt_limite.ToShortDateString();
                ddlt08_cd_acao.ClearSelection();
                t29_acaorestricao t29 = new t29_acaorestricao();
                {
                    t29.t07_cd_restricao = t07.t07_cd_restricao;
                    t29.Retrieve();
                    if (t29.Found)
                    {
                        ListItem li = ddlt08_cd_acao.Items.FindByValue(t29.t08_cd_acao.ToString());
                        if (li != null)
                            li.Selected = true;
                    }
                    else
                    {
                        cbProjeto.Checked = true;
                    }
                }
            }
        }
    }
Пример #7
0
    protected void btnAcao_Click(object sender, System.EventArgs e)
    {
        t07_restricao t07 = new t07_restricao();
        {
            bool result = false;
            bool erro = false;
            string msg = "";
            t07.t03_cd_projeto = pb.cd_projeto();
            t07.ds_restricao = pb.ReplaceAspas(txtds_restricao.Text);
            t07.ds_medida = pb.ReplaceAspas(txtds_medida.Text);
            t07.dt_limite = DateTime.Parse(txtdt_limite.Text);
            t07.dt_cadastro = DateTime.Now;
            t07.dt_alterado = DateTime.Now;

            if ((ddlt08_cd_acao.SelectedValue == "") && (!cbProjeto.Checked))
            {
                erro = true;
                msg = pb.Message("É necessário selecionar uma ação ou marcar a opção Restrição vinculada ao projeto, antes de continuar.", "erro");
                btnAcao.Focus();
            }
            else if ((ddlt08_cd_acao.SelectedValue != "") && (cbProjeto.Checked))
            {
                erro = true;
                msg = pb.Message("Favor escolher somente uma das opções: Ação relacionada ou Restrição vinculada ao projeto, antes de continuar.", "erro");
                btnAcao.Focus();
            }

            if (!(erro))
            {
                if (cod.Value != "0")
                {
                    t07.t07_cd_restricao = Int32.Parse(cod.Value);
                    result = t07.Update();
                    msg = "Alteração realizada com sucesso!";
                    pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t07_restricao", "update", cod.Value);
                }
                else
                {
                    result = t07.Save();
                    msg = "Cadastro realizado com sucesso!";
                    pb.criarEmail(pb.cd_projeto(), txtds_restricao.Text);
                    pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t07_restricao", "insert", t07.ds_restricao);
                }

                if (result)
                {
                    if (cod.Value == "0")
                    {
                        t07.RetrieveCod();
                        if (t07.Found) cod.Value = t07.t07_cd_restricao.ToString();
                    }
                    if (!cbProjeto.Checked)
                    {
                        t29_acaorestricao t29 = new t29_acaorestricao();
                        {
                            t29.t07_cd_restricao = Int32.Parse(cod.Value);
                            t29.t08_cd_acao = Int32.Parse(ddlt08_cd_acao.SelectedValue);
                            t29.Delete();
                            t29.Save();
                        }
                    }
                }

                Ocultar();
                GridBind();
                cod.Value = "0";
                Response.Redirect("Gerenciamento.aspx?msg=" + msg);

            }
            lblMsg.Text = msg;
            lblMsg.Visible = true;
        }
    }
Пример #8
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        bool redirect = false;
        string msg = "";
        try
        {
            GridView gv = (GridView)sender;
            int cd = Int32.Parse(gv.DataKeys[Int32.Parse(e.CommandArgument.ToString())].Value.ToString());
            switch (e.CommandName.Trim())
            {
                case "Superada":
                    t07_restricao t07 = new t07_restricao();
                    {
                        t07.t07_cd_restricao = cd;
                        t07.dt_superada = DateTime.Now;
                        t07.dt_alterado = DateTime.Now;
                        t07.UpdateSuperar();
                        pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "superou a restrição", "t07_restricao", "update", t07.t07_cd_restricao.ToString());
                    }
                    t29_acaorestricao t29 = new t29_acaorestricao();
                    {
                        t29.t07_cd_restricao = cd;
                        t29.Delete();
                    }
                    GridBind();
                    msg = "Restrição superada com sucesso!";

                    break;

                case "Selecionar":
                    Context.Items["t07_cd_restricao"] = cd.ToString();
                    Server.Transfer("~/Restricao.aspx", false);
                    break;

                case "Editar":
                    Exibir();
                    this.lblHeader.Text = "Alteração";
                    this.btnAcao.Text = "Alterar";
                    btnAcao.Focus();
                    cod.Value = cd.ToString();
                    Retrieve();

                    break;
                case "Deletar":
                    t07 = new t07_restricao();
                    {
                        t07.t07_cd_restricao = cd;
                        t07.Delete();
                        pb.saveLog(pb.cd_usuario(), pb.cd_projeto(), "", "t07_restricao", "delete", t07.t07_cd_restricao.ToString());
                    }
                    t29 = new t29_acaorestricao();
                    {
                        t29.t07_cd_restricao = cd;
                        t29.Delete();
                    }
                    GridBind();
                    msg = "Exclusão realizada com sucesso!";

                    redirect = true;
                    break;
            }
        }
        catch (Exception ex)
        {
            lblMsg.Text = pb.Message(ex.Message, "erro");
            lblMsg.Visible = true;
        }

        if (msg.Length > 1)
        {
            lblMsg.Text = pb.Message(msg, "ok");
            lblMsg.Visible = true;
        }
        if (redirect)
        {
            Response.Redirect("Gerenciamento.aspx?msg=" + msg);
        }
    }