Esempio n. 1
0
/// <summary>
/// Paste assay data from clipboard
/// </summary>
/// <param name="s"></param>

        private void PasteMenuItem_Click(object sender, EventArgs e)
        {
            string s = Clipboard.GetText();

            if (Lex.IsUndefined(s))
            {
                return;
            }

            List <MetaTableItem> list = MetaTableItem.ParseList(s, false, false);

            foreach (MetaTableItem i in list)
            {
                AddMetaTableItemToDataTable(i);
            }

            return;
        }
Esempio n. 2
0
/// <summary>
/// Get values from form and update criteria in associated QueryColumn
/// </summary>
/// <returns></returns>

        bool UpdateCriteria()
        {
            MetaTable mt;
            string    label, name, listString;
            bool      summary;
            int       tableId;

            DataRowCollection rows = ItemGridDataTable.Rows;
            string            s    = "";
            List <string>     sl2  = new List <string>(new string[] { "", "" });

            foreach (DataRow dr in rows)
            {
                label = sl2[0] = dr["LabelColumn"] as string;
                name  = sl2[1] = dr["InternalNameColumn"] as string;

                if (Lex.IsUndefined(label) && Lex.IsUndefined(name))
                {
                    continue;
                }

                string txt = Csv.JoinCsvString(sl2);
                s += txt + "\r\n";
            }

            List <MetaTableItem> list = MetaTableItem.ParseList(s, true, true);
            string valueList          = "";    // list of values to match in criteria
            string displayList        = "";

            string mcDict      = Qc.MetaColumn.Dictionary;
            bool   searchId    = Lex.EndsWith(mcDict, ".Id");
            bool   searchLabel = Lex.EndsWith(mcDict, ".Label");

            foreach (MetaTableItem mti in list)
            {
                mt = MetaTableCollection.Get(mti.InternalName);
                if (mt == null)
                {
                    continue;
                }

                MetaTable.ParseMetaTableName(mt.Name, out tableId, out summary);

                label = MetaTable.RemoveSuffixesFromName(mt.Label);

                //mtn = MetaTree.GetNode(mti.InternalName); // need to check node name vs target?

                // Append to value list

                if (valueList.Length > 0)
                {
                    valueList += ", ";
                }

                if (searchId)                 // extract numeric id for table if matching against numeric column
                {
                    valueList += tableId.ToString();
                }

                else
                {
                    valueList += Lex.AddSingleQuotes(label);
                }

                // Append to label list

                if (displayList.Length == 0)                 // include first item label only in CriteriaDisplay
                {
                    displayList = label + " - ASSAY: ";
                }
                else
                {
                    displayList += ", ";
                }

                displayList += tableId.ToString();
            }

            if (valueList == "")
            {
                Qc.Criteria = Qc.CriteriaDisplay = "";
            }
            else
            {
                Qc.Criteria        = Qc.MetaColumn.Name + " in (" + valueList + ")";
                Qc.CriteriaDisplay = displayList;
            }

            return(true);
        }