コード例 #1
0
        /// <summary>
        ///     将条件转成UI
        /// </summary>
        /// <param name="NewDataFilter"></param>
        public void PutQueryToUI(DataFilter NewDataFilter)
        {
            String strErrMsg      = String.Empty;
            var    ShowColumnList = new List <String>();

            foreach (String item in ColumnList)
            {
                ShowColumnList.Add(item);
            }
            //清除所有的控件
            List <DataFilter.QueryFieldItem> FieldList = NewDataFilter.QueryFieldList;

            foreach (DataFilter.QueryFieldItem queryFieldItem in NewDataFilter.QueryFieldList)
            {
                //动态加载控件
                if (!ColumnList.Contains(queryFieldItem.ColName))
                {
                    strErrMsg += "Display Field [" + queryFieldItem.ColName +
                                 "] is not exist in current collection any more" + Environment.NewLine;
                }
                else
                {
                    ShowColumnList.Remove(queryFieldItem.ColName);
                }
            }
            foreach (String item in ShowColumnList)
            {
                strErrMsg += "New Field" + item + "Is Append" + Environment.NewLine;
                //输出配置的初始化
                FieldList.Add(new DataFilter.QueryFieldItem(item));
            }
            Controls.Clear();
            _conditionPos   = new Point(5, 0);
            _conditionCount = 0;
            foreach (DataFilter.QueryConditionInputItem queryConditionItem in NewDataFilter.QueryConditionList)
            {
                var newCondition = new ctlQueryCondition();
                newCondition.Init(ColumnList);
                _conditionPos.Y           += newCondition.Height;
                newCondition.Location      = _conditionPos;
                newCondition.ConditionItem = queryConditionItem;
                _conditionCount++;
                newCondition.Name = "Condition" + _conditionCount;
                Controls.Add(newCondition);

                if (!ColumnList.Contains(queryConditionItem.ColName))
                {
                    strErrMsg += queryConditionItem.ColName +
                                 "Query Condition Field is not exist in collection any more" + Environment.NewLine;
                }
            }

            if (strErrMsg != String.Empty)
            {
                MyMessageBox.ShowMessage("Load Exception", "A Exception is happened when loading", strErrMsg, true);
            }
        }
コード例 #2
0
ファイル: frmQuery.cs プロジェクト: seaman/MagicMongoDBTool
 private void cmdAddCondition_Click(object sender, EventArgs e)
 {
     _conditionCount++;
     ctlQueryCondition newCondition = new ctlQueryCondition();
     _conditionPos.Y += newCondition.Height;
     newCondition.Location = _conditionPos;
     newCondition.Name = "Condition" + _conditionCount.ToString();
     tabFilter.Controls.Add(newCondition);
 }
コード例 #3
0
 /// <summary>
 /// 新增条件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void AddCondition()
 {
     _conditionCount++;
     ctlQueryCondition newCondition = new ctlQueryCondition();
     newCondition.Init(ColumnList);
     _conditionPos.Y += newCondition.Height;
     newCondition.Location = _conditionPos;
     newCondition.Name = "Condition" + _conditionCount.ToString();
     Controls.Add(newCondition);
 }
コード例 #4
0
        /// <summary>
        /// 新增条件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdAddCondition_Click(object sender, EventArgs e)
        {
            _conditionCount++;
            ctlQueryCondition newCondition = new ctlQueryCondition();

            newCondition.Init(ColumnList);
            _conditionPos.Y      += newCondition.Height;
            newCondition.Location = _conditionPos;
            newCondition.Name     = "Condition" + _conditionCount.ToString();
            panFilter.Controls.Add(newCondition);
        }
コード例 #5
0
        /// <summary>
        ///     新增条件
        /// </summary>
        public void AddCondition()
        {
            _conditionCount++;
            var newCondition = new ctlQueryCondition();

            newCondition.Init(ColumnList);
            _conditionPos.Y      += newCondition.Height;
            newCondition.Location = _conditionPos;
            newCondition.Name     = "Condition" + _conditionCount;
            Controls.Add(newCondition);
        }
