コード例 #1
0
        /// <summary>
        /// Invoke the editor
        /// </summary>
        /// <param name="qc">QueryColumn to edit</param>
        /// <returns></returns>

        public static bool Edit(
            QueryColumn qc)
        {
            AssertMx.IsNotNull(qc, "qc");

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

            new JupyterGuiConverter().ConvertFormOrUserControl(Instance);

            if (qc.IsKey)             // if key col be sure qc is in sync with Query.KeyCriteria
            {
                qc.CopyCriteriaFromQueryKeyCriteria();
            }

            if (qc.Criteria.Trim().StartsWith("=") && qc.MetaColumn != null)
            {
                qc.Criteria = qc.MetaColumnName + " " + qc.Criteria;
            }

            Instance.Qc = qc;
            Instance.Setup(qc);

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

            if (dr == DialogResult.OK)
            {
                if (qc.IsKey)                 // if key col then update Query.KeyCriteria
                {
                    qc.CopyCriteriaToQueryKeyCritera();
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
/// Edit criteria for a query column
/// </summary>
/// <param name="qc"></param>
/// <returns>True if criteria has been successfully edited</returns>

        public static bool EditCriteria(
            QueryColumn qc)
        {
            MetaColumn mc    = qc.MetaColumn;
            Query      Query = qc.QueryTable.Query;
            bool       sameQ = Query == QueriesControl.Instance.CurrentQuery;       // debug

            if (Lex.Contains(qc.MetaColumn.ColumnMap, ToolUtil.ToolParametersColumnMapValue))
            {
                DialogResult dr = ToolHelper.InvokeToolCriteriaEditor(qc);
                return(dr == DialogResult.OK);
            }

            try
            {
                if (!mc.IsSearchable)
                {
                    MessageBoxMx.ShowError("The " + qc.ActiveLabel + " data item is not currently searchable.");
                    return(false);
                }

                if (mc.IsKey)                              // edit key criteria
                {
                    qc.CopyCriteriaFromQueryKeyCriteria(); // be sure qc is in sync with Query.KeyCriteria
                    if (!CriteriaCompoundId.Edit(qc))
                    {
                        return(false);
                    }

                    qc.CopyCriteriaToQueryKeyCritera();                     // update Query.KeyCriteria
                    return(true);
                }

                switch (mc.DataType)
                {
                // Compound Number criteria

                case MetaColumnType.CompoundId:

                    if (!CriteriaCompoundId.Edit(qc))
                    {
                        return(false);
                    }
                    else
                    {
                        break;
                    }

                // Structure criteria

                case MetaColumnType.Structure:
                    if (!CriteriaStructure.Edit(qc))
                    {
                        return(false);
                    }
                    break;

                // Mol. formula criteria

                case MetaColumnType.MolFormula:
                    if (!CriteriaMolFormula.Edit(qc))
                    {
                        return(false);
                    }
                    break;


                // General criteria

                case MetaColumnType.Integer:
                case MetaColumnType.Number:
                case MetaColumnType.QualifiedNo:
                case MetaColumnType.String:
                case MetaColumnType.Date:
                case MetaColumnType.DictionaryId:

                    if (!CriteriaDialog.Edit(qc))
                    {
                        return(false);
                    }
                    else
                    {
                        break;
                    }

                default:
                    MessageBoxMx.ShowError("The " + qc.ActiveLabel + " data item is not currently searchable.");
                    return(false);
                }

                return(true);
            }

            catch (Exception ex)
            {
                string msg = "Unexpected error editing criteria: \r\n\r\n" +
                             DebugLog.FormatExceptionMessage(ex);
                ServicesLog.Message(msg);
                MessageBoxMx.ShowError(msg);
                return(false);
            }
        }
コード例 #3
0
/// <summary>
/// Edit CompoundId Criteria proxy
/// </summary>
/// <param name="qc"></param>
/// <returns></returns>

        public static bool GetCompoundIdCriteria(
            QueryColumn qc)
        {
            return(CriteriaCompoundId.Edit(qc));
        }