• <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

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品亚洲男人的天堂| 亚洲欧美另类日本久久国产真实乱对白 | 亚洲国产精品嫩草影院久久 | 久久99国产精品二区不卡| 久久精品草草草| 2021国产成人精品久久| 久久久久99这里有精品10 | 青青青国产精品国产精品久久久久 | 久久综合九色欧美综合狠狠 | 国产成人精品白浆久久69 | 久久影院午夜理论片无码| 久久精品国产亚洲7777| 久久久受www免费人成| 亚洲精品乱码久久久久久不卡| 亚洲va久久久久| 久久亚洲私人国产精品vA| 久久精品国产一区二区三区不卡| 久久综合九色欧美综合狠狠| 色综合久久夜色精品国产| 国产A级毛片久久久精品毛片| 91久久国产视频| 久久国产视屏| 日韩乱码人妻无码中文字幕久久| 99久久精品日本一区二区免费| 久久er国产精品免费观看8| 亚洲精品乱码久久久久久蜜桃不卡 | 成人a毛片久久免费播放| 久久亚洲精品人成综合网| 色综合久久中文色婷婷| 一级a性色生活片久久无少妇一级婬片免费放 | 国产99久久久国产精品小说| 久久久久国色AV免费观看| 国内精品久久久久久久久电影网| 狠色狠色狠狠色综合久久| 精品久久久久久久国产潘金莲| 久久国产高潮流白浆免费观看| 亚洲精品无码成人片久久| 久久WWW免费人成—看片| 人妻少妇久久中文字幕一区二区| 久久国产免费| 亚洲天堂久久精品|