コード例 #6
0
 /// <summary>
 /// 设置DataFilter
 /// </summary>
 public void SetCurrDataFilter(MongoDBHelper.DataViewInfo CurrentDataViewInfo)
 {
     //过滤条件
     for (int i = 0; i < _conditionCount; i++)
     {
         ctlQueryCondition ctl = (ctlQueryCondition)Controls.Find("Condition" + (i + 1).ToString(), true)[0];
         if (ctl.IsSeted)
         {
             CurrentDataViewInfo.mDataFilter.QueryConditionList.Add(ctl.ConditionItem);
         }
     }
 }
コード例 #7
0
        /// <summary>
        /// 设置DataFilter
        /// </summary>
        private void SetCurrDataFilter()
        {
            //清除以前的结果和内部变量,重要!
            CurrentDataViewInfo.mDataFilter.Clear();
            CurrentDataViewInfo.mDataFilter.DBName         = SystemManager.GetCurrentDataBase().Name;
            CurrentDataViewInfo.mDataFilter.CollectionName = SystemManager.GetCurrentCollection().Name;

            foreach (var item in ColumnList)
            {
                CurrentDataViewInfo.mDataFilter.QueryFieldList.Add(((ctlFieldInfo)Controls.Find(item, true)[0]).QueryFieldItem);
            }
            for (int i = 0; i < _conditionCount; i++)
            {
                ctlQueryCondition ctl = (ctlQueryCondition)Controls.Find("Condition" + (i + 1).ToString(), true)[0];
                if (ctl.IsSeted)
                {
                    CurrentDataViewInfo.mDataFilter.QueryConditionList.Add(ctl.ConditionItem);
                }
            }
        }
コード例 #8
0
        private void PutQueryToUI(DataFilter NewDataFilter)
        {
            String strErrMsg = String.Empty;
            List<String> ShowColumnList = new List<String>();
            foreach (String item in ColumnList)
            {
                ShowColumnList.Add(item);
            }
            //清除所有的控件
            tabFieldInfo.Controls.Clear();
            foreach (DataFilter.QueryFieldItem queryFieldItem in NewDataFilter.QueryFieldList)
            {
                //动态加载控件
                if (!ColumnList.Contains(queryFieldItem.ColName))
                {
                    strErrMsg += queryFieldItem.ColName + "Display Field is not exist in current collection any more" + System.Environment.NewLine;
                }
                else
                {
                    ctlFieldInfo ctrItem = new ctlFieldInfo();
                    ctrItem.Name = queryFieldItem.ColName;
                    ctrItem.Location = _conditionPos;
                    ctrItem.QueryFieldItem = queryFieldItem;
                    tabFieldInfo.Controls.Add(ctrItem);
                    //纵向位置的累加
                    _conditionPos.Y += ctrItem.Height;
                    ShowColumnList.Remove(queryFieldItem.ColName);
                }
            }
            //新增字段
            _conditionPos = new Point(5, 0);
            foreach (String item in ShowColumnList)
            {
                strErrMsg += "New Field" + item + "Is Append" + System.Environment.NewLine;
                //输出配置的初始化
                DataFilter.QueryFieldItem queryFieldItem = new DataFilter.QueryFieldItem();
                queryFieldItem.ColName = item;
                queryFieldItem.IsShow = true;
                queryFieldItem.sortType = DataFilter.SortType.NoSort;
                //动态加载控件
                ctlFieldInfo ctrItem = new ctlFieldInfo();
                ctrItem.Name = item;
                _conditionPos.Y += ctrItem.Height;
                ctrItem.Location = _conditionPos;
                ctrItem.QueryFieldItem = queryFieldItem;
                tabFieldInfo.Controls.Add(ctrItem);
            }

            panFilter.Controls.Clear();
            _conditionPos = new Point(5, 0);
            _conditionCount = 0;
            foreach (DataFilter.QueryConditionInputItem queryConditionItem in NewDataFilter.QueryConditionList)
            {
                ctlQueryCondition newCondition = new ctlQueryCondition();
                newCondition.Init(ColumnList);
                _conditionPos.Y += newCondition.Height;
                newCondition.Location = _conditionPos;
                newCondition.ConditionItem = queryConditionItem;
                _conditionCount++;
                newCondition.Name = "Condition" + _conditionCount.ToString();
                panFilter.Controls.Add(newCondition);

                if (!ColumnList.Contains(queryConditionItem.ColName))
                {
                    strErrMsg += queryConditionItem.ColName + "Query Condition Field is not exist in collection any more" + System.Environment.NewLine;
                }
            }

            if (strErrMsg != String.Empty)
            {
                MyMessageBox.ShowMessage("Load Exception", "A Exception is happened when loading", strErrMsg, true);
            }
        }
