Exemplo n.º 1
0
        protected void LinkButton5_Click(object sender, EventArgs e)
        {
            //-----------------ver panel editar------------------
            bool si = false;

            foreach (GridViewRow row in GridView6.Rows)
            {
                CheckBox chk_Seleccionar = (CheckBox)row.FindControl("check");
                if (chk_Seleccionar.Checked)
                {
                    si = true;
                }
            }
            if (si == true)
            {
                Tree2.ExpandAll();
                Peditar.Width  = 478;
                Peditar.Height = 390;
                string dia1 = "", habi = "", hi = "", hf = "";
                foreach (GridViewRow row in GridView6.Rows)
                {
                    CheckBox    chk_Seleccionar  = (CheckBox)row.FindControl("check");
                    HiddenField hd_Seleccionafol = (HiddenField)row.FindControl("checkFol");
                    if (chk_Seleccionar.Checked)
                    {
                        idres = hd_Seleccionafol.Value;
                        BD.Conectar();
                        BD.CrearComando("select * from grupos where idGrupo=@id");
                        BD.AsignarParametroCadena("@id", idres);
                        DbDataReader DR = BD.EjecutarConsulta();
                        if (DR.Read())
                        {
                            TeditNom.Text = DR[1].ToString();
                            TeditDes.Text = DR[3].ToString();
                            if (DR[2].ToString() == "si")
                            {
                                Checedit.Checked = true;
                            }
                            else
                            {
                                Checedit.Checked = false;
                            }

                            foreach (TreeNode nod in Tree2.Nodes)
                            {
                                foreach (TreeNode nod2 in nod.ChildNodes)
                                {
                                    if (!(DR[4].ToString().IndexOf(nod2.Value) < 0))
                                    {
                                        nod2.Checked = true;
                                    }
                                    //if (!(DR[4].ToString().IndexOf("CompFis") < 0) || !(DR[4].ToString().IndexOf("Interfaz") < 0) || !(DR[4].ToString().IndexOf("AdmUsuarios") < 0)
                                    //    || !(DR[4].ToString().IndexOf("AdmProveedores") < 0) || !(DR[4].ToString().IndexOf("AdmReceptores") < 0)
                                    //    || !(DR[4].ToString().IndexOf("AdmConfiguracion") < 0))
                                    //{
                                    //    nod2.Selected = true;
                                    //}

                                    foreach (TreeNode nod3 in nod2.ChildNodes)
                                    {
                                        if (!(DR[4].ToString().IndexOf(nod3.Value) < 0))
                                        {
                                            nod3.Checked = true;
                                        }
                                        //if (!(DR[4].ToString().IndexOf("GrupUs") < 0) || !(DR[4].ToString().IndexOf("SolicReg") < 0 )
                                        //    || !(DR[4].ToString().IndexOf("CodigosIVA") < 0 ) || !(DR[4].ToString().IndexOf("Dias") < 0 )
                                        //    || !(DR[4].ToString().IndexOf("Monedas") < 0 ) || !(DR[4].ToString().IndexOf("TipoProv") < 0 ))
                                        //{
                                        //    nod3.Selected = true;
                                        //}
                                        foreach (TreeNode nod4 in nod3.ChildNodes)
                                        {
                                            if (!(DR[4].ToString().IndexOf(nod4.Value) < 0))
                                            {
                                                nod4.Checked = true;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        BD.Desconectar();
                        Peditar.Visible = true;
                    }
                }
            }
            else
            {
                Session["estNot"]  = false;
                Session["msjNoti"] = "DEBES SELECIONAR UN GRUPO";
                Session["estPan"]  = true;
            }
        }