Example #1
0
        private void BuildTreeList()
        {
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            //System.IO.StringReader sr = new System.IO.StringReader(FrameworkParams.Report);
            System.IO.StringReader sr = new System.IO.StringReader(this.ReportXMLStr);
            doc.Load(sr);

            this.treeList1.Nodes.Clear();

            foreach (System.Xml.XmlNode gnode in doc.DocumentElement.ChildNodes)
            {
                DevExpress.XtraTreeList.Nodes.TreeListNode tnode = this.treeList1.AppendNode(null, -1);

                tnode.SetValue(0, gnode.Attributes["vn"].Value);
                ////Tiếng Anh
                //tnode.SetValue(0, gnode.Attributes["en"].Value);

                //them info vao node cha
                //HUNG
                ReportInfo ginfo = new ReportInfo();
                ginfo.ID = gnode.Attributes["id"].Value;
                tnode.Tag = ginfo;
                //----

                //TODO : PHUOC
                foreach (System.Xml.XmlNode inode in gnode.ChildNodes)
                {
                    BaoBieu report = null;
                    try
                    {
                        //if (!DAReport.Instance.IsPublicReport(inode.Attributes["filtercontrol"].Value.Trim(),
                        //    FrameworkParams.currentUser.username))
                        //{
                        //    report = BaoBieu.loadReport2(inode.Attributes["filtercontrol"].Value.Trim(), FrameworkParams.currentUser.username);
                        //}

                        //Kiem tra phan quyen report
                        if (User.isAdmin() == false&& FrameworkParams.isPermision != null)
                        {
                            //Kiem tra public report
                            if (inode.Attributes["en"].Value.Trim().Equals("PUBLIC") == false)
                            {
                                report = BaoBieu.loadReport2(inode.Attributes["filtercontrol"].Value.Trim(), FrameworkParams.currentUser.username);
                                //Kiểm tra quyền chỉ đọc trên báo cáo
                                if (report != null)
                                {
                                    if (report.id == -1 || report.isRead == false)
                                    {
                                        continue;
                                    }
                                }
                                else
                                {
                                    continue;
                                }
                            }
                        }
                    }
                    catch
                    {
                        frmDangXayDung.Show(this);
                        if (FrameworkParams.wait != null) { FrameworkParams.wait.Finish(); }
                    }

                    ReportInfo info = new ReportInfo();
                    info.ID = inode.Attributes["id"].Value;
                    info.Caption = inode.Attributes["caption"].Value;
                    info.FilterControl = inode.Attributes["filtercontrol"].Value;
                    info.ReportFile = inode.Attributes["reportfile"].Value;

                    DevExpress.XtraTreeList.Nodes.TreeListNode ttnode = this.treeList1.AppendNode(null, tnode);

                    ttnode.SetValue(0, inode.Attributes["vn"].Value);
                    ////Tiếng Anh
                    //ttnode.SetValue(0, inode.Attributes["en"].Value);

                    ttnode.Tag = info;
                }
                if (tnode.Nodes.Count == 0)
                {
                   // treeList1.DeleteNode(tnode);
                    tnode.Visible = false;

                }
            }

            this.treeList1.ExpandAll();
        }
Example #2
0
        private XtraUserControl LoadFilterControl(ReportInfo info)
        {
            try
            {
                XtraUserControl ctl = (XtraUserControl)GenerateClass.initObject(info.FilterControl);

                //HUNG, an di neu nhu chua co report
                if (ctl == null)
                {
                    this.splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel1;
                    this.splitContainerControl1.Panel2.Controls.Clear();
                    this.panelControl1.Visible = false;
                    return null;
                }
                UpdateSearchControl(ctl);

                return ctl;

                //this.splitContainerControl1.Panel2.Controls.Clear();
                //this.splitContainerControl1.Panel2.Controls.Add(ctl);
                //this.dockPanel1.Width = ctl.Width + 12;
                //this.splitContainerControl1.SplitterPosition = splitContainerControl1.Height - ctl.Height - 6;

                //this.panelControl1.Visible = true;
                //ProtocolVN.Framework.Win.ProtocolForm.pl_ctrl_wrapper(this, ctl, true);
                //this.xtraTabControl1.SelectedTabPage = this.xtraTabPageIntro;
                //ctl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                //        | System.Windows.Forms.AnchorStyles.Right)));
            }
            catch (Exception ex)
            {
                frmDangXayDung.Show(this);
                PLException.AddException(ex);
                return null;
            }
        }