コード例 #9
0
 /// <summary>
 /// 输出配置字典
 /// </summary>
 private void frmQuery_Load(object sender, EventArgs e)
 {
     this.Icon = GetSystemIcon.ConvertImgToIcon(GetResource.GetImage(ImageType.Query));
     ColumnList = MongoDBHelper.GetCollectionSchame(_mongoCol);
     foreach (String item in ColumnList)
     {
         //输出配置的初始化
         DataFilter.QueryFieldItem queryFieldItem = new DataFilter.QueryFieldItem();
         queryFieldItem.ColName = item;
         if (!CurrentDataViewInfo.IsUseFilter)
         {
             queryFieldItem.IsShow = true;
             queryFieldItem.sortType = DataFilter.SortType.NoSort;
         }
         else
         {
             DataFilter.QueryFieldItem find = CurrentDataViewInfo.mDataFilter.QueryFieldList.Find
                 (
                     (x) => { return x.ColName == item; }
                 );
             if (find.ColName != String.Empty)
             {
                 queryFieldItem.IsShow = find.IsShow;
                 queryFieldItem.sortType = find.sortType;
             }
         }
         if (queryFieldItem.ColName == MongoDBHelper.KEY_ID)
         {
             queryFieldItem.IsShow = true;
         }
         //动态加载控件
         ctlFieldInfo ctrItem = new ctlFieldInfo();
         ctrItem.Name = item;
         ctrItem.Location = _conditionPos;
         ctrItem.QueryFieldItem = queryFieldItem;
         tabFieldInfo.Controls.Add(ctrItem);
         //纵向位置的累加
         _conditionPos.Y += ctrItem.Height;
     }
     _conditionPos = new Point(5, 20);
     ctlQueryCondition firstQueryCtl = new ctlQueryCondition();
     firstQueryCtl.Init(ColumnList);
     firstQueryCtl.Location = _conditionPos;
     firstQueryCtl.Name = "Condition" + _conditionCount.ToString();
     panFilter.Controls.Add(firstQueryCtl);
     if (CurrentDataViewInfo.mDataFilter.QueryConditionList.Count > 0)
     {
         PutQueryToUI(CurrentDataViewInfo.mDataFilter);
     }
     if (!SystemManager.IsUseDefaultLanguage)
     {
         this.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Title);
         tabFieldInfo.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_FieldInfo);
         tabCondition.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Filter);
         cmdAddCondition.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Filter_AddCondition);
         cmdLoad.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Action_Load);
         cmdSave.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Common_Save);
         cmdOK.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Common_OK);
         cmdCancel.Text = SystemManager.mStringResource.GetText(StringResource.TextType.Common_Cancel);
     }
 }
