• <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 天書 閱讀(4355) 評論(0)  編輯 收藏 引用

            <2009年2月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            1234567

            常用鏈接

            留言簿(5)

            隨筆檔案

            文章分類

            文章檔案

            好友的Bolg

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久综合久久综合久久| 人妻无码αv中文字幕久久琪琪布| 亚洲精品无码久久久影院相关影片| 99精品国产99久久久久久97| 久久无码人妻一区二区三区午夜| 国内精品久久久久久99| 久久福利青草精品资源站免费| 精品国产91久久久久久久a| 久久夜色精品国产噜噜亚洲a| 久久午夜伦鲁片免费无码| 亚洲欧美日韩精品久久| 久久国产亚洲精品| yellow中文字幕久久网| 97精品伊人久久大香线蕉| 久久精品一区二区国产| 国内精品人妻无码久久久影院导航| 99久久99久久久精品齐齐| 久久天天日天天操综合伊人av| 久久99国产精品尤物| 亚洲国产日韩欧美久久| AA级片免费看视频久久| 国产精品久久波多野结衣| 色综合久久久久综合99| 国产一区二区精品久久岳| 国产精品久久久久影视不卡| 亚洲综合日韩久久成人AV| 看全色黄大色大片免费久久久 | 久久久无码精品亚洲日韩蜜臀浪潮| 久久香蕉综合色一综合色88| 久久精品天天中文字幕人妻| 亚洲精品乱码久久久久66| 亚洲精品无码久久毛片| 久久天天躁狠狠躁夜夜av浪潮 | 日本WV一本一道久久香蕉| 久久91精品综合国产首页| 99久久国产热无码精品免费久久久久| 麻豆亚洲AV永久无码精品久久| 性做久久久久久久| jizzjizz国产精品久久| 久久免费视频网站| 久久久久黑人强伦姧人妻|