コード例 #1
0
 public void TearDown()
 {
     _labelMessage?.Dispose();
     _mpeMessage?.Dispose();
     _rptSideBar?.Dispose();
     _rptSpam?.Dispose();
     _rptPotentialProblems?.Dispose();
     _rptCodeHtmlValidation?.Dispose();
     _rptLinkCheck?.Dispose();
     _labelCodeAnalysisResult?.Dispose();
     _labelLinkCheckResult?.Dispose();
     _litHtml?.Dispose();
     _plHtmlValidation?.Dispose();
     _plPotentialProblems?.Dispose();
     _imageMap1?.Dispose();
     _labelPublicURL?.Dispose();
     _shimContext.Dispose();
 }
コード例 #2
0
    private void LoadCompetencies()
    {
        string username = UserHelper.GetUserId(Request.LogonUserIdentity.Name);
        string oldGroup = string.Empty;
        string group    = string.Empty;

        object[][] details = new object[5][];
        int        i       = 0;


        _params = Encryption.Decrypt(Request.Params["."]).Split('.');

        int groupId = Convert.ToInt16(_params[0]);
        int profile = Convert.ToInt16(_params[1]);

        if (profile != 0)
        {
            if (profile > 1)
            {
                username = _params[2];
            }

            string filtro = "%";

            if (_params.Length > 3)
            {
                filtro = SQLHelper.ExecuteDataset(Cache["ApplicationDatabase"].ToString(), "GetEvaluatedByEvaluated", new object[] { _params[3] }).Tables[0].Rows[0].ItemArray[0].ToString();
            }


            SqlDataReader myReader = SQLHelper.ExecuteReader(Cache["ApplicationDatabase"].ToString(), "[GetCompetencies]", new object[] { groupId, username, profile, filtro });


            bool existone = false;

            for (int f = 0; f < myReader.FieldCount; f++)
            {
                fields.Add(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(myReader.GetName(f).Split('_')[0].ToString().Replace('[', ' ').Replace(']', ' ').Trim().ToLower()));
                fieldsValues.Add(myReader.GetName(f).ToString());



                if (f >= 4 && !existone)
                {
                    if (fieldsValues[f].ToString().Split('_')[2].ToLower() == "t")
                    {
                        setColor = true; existone = true;
                    }
                }
            }

            // ********************** 7 linea modificada original
            int indicegrupo = 0;

            while (myReader.Read())
            {
                group = myReader.GetValue(0).ToString();
                if (group != string.Empty && oldGroup != string.Empty && group != oldGroup)
                {
                    numBlock++;
                    AddCompetency(details);
                    Array.Clear(details, 0, details.Length);
                    i = 0;
                }
                object[] values     = new object[myReader.FieldCount];
                int      fieldcount = myReader.GetValues(values);
                details[i] = values;
                i++;
                oldGroup = group;
            }
            numBlock++;
            AddCompetency(details);

            AddCommentBlock("Comentarios");

            myReader.NextResult();

            //Comments
            string[] labels   = new string[] { "Evaluador", "Concurrente", "Doble Reporte", "Jefe RRHH" };
            bool     _enable  = false;
            bool     _visible = false;
            while (myReader.Read())
            {
                AddSeparator();
                Label lbl = new Label();
                lbl.Text = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(myReader.GetValue(1).ToString().Trim().ToLower());
                lbl.Attributes.Add("class", "titulo");
                lbl.Height = 20;
                this.Controls.Add(lbl);
                lbl.Dispose();

                Panel pnlContainer = new Panel();
                pnlContainer.Attributes.Add("class", "tab-pane");

                Literal L = new Literal();
                //L.Text = "<div style = 'position:absolute; left:655px;  top:7px;z-index:1000;'><a href='#t' class='link'>Ir a Competencias</a></div>";
                // ******************** 10 linea modificada del original
                L.Text = "<div style = 'position:absolute; left:655px;  top:-20px;z-index:1000;'><a href='#t' class='link'>Ir a Competencias</a></div>";
                pnlContainer.Controls.Add(L);
                L.Dispose();

                int _tabs = 1;



                // 1 = siempre
                // 2 = > 3,4,5,6,7,8
                // 3 = > 6


                // 1  Pendiente
                // 2  Iniciada
                // 3  Pendiente en Concurrente
                // 4  Aprobada por Concurrente
                // 5  Rechazada por Concurrente
                // 6  Pendiente en Doble Reporte
                // 7  Aprobada por Doble Reporte
                // 8  Rechazada por Doble Reporte
                // 9  Pendiente en RRHH
                // 10 Aprobada por RRHH
                // 11 Rechazada por RRHH
                // 12 Cerrada

                int _status = Convert.ToInt16(myReader[5]);

                switch (profile)
                {
                case 1:
                    if (_status == 4 && !Convert.ToBoolean(myReader[6]))
                    {
                        _tabs = 2;
                        if (_status == 11)
                        {
                            _tabs = 4;
                        }
                    }
                    if (_status == 5 && !Convert.ToBoolean(myReader[6]))
                    {
                        _tabs = 2;
                        if (_status == 11)
                        {
                            _tabs = 4;
                        }
                    }
                    else if (_status == 11)
                    {
                        _tabs = 4;
                    }
                    else if (_status == 12)
                    {
                        _tabs = 4;
                    }
                    else if (_status == 6 && Convert.ToBoolean(myReader[6]))
                    {
                        _tabs = 2;
                    }
                    else if (_status >= 7 && Convert.ToBoolean(myReader[6]))
                    {
                        _tabs = 3;
                    }
                    else if (_status == 9)
                    {
                        _tabs = 2;
                    }
                    if (_status == 10)
                    {
                        _tabs = 4;
                    }
                    break;

                // ******************* 8 lineas agregadas al original
                case 5:
                    _tabs = 4;
                    break;

                default:
                    _tabs = profile;
                    break;
                }

                for (int c = 0; c < _tabs; c++)
                {
                    Panel   pnlPage = new Panel();
                    Literal H       = new Literal();
                    pnlPage.Attributes.Add("class", "tab-page");
                    H.Text = "<h2 class='tab'>" + labels[c] + "</h2>";
                    pnlPage.Controls.Add(H);

                    TextBox txtA = new TextBox();
                    txtA.Rows     = 3;
                    txtA.TextMode = TextBoxMode.MultiLine;
                    //txtA.Text = myReader.GetValue( c + 2 ).ToString( );
                    // ************* 7 linea modificada del original

                    switch (c)
                    {
                    case 0:
                        //if( myReader.GetValue( 7 ).ToString( ) == "A" && indicegrupo == 1 )
                        //    txtA.Text = myReader.GetValue( c + 2 ).ToString( );
                        //if( indicegrupo == 0 )
                        txtA.Text = myReader.GetValue(c + 2).ToString();
                        break;

                    case 1:
                        if (myReader.GetValue(7).ToString() == "A")
                        {
                            txtA.Text = myReader.GetValue(c + 2).ToString();
                        }
                        if (indicegrupo == 0)
                        {
                            txtA.Text = myReader.GetValue(c + 2).ToString();
                        }
                        if (txtA.Text == string.Empty)
                        {
                            txtA.Text = "En caso de elegir esta opción no olvide que es obligatorio completar el comentario ...........";
                        }
                        break;

                    case 2:
                        if (myReader.GetValue(8).ToString() == "A")
                        {
                            txtA.Text = myReader.GetValue(c + 2).ToString();
                        }
                        if (indicegrupo == 0)
                        {
                            txtA.Text = myReader.GetValue(c + 2).ToString();
                        }
                        if (txtA.Text == string.Empty)
                        {
                            txtA.Text = "En caso de elegir esta opción no olvide que es obligatorio completar el comentario ...........";
                        }
                        break;

                    case 3:
                        if (myReader.GetValue(10).ToString() == "A")
                        {
                            txtA.Text = myReader.GetValue(c + 6).ToString();
                        }
                        else
                        {
                            txtA.Text = string.Empty;
                        }
                        if (txtA.Text == string.Empty)
                        {
                            txtA.Text = "En caso de elegir esta opción no olvide que es obligatorio completar el comentario ...........";
                        }
                        break;
                    }

                    txtA.Attributes["class"]   = "tM";
                    txtA.Attributes["onBlur"]  = "o(this)";
                    txtA.Attributes["onFocus"] = "_i(this)";
                    txtA.Attributes["onkeyup"] = "kIP(this)";

                    txtA.SkinID = myReader.GetValue(0).ToString() + "_" + c.ToString();
                    HttpResponse   myHttpReponse    = Response;
                    HtmlTextWriter myHtmlTextWriter = new HtmlTextWriter(myHttpReponse.Output);
                    txtA.Attributes.AddAttributes(myHtmlTextWriter);

                    RadioButton radioA = new RadioButton();
                    radioA.Text = "Aprobar";
                    //radioA.GroupName = "AR";
                    // **************** 7 linea modificada original
                    radioA.GroupName             = "AR" + indicegrupo.ToString();
                    radioA.Attributes["onClick"] = "_a(this)";

                    // *************** agregado del original
                    switch (c)
                    {
                    case 0:
                        if (myReader.GetValue(7).ToString() == "A")
                        {
                            radioA.Checked = true;
                        }
                        break;

                    case 1:
                        if (myReader.GetValue(7).ToString() == "A")
                        {
                            radioA.Checked = true;
                        }
                        break;

                    case 2:
                        if (myReader.GetValue(8).ToString() == "A")
                        {
                            radioA.Checked = true;
                        }
                        break;

                    case 3:
                        if (myReader.GetValue(10).ToString() == "A")
                        {
                            radioA.Checked = true;
                        }
                        break;
                    }
                    RadioButton radioR = new RadioButton();
                    radioR.Text = "Rechazar";
                    //radioR.GroupName = "AR";
                    // **************** 7 linea modificada original
                    radioR.GroupName = "AR" + indicegrupo.ToString();

                    radioR.Attributes["onClick"] = "_r(this)";
                    // *************** agregado del original
                    switch (c)
                    {
                    case 0:
                        if (myReader.GetValue(7).ToString() == "R")
                        {
                            radioR.Checked = true;
                        }
                        break;

                    case 1:
                        if (myReader.GetValue(7).ToString() == "R")
                        {
                            radioR.Checked = true;
                        }
                        break;

                    case 2:
                        if (myReader.GetValue(8).ToString() == "R")
                        {
                            radioR.Checked = true;
                        }
                        break;

                    case 3:
                        if (myReader.GetValue(10).ToString() == "R")
                        {
                            radioR.Checked = true;
                        }
                        break;
                    }

                    TextBox txtR = new TextBox();

                    // 3  Pendiente en Concurrente
                    // 4  Aprobada por Concurrente
                    // 5  Rechazada por Concurrente
                    // 6  Pendiente en Doble Reporte
                    // 7  Aprobada por Doble Reporte
                    // 8  Rechazada por Doble Reporte
                    // 9  Pendiente en RRHH
                    // 10 Aprobada por RRHH
                    // 11 Rechazada por RRHH
                    // 12 Cerrada

                    switch (profile)
                    {
                    case 1:
                        switch (c)
                        {
                        case 0:
                            radioA.Visible = false;
                            txtA.Visible   = true;
                            radioR.Visible = false;
                            break;

                        case 1:
                            switch (_status)
                            {
                            case 5:
                                radioA.Visible = false;
                                txtA.Visible   = false;
                                radioR.Visible = true;
                                txtR.Visible   = true;
                                break;

                            case 6:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                radioR.Visible = false;
                                txtR.Visible   = false;
                                break;

                            case 8:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                radioR.Visible = false;
                                txtR.Visible   = false;
                                break;

                            case 9:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                radioR.Visible = false;
                                txtR.Visible   = false;
                                break;

                            case 10:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                radioR.Visible = false;
                                txtR.Visible   = false;
                                break;

                            case 11:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                txtR.Visible   = false;
                                radioR.Visible = false;
                                break;

                            case 12:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                radioR.Visible = false;
                                txtR.Visible   = false;
                                break;
                            }
                            break;

                        case 2:
                            switch (_status)
                            {
                            case 5:
                                radioA.Visible = false;
                                txtA.Visible   = false;
                                radioR.Visible = false;
                                txtR.Visible   = true;
                                break;

                            case 8:
                                radioA.Visible = false;
                                txtA.Visible   = false;
                                radioR.Visible = false;
                                txtR.Visible   = true;
                                break;

                            case 9:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                radioR.Visible = false;
                                txtR.Visible   = false;
                                break;

                            case 10:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                radioR.Visible = false;
                                txtR.Visible   = false;
                                break;

                            case 11:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                txtR.Visible   = false;
                                radioR.Visible = false;
                                break;

                            case 12:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                radioR.Visible = false;
                                txtR.Visible   = false;
                                break;
                            }
                            break;

                        case 3:
                            switch (_status)
                            {
                            case 5:
                                radioA.Visible = false;
                                txtA.Visible   = false;
                                radioR.Visible = false;
                                txtR.Visible   = true;
                                break;

                            case 8:
                                radioA.Visible = false;
                                txtA.Visible   = false;
                                radioR.Visible = false;
                                txtR.Visible   = true;
                                break;

                            case 9:
                                radioA.Visible = true;
                                txtA.Visible   = true;
                                radioR.Visible = true;
                                txtR.Visible   = true;
                                break;

                            case 10:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                radioR.Visible = false;
                                txtR.Visible   = false;
                                break;

                            case 11:
                                radioA.Visible = false;
                                txtA.Visible   = false;
                                txtR.Visible   = true;
                                radioR.Visible = false;
                                break;

                            case 12:
                                radioA.Visible = false;
                                txtA.Visible   = true;
                                radioR.Visible = false;
                                txtR.Visible   = false;
                                break;
                            }
                            break;
                        }
                        txtA.ReadOnly = !(("1.2.5.8.11".IndexOf(_status.ToString()) >= 0) && (c == 0));
                        txtR.ReadOnly = !(("1.2.5.8.11".IndexOf(_status.ToString()) >= 0) && (c == 0));

                        break;

                    case 2:
                        // *************** 6 modificado del original
                        //radioA.Visible = (c >= 1);
                        //txtA.ReadOnly = ((_status == 3) && (c == 1));
                        //radioR.Visible = (c >= 1);
                        //txtR.ReadOnly = ((_status == 3) && (c == 1));
                        //break;
                        radioA.Visible = (c >= 1);
                        txtA.ReadOnly  = (c == 0);    // || ( c != 0 && txtA.Text == string.Empty );
                        radioR.Visible = (c >= 1);
                        txtR.ReadOnly  = (c == 0);    // || ( c != 0 && txtR.Text == string.Empty );
                        break;

                    case 3:
                        _visible = (c >= 1);
                        _enable  = (_status == 6) && (c == 2);
                        switch (c)
                        {
                        case 0:
                            radioA.Visible = false;
                            txtA.Visible   = true;
                            radioR.Visible = false;
                            txtA.ReadOnly  = true;
                            txtR.ReadOnly  = true;
                            break;

                        case 1:
                            radioA.Visible = !("8.9.6".IndexOf(_status.ToString()) >= 0);
                            txtA.Visible   = !("8.11".IndexOf(_status.ToString()) >= 0);
                            radioR.Visible = !("8.9.6".IndexOf(_status.ToString()) >= 0);
                            txtR.Visible   = ("8.11".IndexOf(_status.ToString()) >= 0);
                            txtA.ReadOnly  = true;
                            txtR.ReadOnly  = true;
                            break;

                        case 2:
                            radioA.Visible = !("8.9.11".IndexOf(_status.ToString()) >= 0);
                            txtA.Visible   = !("8.9".IndexOf(_status.ToString()) >= 0);
                            radioR.Visible = !("8.9.11".IndexOf(_status.ToString()) >= 0);
                            txtR.Visible   = ("8.9.6".IndexOf(_status.ToString()) >= 0);
                            txtA.ReadOnly  = false;
                            txtR.ReadOnly  = false;
                            break;

                        case 3:
                            radioA.Visible = true;
                            radioR.Visible = true;
                            break;
                        }
                        //radioA.Enabled = ( c == 3 );
                        //txtA.ReadOnly = ( c < 3 ) || ( c != 0 && c != 3 && txtA.Text == string.Empty );
                        //radioR.Enabled = ( c == 3 );
                        //txtR.ReadOnly = ( c < 3 ) || ( c != 0 && c != 3 && txtR.Text == string.Empty );
                        break;

                    // *************** 11 lineas agregadas al original
                    case 5:
                        switch (c)
                        {
                        case 0:
                            radioA.Visible = false;
                            txtA.Visible   = true;
                            radioR.Visible = false;
                            break;

                        case 1:
                            radioA.Visible = !("8.9".IndexOf(_status.ToString()) >= 0);
                            txtA.Visible   = !("8.11".IndexOf(_status.ToString()) >= 0);
                            radioR.Visible = !("8.9".IndexOf(_status.ToString()) >= 0);
                            txtR.Visible   = ("8.11".IndexOf(_status.ToString()) >= 0);
                            break;

                        case 2:
                            radioA.Visible = !("8.9.11".IndexOf(_status.ToString()) >= 0);
                            txtA.Visible   = !("8".IndexOf(_status.ToString()) >= 0);
                            radioR.Visible = !("8.9.11".IndexOf(_status.ToString()) >= 0);
                            txtR.Visible   = ("8".IndexOf(_status.ToString()) >= 0);
                            break;

                        case 3:
                            radioA.Visible = true;
                            radioR.Visible = true;
                            break;
                        }
                        //radioA.Enabled = ( c == 3 );
                        txtA.ReadOnly = (c < 3) || (c != 0 && c != 3 && txtA.Text == string.Empty);
                        //radioR.Enabled = ( c == 3 );
                        txtR.ReadOnly = (c < 3) || (c != 0 && c != 3 && txtR.Text == string.Empty);
                        break;

                    default:
                        _visible = true;
                        _enable  = false;
                        break;
                    }


                    //tab 1

                    //txtA.ReadOnly = (!radioA.Checked || txtA.ReadOnly);

                    pnlPage.Controls.Add(radioA);
                    pnlPage.Controls.Add(txtA);
                    pnlPage.Controls.Add(new LiteralControl("<br />"));

                    if (c >= 1)
                    {
                        txtR.Rows     = 3;
                        txtR.TextMode = TextBoxMode.MultiLine;
                        //txtR.Text = myReader.GetValue(c + 2).ToString();
                        // ******************* agregado del original
                        switch (c)
                        {
                        case 0:
                            if (myReader.GetValue(7).ToString() == "R")
                            {
                                txtR.Text = myReader.GetValue(c + 2).ToString();
                            }
                            else
                            {
                                txtR.Text = string.Empty;
                            }
                            if (txtR.Text == string.Empty)
                            {
                                txtR.Text = "En caso de elegir esta opción no olvide que es obligatorio completar el comentario ...........";
                            }
                            break;

                        case 1:
                            if (myReader.GetValue(7).ToString() == "R")
                            {
                                txtR.Text = myReader.GetValue(c + 2).ToString();
                            }
                            else
                            {
                                txtR.Text = string.Empty;
                            }
                            if (txtR.Text == string.Empty)
                            {
                                txtR.Text = "En caso de elegir esta opción no olvide que es obligatorio completar el comentario ...........";
                            }
                            break;

                        case 2:
                            if (myReader.GetValue(8).ToString() == "R")
                            {
                                txtR.Text = myReader.GetValue(c + 2).ToString();
                            }
                            else
                            {
                                txtR.Text = string.Empty;
                            }
                            if (txtR.Text == string.Empty)
                            {
                                txtR.Text = "En caso de elegir esta opción no olvide que es obligatorio completar el comentario ...........";
                            }
                            break;

                        case 3:
                            if (myReader.GetValue(10).ToString() == "R")
                            {
                                txtR.Text = myReader.GetValue(c + 6).ToString();
                            }
                            else
                            {
                                txtR.Text = string.Empty;
                            }
                            if (txtR.Text == string.Empty)
                            {
                                txtR.Text = "En caso de elegir esta opción no olvide que es obligatorio completar el comentario ...........";
                            }
                            break;
                        }

                        txtR.Attributes["class"]   = "tM";
                        txtR.Attributes["onBlur"]  = "o(this)";
                        txtR.Attributes["onFocus"] = "_i(this)";
                        txtR.Attributes["onkeyup"] = "kIP(this)";

                        txtR.SkinID = myReader.GetValue(0).ToString() + "_" + c.ToString();
                        HttpResponse   myHttpReponseR    = Response;
                        HtmlTextWriter myHtmlTextWriterR = new HtmlTextWriter(myHttpReponseR.Output);
                        txtR.Attributes.AddAttributes(myHtmlTextWriterR);

                        //txtR.ReadOnly = (!radioR.Checked || txtR.ReadOnly);

                        pnlPage.Controls.Add(radioR);
                        pnlPage.Controls.Add(txtR);
                    }

                    pnlContainer.Controls.Add(pnlPage);
                    if (c >= 1)
                    {
                        if (!radioA.Checked && !radioR.Checked)
                        {
                            radioA.Checked = true;
                        }
                        if (!radioA.Checked)
                        {
                            txtA.Attributes.Add("readonly", "readonly");
                        }
                        if (!radioR.Checked)
                        {
                            txtR.Attributes.Add("readonly", "readonly");
                        }
                    }

                    txtA.Dispose();
                    txtR.Dispose();
                    radioA.Dispose();
                    radioR.Dispose();
                    H.Dispose();
                    pnlPage.Dispose();
                    pnlContainer.Dispose();


                    // ************* 7 linea agregada al original
                    indicegrupo++;
                }
                this.Controls.Add(pnlContainer);
            }
            myReader.Close();
        }
    }