コード例 #10
0
        /// <summary>
        /// 输出配置字典
        /// </summary>
        private void frmQuery_Load(object sender, EventArgs e)
        {
            ColumnList = MongoDBHelper.GetCollectionSchame(_mongoCol);
            foreach (String item in ColumnList)
            {
                //输出配置的初始化
                DataFilter.QueryFieldItem queryFieldItem = new DataFilter.QueryFieldItem();
                queryFieldItem.ColName = item;
                if (!CurrentDataViewInfo.IsUseFilter)
                {
                    queryFieldItem.IsShow   = true;
                    queryFieldItem.sortType = DataFilter.SortType.NoSort;
                }
                else
                {
                    DataFilter.QueryFieldItem find = CurrentDataViewInfo.mDataFilter.QueryFieldList.Find
                                                     (
                        (x) => { return(x.ColName == item); }
                                                     );
                    if (find.ColName != String.Empty)
                    {
                        queryFieldItem.IsShow   = find.IsShow;
                        queryFieldItem.sortType = find.sortType;
                    }
                }
                if (queryFieldItem.ColName == MongoDBHelper.KEY_ID)
                {
                    queryFieldItem.IsShow = true;
                }
                //动态加载控件
                ctlFieldInfo ctrItem = new ctlFieldInfo();
                ctrItem.Name           = item;
                ctrItem.Location       = _conditionPos;
                ctrItem.QueryFieldItem = queryFieldItem;
                tabFieldInfo.Controls.Add(ctrItem);
                //纵向位置的累加
                _conditionPos.Y += ctrItem.Height;
            }
            _conditionPos = new Point(5, 20);
            ctlQueryCondition firstQueryCtl = new ctlQueryCondition();

            firstQueryCtl.Init(ColumnList);
            firstQueryCtl.Location = _conditionPos;
            firstQueryCtl.Name     = "Condition" + _conditionCount.ToString();
            panFilter.Controls.Add(firstQueryCtl);
            if (CurrentDataViewInfo.mDataFilter.QueryConditionList.Count > 0)
            {
                PutQueryToUI(CurrentDataViewInfo.mDataFilter);
            }
            if (!SystemManager.IsUseDefaultLanguage)
            {
                this.Text            = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Title);
                tabFieldInfo.Text    = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_FieldInfo);
                tabCondition.Text    = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Filter);
                cmdAddCondition.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Filter_AddCondition);
                cmdLoad.Text         = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Action_Load);
                cmdSave.Text         = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Common_Save);
                cmdOK.Text           = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Common_OK);
                cmdCancel.Text       = SystemManager.mStringResource.GetText(StringResource.TextType.Common_Cancel);
            }
        }
コード例 #11
0
        private void PutQueryToUI(DataFilter NewDataFilter)
        {
            String        strErrMsg      = String.Empty;
            List <String> ShowColumnList = new List <String>();

            foreach (String item in ColumnList)
            {
                ShowColumnList.Add(item);
            }
            //清除所有的控件
            tabFieldInfo.Controls.Clear();
            foreach (DataFilter.QueryFieldItem queryFieldItem in NewDataFilter.QueryFieldList)
            {
                //动态加载控件
                if (!ColumnList.Contains(queryFieldItem.ColName))
                {
                    strErrMsg += queryFieldItem.ColName + "Display Field is not exist in current collection any more" + System.Environment.NewLine;
                }
                else
                {
                    ctlFieldInfo ctrItem = new ctlFieldInfo();
                    ctrItem.Name           = queryFieldItem.ColName;
                    ctrItem.Location       = _conditionPos;
                    ctrItem.QueryFieldItem = queryFieldItem;
                    tabFieldInfo.Controls.Add(ctrItem);
                    //纵向位置的累加
                    _conditionPos.Y += ctrItem.Height;
                    ShowColumnList.Remove(queryFieldItem.ColName);
                }
            }
            //新增字段
            _conditionPos = new Point(5, 0);
            foreach (String item in ShowColumnList)
            {
                strErrMsg += "New Field" + item + "Is Append" + System.Environment.NewLine;
                //输出配置的初始化
                DataFilter.QueryFieldItem queryFieldItem = new DataFilter.QueryFieldItem();
                queryFieldItem.ColName  = item;
                queryFieldItem.IsShow   = true;
                queryFieldItem.sortType = DataFilter.SortType.NoSort;
                //动态加载控件
                ctlFieldInfo ctrItem = new ctlFieldInfo();
                ctrItem.Name           = item;
                _conditionPos.Y       += ctrItem.Height;
                ctrItem.Location       = _conditionPos;
                ctrItem.QueryFieldItem = queryFieldItem;
                tabFieldInfo.Controls.Add(ctrItem);
            }

            panFilter.Controls.Clear();
            _conditionPos   = new Point(5, 0);
            _conditionCount = 0;
            foreach (DataFilter.QueryConditionInputItem queryConditionItem in NewDataFilter.QueryConditionList)
            {
                ctlQueryCondition newCondition = new ctlQueryCondition();
                newCondition.Init(ColumnList);
                _conditionPos.Y           += newCondition.Height;
                newCondition.Location      = _conditionPos;
                newCondition.ConditionItem = queryConditionItem;
                _conditionCount++;
                newCondition.Name = "Condition" + _conditionCount.ToString();
                panFilter.Controls.Add(newCondition);

                if (!ColumnList.Contains(queryConditionItem.ColName))
                {
                    strErrMsg += queryConditionItem.ColName + "Query Condition Field is not exist in collection any more" + System.Environment.NewLine;
                }
            }

            if (strErrMsg != String.Empty)
            {
                MyMessageBox.ShowMessage("Load Exception", "A Exception is happened when loading", strErrMsg, true);
            }
        }
