Esempio n. 1
0
/// <summary>
/// Invoke the editor
/// </summary>
/// <param name="qc"></param>
/// <returns></returns>

        public static bool Edit(
            QueryColumn qc)
        {
            if (Lex.StartsWith(qc.MetaColumn.Dictionary, "ContentsTree"))
            {
                return(CriteriaContentsTreeList.Edit(qc));
            }

            if (Instance == null)
            {
                Instance = new CriteriaDictMultSelect();
            }

            new JupyterGuiConverter().ConvertFormOrUserControl(Instance);

            string title  = "Search criteria for " + qc.ActiveLabel;
            string prompt = "Select one or more " + qc.ActiveLabel + " from the list below.";

            string dictName = GetCriteriaSpecificDictionary(qc);

            string selections = CheckedListBoxDialog(title, prompt, dictName, qc.Criteria);

            if (selections == null)
            {
                return(false);
            }

            else
            {
                if (selections == "")
                {
                    qc.Criteria = qc.CriteriaDisplay = "";
                }
                else
                {
                    qc.CriteriaDisplay = selections;

                    if (!qc.MetaColumn.IsNumeric)
                    {                     // quote items if necessary
                        List <string> items = Csv.SplitCsvString(selections);
                        for (int i1 = 0; i1 < items.Count; i1++)
                        {
                            items[i1] = Lex.AddSingleQuotes(items[i1]);
                        }
                        selections = Csv.JoinCsvString(items);
                    }

                    qc.Criteria = qc.MetaColumn.Name + " in (" + selections + ")";
                }
                return(true);
            }
        }
Esempio n. 2
0
/// <summary>
/// SetupForm
/// </summary>

        void SetupForm()
        {
            string selectedNodeTarget = "", topNodeTarget = "";

            CriteriaContentsTreeList i = this;

            string title = "Search criteria for " + Qc.ActiveLabel;

            i.Text = title;

            string prompt = "Use the Database Contents tree and QuickSearch line to select items to be added to this list.";

            i.Prompt.Text = Lex.Replace(prompt, "items", Qc.ActiveLabel);

            i.CreateItemDataTable();
            i.FillItemDataTable();
            i.ItemGrid.DataSource = i.ItemGridDataTable;

            ContentsTreeWithSearch.ResetTreeAndCommandLine();

            //topNodeTarget = SS.I.PreferredProjectId;

            //MetaTreeNodeType contentsFilter = MetaTreeNodeType.MetaTable | // database content types
            //  MetaTreeNodeType.CalcField | MetaTreeNodeType.Annotation;

            //i.ContentsTreeWithSearch.ContentsTree.Fill(
            //  "root",
            //  contentsFilter,
            //  selectedNodeTarget,
            //  topNodeTarget,
            //  null,
            //  true,
            //  false);

            return;
        }
Esempio n. 3
0
/// <summary>
/// Edit list of items from contents tree
/// </summary>
/// <param name="qc"></param>
/// <returns></returns>

        public static bool Edit(
            QueryColumn qc)
        {
            Instance = new CriteriaContentsTreeList();
            CriteriaContentsTreeList i = Instance;

            i.Qc = qc;
            i.SetupForm();

            QbUtil.SetProcessTreeItemOperationMethod(TreeItemOperation);

            DialogResult dr = i.ShowDialog(SessionManager.ActiveForm);

            QbUtil.RestoreProcessTreeItemOperationMethod();

            if (dr == DialogResult.OK)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }