Пример #1
0
        /// <summary>
        /// 根据树节点获取或设置Group,Pnl的显示或隐藏(暂时这样写,没想到封装的方法 ),通过控件的Name属性来控制是否显示
        /// </summary>
        /// <param name="ColName">查询表结构指定的列名</param>
        /// <param name="Tag">指定列的值</param>
        /// <param name="Ctl">控件容器</param>
        /// <param name="dt">查询用到的表</param>
        private void SetGroupVisble(DevExpress.XtraEditors.XtraPanel Pnl, DataTable dt)
        {
            switch (dt.TableName)
            {
            case "门禁分组":
                foreach (Control cl in Pnl.Controls)
                {
                    if (cl.Name == "GroupBaseInfo" || cl.Name == "GroupDoorGroupInfo" || cl.Name == "GroupExtendInfo" ||
                        cl.Name == "panelEffTask" || cl.Name == "grpTimeTask")
                    {
                        cl.Visible = true;
                    }
                    else
                    {
                        cl.Visible = false;
                    }
                }
                break;

            case "门禁":
                foreach (Control cl in Pnl.Controls)
                {
                    if (cl.Name == "GroupControlParm")
                    {
                        cl.Visible = true;
                    }
                    else
                    {
                        cl.Visible = false;
                    }
                }
                break;

            case "门":
                foreach (Control cl in Pnl.Controls)
                {
                    if (cl.Name == "GroupDoorInfo")
                    {
                        cl.Visible = true;
                    }
                    else
                    {
                        cl.Visible = false;
                    }
                }
                break;

            default:
                break;
            }
        }
Пример #2
0
        /// <summary>
        /// 点击树节点时触发
        /// </summary>
        /// <param name="tag">树的Tag值</param>
        private void GetExpend(string tag)
        {
            if (this.ds.Tables["扩展板参数"].Select("分组id='" + tag + "'").Length == 0)
            {
                for (int i = 0; i < 4; i++)
                {
                    DataRow dr = this.ds.Tables["扩展板参数"].NewRow();
                    dr["id"]   = Guid.NewGuid().ToString();
                    dr["分组id"] = tag;
                    this.ds.Tables["扩展板参数"].Rows.Add(dr);
                }
            }

            //只有两层不需要用递归
            int index = -1;

            DataRow[] drpnl = this.ds.Tables["扩展板参数"].Select("分组id='" + tag + "'", "id desc");
            foreach (Control c in xtraTabExtendPara.TabPages)
            {
                index++;
                foreach (Control cp in c.Controls)
                {
                    DevExpress.XtraEditors.XtraPanel Pnl = cp as XtraPanel;
                    Pnl.Tag = drpnl[index]["id"].ToString();
                }
            }

            if (this.ds.Tables["扩展板参数"].Select("分组id='" + tag + "'").Length == 0)
            {
                BandCheck(this.xtraTabExtendPara);
            }
            else
            {
                foreach (DataRow dr in this.ds.Tables["扩展板参数"].Select("分组id='" + tag + "'", " id desc"))
                {
                    BandCheck(this.xtraTabExtendPara);
                }
            }
        }