コード例 #12
0
        /// <summary>
        /// 将条件转成UI
        /// </summary>
        /// <param name="NewDataFilter"></param>
        public void PutQueryToUI(DataFilter NewDataFilter)
        {
            String strErrMsg = String.Empty;
            List<String> ShowColumnList = new List<String>();
            foreach (String item in ColumnList)
            {
                ShowColumnList.Add(item);
            }
            //清除所有的控件
            List<DataFilter.QueryFieldItem> FieldList = NewDataFilter.QueryFieldList;
            foreach (DataFilter.QueryFieldItem queryFieldItem in NewDataFilter.QueryFieldList)
            {
                //动态加载控件
                if (!ColumnList.Contains(queryFieldItem.ColName))
                {
                    strErrMsg += "Display Field [" + queryFieldItem.ColName + "] is not exist in current collection any more" + System.Environment.NewLine;
                }
                else
                {
                    ShowColumnList.Remove(queryFieldItem.ColName);
                }
            }
            foreach (String item in ShowColumnList)
            {
                strErrMsg += "New Field" + item + "Is Append" + System.Environment.NewLine;
                //输出配置的初始化
                FieldList.Add(new DataFilter.QueryFieldItem(item));
            }
            Controls.Clear();
            _conditionPos = new Point(5, 0);
            _conditionCount = 0;
            foreach (DataFilter.QueryConditionInputItem queryConditionItem in NewDataFilter.QueryConditionList)
            {
                ctlQueryCondition newCondition = new ctlQueryCondition();
                newCondition.Init(ColumnList);
                _conditionPos.Y += newCondition.Height;
                newCondition.Location = _conditionPos;
                newCondition.ConditionItem = queryConditionItem;
                _conditionCount++;
                newCondition.Name = "Condition" + _conditionCount.ToString();
                Controls.Add(newCondition);

                if (!ColumnList.Contains(queryConditionItem.ColName))
                {
                    strErrMsg += queryConditionItem.ColName + "Query Condition Field is not exist in collection any more" + System.Environment.NewLine;
                }
            }

            if (strErrMsg != String.Empty)
            {
                MyMessageBox.ShowMessage("Load Exception", "A Exception is happened when loading", strErrMsg, true);
            }
        }
