• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 124,  comments - 29,  trackbacks - 0
            1: 加GridLevelNode時注意加的位置!!!   不能一味的往頂層節點上加!
             2:一定要把新建的 view放到 viewCollection里面. this.gridControlUserTable.ViewCollection.Add(newGridView)
            3:新建的關系名一定要和新建的level保持一致!!!!
            4:注意GridView的更新(父GridView的更新)
              private void gridControlUserTable_DoubleClick(object sender, EventArgs e)
                    {
                        try
                        {
                            //gridView  datatable  GridLevelNode都用同一個名字
                            //ViewCaption中放類別, 1, 用戶相關表.  0, 用戶無關表
                            GridView curView = (DevExpress.XtraGrid.Views.Grid.GridView)gridControlUserTable.FocusedView; //當前的GridView
                            curView.MasterRowExpanding += new MasterRowCanExpandEventHandler(curView_MasterRowExpanding);
                            curView.MasterRowExpanded += new CustomMasterRowEventHandler(curView_MasterRowExpanded);


                            string viewName = curView.Name;
                            string id = "view" + icount.ToString();
                            int ihandle = curView.FocusedRowHandle; //當前的行號
                            DataRow dr = curView.GetDataRow(ihandle); //當前的行


                            GridView newGridView = null;
                            DataTable newDataTable = null;
                            DevExpress.XtraGrid.GridLevelNode gridLevel = null;
                            icount++;
                            #region 頂層的gridView
                            if (curView.Name == "gridViewParent")//頂層的gridView
                            {
                                string tableEName = dr["tableEName"].ToString();
                                string supplierRelated = dr["supplierRelated"].ToString();

                                #region 頂層
                                newGridView = new GridView();
                                newGridView.Name = id;
                                newGridView.OptionsView.ShowGroupPanel = false;
                                newGridView.OptionsBehavior.Editable = false;
                                newGridView.OptionsDetail.ShowDetailTabs = false;
                                newGridView.OptionsCustomization.AllowColumnMoving = false;
                                newGridView.OptionsBehavior.AutoExpandAllGroups = true;
                                this.gridControlUserTable.ViewCollection.Add(newGridView);

                                RelatedTableRecord[] relatedTableInfoArray = null;
                                UnrelatedTableRecord[] unRelatedTableInfoArray = null;
                                if (supplierRelated == "1")//廠商相關
                                {

                                    relatedTableInfoArray = PublicFunction.GetRelatedTableInfos(tableEName, btime, etime);
                                    if (relatedTableInfoArray == null || relatedTableInfoArray.Length == 0)
                                    {
                                        return;
                                    }
                                    CollectCommon.SetGridViewColumn(newGridView, "Config\\CollectMonitor\\supplierRelatedColumn.xml", "/Head");
                                    newGridView.ViewCaption = "1";
                                }
                                else if (supplierRelated == "0")//廠商無關
                                {

                                    unRelatedTableInfoArray = PublicFunction.GetUnRelatedTableInfos(tableEName, "", btime, etime);
                                    if (unRelatedTableInfoArray == null || unRelatedTableInfoArray.Length == 0)
                                    {
                                        return;
                                    }
                                    CollectCommon.SetGridViewColumn(newGridView, "Config\\CollectMonitor\\supplierUnRelatedColumn.xml", "/Head");
                                    newGridView.ViewCaption = "0";
                                }

                                newDataTable = new DataTable(id);
                                CollectCommon.SetDataTableColumn(newGridView, newDataTable);
                                if (supplierRelated == "1")//廠商相關
                                {
                                    CollectCommon.FillTableData(newDataTable, relatedTableInfoArray);
                                }
                                else//廠商無關
                                {
                                    CollectCommon.FillTableData(newDataTable, unRelatedTableInfoArray);
                                }
                                ds.Tables.Add(newDataTable);

                                gridLevel = new DevExpress.XtraGrid.GridLevelNode();
                                gridLevel.LevelTemplate = newGridView;
                                gridLevel.RelationName = id;

                                gridControlUserTable.LevelTree.Nodes.Add(gridLevel);

                                DataRelation dataRelation = new DataRelation(id, ds.Tables["parent"].Columns["tableEName"], ds.Tables[id].Columns["tableEName"], false);
                                ds.Relations.Add(dataRelation);

                                newGridView.RefreshData();
                                gridViewParent.RefreshData();

                                #endregion
                            }
                            #endregion
                            #region 非頂層表
                            else//非頂層表
                            {
                                if (curView.ViewCaption == "1")//廠商相關表,再鉆取最后一層,廠商無關的信息表,就鉆取到頭了.
                                {
                                    #region
                                    string tableEName = dr["tableEName"].ToString();
                                    string supplier = dr["supplier"].ToString();
                                    UnrelatedTableRecord[] unRelatedTableInfoArray = null;
                                    unRelatedTableInfoArray = PublicFunction.GetUnRelatedTableInfos(tableEName, supplier, btime, etime);
                                    if (unRelatedTableInfoArray == null || unRelatedTableInfoArray.Length == 0)
                                    {
                                        return;
                                    }
                                    newGridView = new GridView();
                                    newGridView.Name = id;
                                    newGridView.OptionsView.ShowGroupPanel = false;
                                    newGridView.OptionsBehavior.Editable = false;
                                    newGridView.OptionsDetail.ShowDetailTabs = false;
                                    newGridView.OptionsCustomization.AllowColumnMoving = false;
                                    newGridView.OptionsBehavior.AutoExpandAllGroups = true;
                                    newGridView.ViewCaption = "0";
                                    this.gridControlUserTable.ViewCollection.Add(newGridView);

                                    CollectCommon.SetGridViewColumn(newGridView, "Config\\CollectMonitor\\supplierUnRelatedColumn.xml", "/Head");

                                    newDataTable = new DataTable(id);
                                    CollectCommon.SetDataTableColumn(newGridView, newDataTable);
                                    CollectCommon.FillTableData(newDataTable, unRelatedTableInfoArray);

                                    ds.Tables.Add(newDataTable);

                                    gridLevel = new DevExpress.XtraGrid.GridLevelNode();
                                    gridLevel.LevelTemplate = newGridView;
                                    gridLevel.RelationName = id;

                                    string parentTableName = curView.Name;
                                    string parentLevelName = curView.Name;

                                    //AddGridLevelNode(gridControlUserTable, parentLevelName, gridLevel);
                                    
                                    gridControlUserTable.LevelTree.Nodes[0].Nodes.Add(gridLevel);

                                    DataColumn[] parentColumns = new DataColumn[2];
                                    DataColumn[] childColumns = new DataColumn[2];
                                    parentColumns[0] = ds.Tables[parentTableName].Columns["tableEName"];
                                    parentColumns[1] = ds.Tables[parentTableName].Columns["supplier"];


                                    childColumns[0] = ds.Tables[id].Columns["tableEName"];
                                    childColumns[1] = ds.Tables[id].Columns["supplier"];

                                    DataRelation dataRelation = new DataRelation(id, parentColumns, childColumns, false);
                                    //DataRelation dataRelation = new DataRelation(id, parentColumns[0], childColumns[0], false);
                                    ds.Relations.Add(dataRelation);
                                    curView.RefreshData();
                                    
                                    #endregion
                                }
                                else if (curView.ViewCaption == "0")//廠商無關表
                                {

                                }
                            }
                            #endregion
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message + ex.StackTrace);
                        }
                    }
            posted on 2010-04-17 18:04 天書 閱讀(4382) 評論(0)  編輯 收藏 引用

            <2010年4月>
            28293031123
            45678910
            11121314151617
            18192021222324
            2526272829301
            2345678

            常用鏈接

            留言簿(5)

            隨筆檔案

            文章分類

            文章檔案

            好友的Bolg

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久AV高潮AV无码AV| 99久久国语露脸精品国产| 久久综合九色综合97_久久久| 日本久久久久久中文字幕| 久久亚洲国产精品五月天婷| 伊人色综合久久天天人手人婷| 狠狠综合久久AV一区二区三区| 久久99热狠狠色精品一区| 亚洲国产高清精品线久久| av无码久久久久久不卡网站| 日韩十八禁一区二区久久| 精品久久久久香蕉网| 思思久久精品在热线热| 热re99久久精品国产99热| 久久国产亚洲高清观看| 欧美久久久久久午夜精品| 亚洲国产精久久久久久久| 久久久久亚洲精品天堂| 久久精品一区二区三区AV| 99久久国产综合精品网成人影院| 亚洲欧美成人综合久久久| 久久精品免费一区二区| 欧美伊人久久大香线蕉综合69| 91亚洲国产成人久久精品| 91精品国产9l久久久久| 久久AV高清无码| 久久狠狠高潮亚洲精品| 精品久久久久久无码专区| 日韩精品久久无码人妻中文字幕| 人妻无码精品久久亚瑟影视| 超级碰碰碰碰97久久久久| 亚洲第一永久AV网站久久精品男人的天堂AV | 亚洲国产精品综合久久一线| 久久国产精品二国产精品| 久久久精品久久久久久| 国产精品久久久久久久午夜片| 91亚洲国产成人久久精品| 久久人妻少妇嫩草AV无码蜜桃| 国产精品99久久不卡| 久久久久女教师免费一区| 欧美久久久久久精选9999|