コード例 #13
0
ファイル: frmQuery.cs プロジェクト: kklik/MagicMongoDBTool
        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();
            if (openFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                String strErrMsg = String.Empty;
                List<String> ShowColumnList = new List<String>();
                foreach (String item in ColumnList)
                {
                    ShowColumnList.Add(item);
                }

                DataFilter NewDataFilter = DataFilter.LoadFilter(openFile.FileName);
                SystemManager.CurrDataFilter = NewDataFilter;
                //清除所有的控件
                tabFieldInfo.Controls.Clear();
                foreach (DataFilter.QueryFieldItem queryFieldItem in NewDataFilter.QueryFieldList)
                {
                    //动态加载控件
                    if (!ColumnList.Contains(queryFieldItem.ColName))
                    {
                        strErrMsg += queryFieldItem.ColName + "显示设置字段已经在当前数据集中不存在了" + "\r\n";
                    }
                    else {
                        ctlFieldInfo ctrItem = new ctlFieldInfo();
                        ctrItem.Name = queryFieldItem.ColName;
                        ctrItem.Location = _conditionPos;
                        ctrItem.QueryFieldItem = queryFieldItem;
                        tabFieldInfo.Controls.Add(ctrItem);
                        //纵向位置的累加
                        _conditionPos.Y += ctrItem.Height;
                        ShowColumnList.Remove(queryFieldItem.ColName);
                    }
                }
                //新增字段
                foreach (String item in ShowColumnList)
                {
                    strErrMsg += "新增加" + item + "显示设置字段" + "\r\n";
                    //输出配置的初始化
                    DataFilter.QueryFieldItem queryFieldItem = new DataFilter.QueryFieldItem();
                    queryFieldItem.ColName = item;
                    queryFieldItem.IsShow = true;
                    queryFieldItem.sortType = DataFilter.SortType.NoSort;
                    //动态加载控件
                    ctlFieldInfo ctrItem = new ctlFieldInfo();
                    ctrItem.Name = item;
                    ctrItem.Location = _conditionPos;
                    ctrItem.QueryFieldItem = queryFieldItem;
                    tabFieldInfo.Controls.Add(ctrItem);
                    //纵向位置的累加
                    _conditionPos.Y += ctrItem.Height;
                }

                panFilter.Controls.Clear();
                _conditionPos = new Point(5, 20);
                _conditionCount = 0;
                foreach (DataFilter.QueryConditionInputItem queryConditionItem in NewDataFilter.QueryConditionList)
                {
                    ctlQueryCondition newCondition = new ctlQueryCondition();
                    newCondition.Init(ColumnList);
                    newCondition.Location = _conditionPos;
                    newCondition.ConditionItem = queryConditionItem;
                    _conditionCount++;
                    newCondition.Name = "Condition" + _conditionCount.ToString();
                    panFilter.Controls.Add(newCondition);
                    _conditionPos.Y += newCondition.Height;
                    if (!ColumnList.Contains(queryConditionItem.ColName))
                    {
                        strErrMsg += queryConditionItem.ColName + "条件查询字段已经在当前数据集中不存在了" + "\r\n";
                    }
                }

                if (strErrMsg != String.Empty) {
                    MyMessageBox.ShowMessage("加载错误", "加载检索设置时发生错误", strErrMsg, true);
                }
            }
        }
コード例 #14
0
ファイル: frmQuery.cs プロジェクト: kklik/MagicMongoDBTool
        /// <summary>
        /// 输出配置字典
        /// </summary>
        private void frmQuery_Load(object sender, EventArgs e)
        {
            ColumnList = MongoDBHelper.GetCollectionSchame(_mongoCol);

            foreach (String item in ColumnList)
            {
                //输出配置的初始化
                DataFilter.QueryFieldItem queryFieldItem = new DataFilter.QueryFieldItem();
                queryFieldItem.ColName = item;
                queryFieldItem.IsShow = true;
                queryFieldItem.sortType = DataFilter.SortType.NoSort;
                //动态加载控件
                ctlFieldInfo ctrItem = new ctlFieldInfo();
                ctrItem.Name = item;
                ctrItem.Location = _conditionPos;
                ctrItem.QueryFieldItem = queryFieldItem;
                tabFieldInfo.Controls.Add(ctrItem);
                //纵向位置的累加
                _conditionPos.Y += ctrItem.Height;
            }
            _conditionPos = new Point(5, 20);
            ctlQueryCondition firstQueryCtl = new ctlQueryCondition();
            firstQueryCtl.Init(ColumnList);
            firstQueryCtl.Location = _conditionPos;
            firstQueryCtl.Name = "Condition" + _conditionCount.ToString();
            panFilter.Controls.Add(firstQueryCtl);
        }
コード例 #15
0
        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();
            openFile.Filter = MongoDBHelper.XmlFilter;
            if (openFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                String strErrMsg = String.Empty;
                List<String> ShowColumnList = new List<String>();
                foreach (String item in ColumnList)
                {
                    ShowColumnList.Add(item);
                }

                DataFilter NewDataFilter = DataFilter.LoadFilter(openFile.FileName);
                SystemManager.CurrDataFilter = NewDataFilter;
                //清除所有的控件
                tabFieldInfo.Controls.Clear();
                foreach (DataFilter.QueryFieldItem queryFieldItem in NewDataFilter.QueryFieldList)
                {
                    //动态加载控件
                    if (!ColumnList.Contains(queryFieldItem.ColName))
                    {
                        strErrMsg += queryFieldItem.ColName + "Display Field is not exist in current collection any more" + System.Environment.NewLine;
                    }
                    else {
                        ctlFieldInfo ctrItem = new ctlFieldInfo();
                        ctrItem.Name = queryFieldItem.ColName;
                        ctrItem.Location = _conditionPos;
                        ctrItem.QueryFieldItem = queryFieldItem;
                        tabFieldInfo.Controls.Add(ctrItem);
                        //纵向位置的累加
                        _conditionPos.Y += ctrItem.Height;
                        ShowColumnList.Remove(queryFieldItem.ColName);
                    }
                }
                //新增字段
                _conditionPos = new Point(5, 0);
                foreach (String item in ShowColumnList)
                {
                    strErrMsg += "New Field" + item + "Is Append" + System.Environment.NewLine;
                    //输出配置的初始化
                    DataFilter.QueryFieldItem queryFieldItem = new DataFilter.QueryFieldItem();
                    queryFieldItem.ColName = item;
                    queryFieldItem.IsShow = true;
                    queryFieldItem.sortType = DataFilter.SortType.NoSort;
                    //动态加载控件
                    ctlFieldInfo ctrItem = new ctlFieldInfo();
                    ctrItem.Name = item;
                    _conditionPos.Y += ctrItem.Height;
                    ctrItem.Location = _conditionPos;
                    ctrItem.QueryFieldItem = queryFieldItem;
                    tabFieldInfo.Controls.Add(ctrItem);
                }

                panFilter.Controls.Clear();
                _conditionPos = new Point(5, 0);
                _conditionCount = 0;
                foreach (DataFilter.QueryConditionInputItem queryConditionItem in NewDataFilter.QueryConditionList)
                {
                    ctlQueryCondition newCondition = new ctlQueryCondition();
                    newCondition.Init(ColumnList);
                    _conditionPos.Y += newCondition.Height;
                    newCondition.Location = _conditionPos;
                    newCondition.ConditionItem = queryConditionItem;
                    _conditionCount++;
                    newCondition.Name = "Condition" + _conditionCount.ToString();
                    panFilter.Controls.Add(newCondition);

                    if (!ColumnList.Contains(queryConditionItem.ColName))
                    {
                        strErrMsg += queryConditionItem.ColName + "Query Condition Field is not exist in collection any more" + System.Environment.NewLine;
                    }
                }

                if (strErrMsg != String.Empty) {
                    MyMessageBox.ShowMessage("Load Exception", "A Exception is happened when loading", strErrMsg, true);
                }
            }
        }
コード例 #16
0
        /// <summary>
        /// 输出配置字典
        /// </summary>
        private void frmQuery_Load(object sender, EventArgs e)
        {
            ColumnList = MongoDBHelper.GetCollectionSchame(_mongoCol);

            foreach (String item in ColumnList)
            {
                //输出配置的初始化
                DataFilter.QueryFieldItem queryFieldItem = new DataFilter.QueryFieldItem();
                queryFieldItem.ColName = item;
                queryFieldItem.IsShow = true;
                queryFieldItem.sortType = DataFilter.SortType.NoSort;
                //动态加载控件
                ctlFieldInfo ctrItem = new ctlFieldInfo();
                ctrItem.Name = item;
                ctrItem.Location = _conditionPos;
                ctrItem.QueryFieldItem = queryFieldItem;
                tabFieldInfo.Controls.Add(ctrItem);
                //纵向位置的累加
                _conditionPos.Y += ctrItem.Height;
            }
            _conditionPos = new Point(5, 20);
            ctlQueryCondition firstQueryCtl = new ctlQueryCondition();
            firstQueryCtl.Init(ColumnList);
            firstQueryCtl.Location = _conditionPos;
            firstQueryCtl.Name = "Condition" + _conditionCount.ToString();
            panFilter.Controls.Add(firstQueryCtl);

            if (!SystemManager.IsUseDefaultLanguage())
            {
                this.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Title);
                tabFieldInfo.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_FieldInfo);
                tabCondition.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Filter);
                cmdAddCondition.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Filter_AddCondition);
                cmdLoad.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Query_Action_Load);
                cmdSave.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Common_Save);
                cmdOK.Text = SystemManager.mStringResource.GetText(MagicMongoDBTool.Module.StringResource.TextType.Common_OK);
            }
        }