private static Parameter CreateParameter(string name, string value, MetaColumn configurationColumn) {
     var param = new Parameter() {
         Name = name,
         DefaultValue = value
     };
     DataSourceUtil.SetParameterTypeCodeAndDbType(param, configurationColumn);
     return param;
 }
        internal static IEnumerable<Parameter> GetRegularColumnParameters(MetaColumn column) {
            // Handle other columns (e.g. booleans)
            string name = column.Name;
            string value = Misc.GetRouteValue(name);

            var param = CreateParameter(name, value, column);
            
            return new List<Parameter>() { param };
        }
Exemplo n.º 3
0
        private MetaColumn GetDisplayColumnFromMetadata()
        {
            DisplayColumnAttribute displayColumnAttribute = this.Metadata.DisplayColumnAttribute;

            if (displayColumnAttribute == null)
            {
                return(null);
            }
            MetaColumn column = null;

            if (!this.TryGetColumn(displayColumnAttribute.DisplayColumn, out column))
            {
                object[] args = new object[] { displayColumnAttribute.DisplayColumn, this.Name };
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, DynamicDataResources.MetaTable_CantFindDisplayColumn, args));
            }
            return(column);
        }
Exemplo n.º 4
0
/// <summary>
/// Invoke the editor
/// </summary>
/// <param name="qc">QueryColumn to edit</param>
/// <returns></returns>

        public static bool Edit(
            QueryColumn qc)
        {
            //if (DebugMx.True) return CriteriaYesNo.Edit(qc);

            if (qc.MetaColumn.DictionaryMultipleSelect)
            {
                return(CriteriaDictMultSelect.Edit(qc));
            }

            else if (Lex.Eq(qc.MetaColumn.Dictionary, "yes_no"))
            {
                return(CriteriaYesNo.Edit(qc));
            }

            MetaColumn mc = qc.MetaColumn;

            if (Instance == null)
            {
                Instance = new CriteriaDialog();
            }
            if (Instance.Visible)
            {
                return(false);                              // catch 2nd of two quick single-clicks & ignore
            }
            new JupyterGuiConverter().ConvertFormOrUserControl(Instance, true);

            Instance.Setup(qc);
            Instance.Qc = qc;
            Form         activeForm = SessionManager.ActiveForm;
            DialogResult dr         = Instance.ShowDialog(SessionManager.ActiveForm);

            if (activeForm != null)
            {
                activeForm.BringToFront();
            }

            if (dr == DialogResult.OK)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        public void Column()
        {
            MetaModel  m  = Utils.CommonInitialize();
            MetaTable  t  = m.Tables[TestDataContext.TableBazColumnAttributes];
            MetaColumn mc = t.GetColumn("ColumnNoAttributes");

            var dv = new PokerDynamicValidator();

            Assert.IsNull(dv.Column, "#A1");

            dv.Column = mc;
            Assert.IsNotNull(dv.Column, "#B1");
            Assert.AreEqual(mc, dv.Column, "#B1-1");

            dv.Column = null;
            Assert.IsNull(dv.Column, "#C1");
        }
Exemplo n.º 6
0
        /// <summary>
        /// Execute Related Structure Search
        /// </summary>
        /// <param name="eqp"></param>

        void ExecuteRelatedStructureSearch(
            ExecuteQueryParms eqp)
        {
            if (RSS == null)
            {
                RSS = new RelatedStructureSearch();

                Query       q  = StructCriteriaQc.QueryTable.Query;
                QueryTable  qt = StructCriteriaQc.QueryTable;
                MetaTable   mt = qt.MetaTable;
                QueryColumn qc = StructCriteriaQc;
                MetaColumn  mc = qc.MetaColumn;

                RSS.QueryMtName = mt.Name;

                RSS.QueryChimeString = Pssc.Molecule.GetChimeString();                 // if no cid in options use passed structure

                RSS.IncludeQueryStructure = true;

                RSS.SearchCorp   = (Lex.Contains(mt.Name, "Corp"));
                RSS.SearchChembl = (Lex.Contains(mt.Name, "ChEMBL"));

                RSS.SearchFSS        = SST.IsFull(Pssc.SearchTypeUnion);
                RSS.SearchMmp        = SST.IsMmp(Pssc.SearchTypeUnion);
                RSS.SearchSmallWorld = SST.IsSw(Pssc.SearchTypeUnion);
                RSS.SearchSim        = SST.IsSim(Pssc.SearchTypeUnion);
                RSS.SearchSSS        = SST.IsSSS(Pssc.SearchTypeUnion);

                if (RSS.SearchMmp && Lex.IsUndefined(RSS.QueryCid))                 // try to get a cid from the structure if we are searching MMP and don't already have one
                {
                    int corpId = Pssc.Molecule.GetCompoundId();
                    if (corpId > 0)
                    {
                        RSS.QueryCid = corpId.ToString();
                    }
                }

                RSS.KeysToExclude = q.KeysToExclude;

                RSS.ExecuteSearch();
            }

            BuildRelatedStructureSearchQueryEngineRows(eqp);

            return;
        }
Exemplo n.º 7
0
 protected override void OnLoad(EventArgs e)
 {
     if (Session["isLoginIn"] == "True")
     {
         foreach (MetaColumn column in Table.GetScaffoldColumns(Mode, ContainerType))
         {
             currentColumn = column;
             Control item = new _NamingContainer();
             EntityTemplate1.ItemTemplate.InstantiateIn(item);
             EntityTemplate1.Controls.Add(item);
         }
     }
     else
     {
         Response.Redirect("login.html");
     }
 }
Exemplo n.º 8
0
 void setContext(ITypeDescriptorContext context)
 {
     _metaConnection   = context.Instance as MetaConnection;
     _metaEnum         = context.Instance as MetaEnum;
     _metaTable        = context.Instance as MetaTable;
     _metaColumn       = context.Instance as MetaColumn;
     _metaJoin         = context.Instance as MetaJoin;
     _reportView       = context.Instance as ReportView;
     _reportOutput     = context.Instance as ReportOutput;
     _reportSchedule   = context.Instance as ReportSchedule;
     _parameter        = context.Instance as Parameter;
     _security         = context.Instance as SealSecurity;
     _emailDevice      = context.Instance as OutputEmailDevice;
     _fileServerDevice = context.Instance as OutputFileServerDevice;
     _model            = context.Instance as ReportModel;
     _configuration    = context.Instance as SealServerConfiguration;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Get label from QueryColumn or from MetaColumn if no query column label
        /// </summary>
        /// <param name="includeAggregationType"></param>
        /// <returns></returns>

        public string GetActiveLabel(
            bool includeAggregationType)
        {
            string label = "";

            if (!Lex.IsNullOrEmpty(Label))
            {
                label = Label;
            }
            else if (MetaColumn != null)
            {
                MetaColumn mc = MetaColumn;
                if (!Lex.IsNullOrEmpty(mc.Label))
                {
                    label = mc.Label;
                }
                else
                {
                    label = Lex.InternalNameToLabel(mc.Name);
                }

                if (!Lex.IsNullOrEmpty(mc.Units) && !Lex.Contains(label, mc.Units))
                {                 // add any units
                    string unitsString = "(" + mc.Units + ")";
                    label += " " + unitsString;
                }
            }
            int i1 = label.IndexOf("\t");             // if tab-separated just return the first part

            if (i1 >= 0)
            {
                label = label.Substring(0, i1);
            }

            if (Aggregation != null && Aggregation.RoleIsDefined && includeAggregationType &&              // If aggregated col add type of aggregation to label if not a grouping col
                QueryTable != null && QueryTable.AggregationEnabled)
            {
                if (!IsAggregationGroupBy)
                {
                    label += " " + Aggregation.TypeLabel;
                }
            }

            return(label);
        }
Exemplo n.º 10
0
/// <summary>
/// Count how many names in this table match names already seen
/// </summary>
/// <param name="qt"></param>
/// <param name="suffix"></param>
/// <param name="columnNames"></param>
/// <param name="columnLabels"></param>
/// <param name="keyIsDup"></param>
/// <returns></returns>

        void CountDuplicateNames(
            QueryTable qt,
            HashSet <string> columnNames,
            HashSet <string> columnLabels,
            out List <QueryColumn> uniqueNameCols,
            out List <QueryColumn> dupNameCols,
            out List <QueryColumn> uniqueLabelCols,
            out List <QueryColumn> dupLabelCols)
        {
            uniqueNameCols  = new List <QueryColumn>();
            dupNameCols     = new List <QueryColumn>();
            uniqueLabelCols = new List <QueryColumn>();
            dupLabelCols    = new List <QueryColumn>();

            for (int ci = 0; ci < qt.QueryColumns.Count; ci++)             // see how many cols are duplicates
            {
                QueryColumn qc = qt.QueryColumns[ci];
                //if (!qc.Selected) continue;

                MetaColumn mc   = qc.MetaColumn;
                string     name = mc.Name.ToUpper();
                if (!columnNames.Contains(name))
                {
                    uniqueNameCols.Add(qc);
                    columnNames.Add(name);
                }
                else
                {
                    dupNameCols.Add(qc);
                }

                string label = qc.ActiveLabel.ToUpper();
                if (!columnLabels.Contains(label))
                {
                    uniqueLabelCols.Add(qc);
                    columnLabels.Add(label);
                }
                else
                {
                    dupLabelCols.Add(qc);
                }
            }

            return;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Render the specified table with any specified column marked
        /// </summary>
        /// <param name="mt"></param>
        /// <param name="mc"></param>

        void RenderTable(
            MetaTable mt,
            MetaColumn mc)
        {
            QueryTable qt;

            if (mt == null)             // no query table
            {
                mt = new MetaTable();
                qt = new QueryTable(mt);
            }

            else             // mark selected field in query table to render
            {
                qt = new QueryTable(mt);
                qt.DeselectAll();
                bool selectedField = false;

                if (mc != null)
                {
                    for (int i1 = 0; i1 < qt.QueryColumns.Count; i1++)
                    {
                        QueryColumn qc = qt.QueryColumns[i1];
                        if (qc.MetaColumn == mc)                          // is this the column to select
                        {
                            qc.Selected   = true;
                            selectedField = true;
                        }
                        else
                        {
                            qc.Selected = false;
                        }
                    }
                }

                else if (CheckmarkDefaultColumn && qt.QueryColumns.Count > 1)                 // default to 1st metacolumn past key
                {
                    qt.QueryColumns[1].Selected = true;
                }
            }

            FieldGrid.Render(qt);
            SelectedQt = qt;             // keep qt where selected column will be found
            return;
        }
Exemplo n.º 12
0
        public static string DynamicField(this HtmlHelper html, object entity, MetaColumn column, string uiHint, DataBoundControlMode mode)
        {
            var host = new SimpleFieldTemplateHost()
            {
                Column = column, Mode = mode
            };

            IFieldTemplate  fieldTemplate        = MetaModel.Default.FieldTemplateFactory.CreateFieldTemplate(column, mode, uiHint ?? column.UIHint);
            ViewUserControl fieldTemplateControl = fieldTemplate as ViewUserControl;

            if (fieldTemplateControl == null)
            {
                throw new InvalidOperationException("Cannot render a dynamic field whose field template is not a ViewUserControl");
            }

            fieldTemplate.SetHost(host);
            return(html.RenderViewUserControl(fieldTemplateControl, entity));
        }
Exemplo n.º 13
0
        MetaColumn SetMetaColumnVisibility(
            MetaTable mt,
            string mcName,
            SpotfireViewProps sl,
            string parmName)
        {
            MetaColumn mc = mt.GetMetaColumnByName(mcName);

            if (mc == null)
            {
                return(null);
            }

            ColumnSelectionEnum mcis = (sl.IsParameterValueTrue(parmName) ? ColumnSelectionEnum.Selected : ColumnSelectionEnum.Hidden);

            mc.InitialSelection = mcis;
            return(mc);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Return true if this column always has an associated image column
        /// </summary>
        /// <param name="mc"></param>
        /// <returns></returns>
        ///
        public static bool HasRelatedImageColumn(
            MetaColumn mc)
        {
            if (ImageResultTypes == null)
            {
                ReadImageResultTypes();
            }

            foreach (string s in ImageResultTypes)
            {
                if (s == mc.MetaTable.Code + "." + mc.ResultCode)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 15
0
        internal void CreateColumns()
        {
            List <MetaColumn> list = new List <MetaColumn>();

            this._columnsByName = new Dictionary <string, MetaColumn>(StringComparer.OrdinalIgnoreCase);
            foreach (ColumnProvider provider in this.Provider.Columns)
            {
                MetaColumn item = this.CreateColumnInternal(provider);
                list.Add(item);
                if (this._columnsByName.ContainsKey(item.Name))
                {
                    object[] args = new object[] { item.Name, this.Provider.Name };
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, DynamicDataResources.MetaTable_ColumnNameConflict, args));
                }
                this._columnsByName.Add(item.Name, item);
            }
            this.Columns = new ReadOnlyCollection <MetaColumn>(list);
        }
Exemplo n.º 16
0
        public void IsString()
        {
            MetaModel m = Utils.CommonInitialize();

            MetaTable  t  = m.Tables[TestDataContext.TableBazDataTypeDefaultTypes];
            MetaColumn mc = t.GetColumn("Char_Column");

            Assert.IsNotNull(mc, "#A1");
            Assert.AreEqual(false, mc.IsString, "#A1-1");

            mc = t.GetColumn("Int_Column");
            Assert.IsNotNull(mc, "#B1");
            Assert.AreEqual(false, mc.IsString, "#B1-1");

            mc = t.GetColumn("String_Column");
            Assert.IsNotNull(mc, "#C1");
            Assert.AreEqual(true, mc.IsString, "#C1-1");
        }
Exemplo n.º 17
0
 public void BuildColumns(TemplateContainer node)
 {
     foreach (MetaTable table in model.Tables)
     {
         foreach (MetaColumn column in table.Columns)
         {
             TemplateContainer arrnode = node.AddArrayValue(table.Id.ToString() + "!" + column.Ix.ToString());
             arrnode.AddFromObject(column);
             arrnode.AddLink("Table", "Tables[" + column.TableId.ToString() + "]");
             MetaColumn currentcolumn = column;
             while (currentcolumn.TargetColumn != null)
             {
                 currentcolumn = currentcolumn.TargetColumn;
             }
             node.AddLink("Domain", "/Domains[" + currentcolumn.Domain.Id.ToString() + "]");
         }
     }
 }
        internal static IEnumerable <Parameter> GetForeignKeyParameters(MetaForeignKeyColumn fkColumn)
        {
            Debug.Assert(fkColumn.ForeignKeyNames.Count == fkColumn.ParentTable.PrimaryKeyColumns.Count);
            var result = new List <Parameter>();

            for (int i = 0; i < fkColumn.ForeignKeyNames.Count; i++)
            {
                string name  = fkColumn.ForeignKeyNames[i];
                string value = Misc.GetRouteValue(name);

                MetaColumn parentTablePKColumn = fkColumn.ParentTable.PrimaryKeyColumns[i];

                var param = CreateParameter(name, value, parentTablePKColumn);

                result.Add(param);
            }
            return(result);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Return true if the MetaColumn is from an unpivoted table that contains both SP and CRC values
        /// </summary>
        /// <param name="mc"></param>
        /// <returns></returns>

        public static bool IsSpAndCrcUnpivotedAssayResultColumn(MetaColumn mc)
        {
            string mtName = mc.MetaTable.Name;

            if ((Lex.StartsWith(mtName, MultiDbAssayDataNames.NgrNonSumUnpivotedTableName) &&                     // unpivoted NGR table
                 (Lex.Eq(mc.Name, "RSLT_VALUE") || Lex.Eq(mc.Name, "RSLT_VALUE_NBR")))
                ||
                (Lex.Eq(mtName, MultiDbAssayDataNames.CombinedNonSumTableName) &&                  // old unpivoted MultiDb table
                 (Lex.Eq(mc.Name, "RSLT_VAL") || Lex.Eq(mc.Name, "RSLT_VAL_NBR"))))
            {
                return(true);
            }

            else
            {
                return(false);
            }
        }
Exemplo n.º 20
0
 private MetaColumn BuildOrUpdateMetaColumn(ref MetaColumn metaColumn, Type columnValueType, Operation.Grouping.IMergeAlgorithm mergeAlgo)
 {
     if (metaColumn == null)
     {
         metaColumn = new MetaColumn(name, name, columnValueType, isPrimaryKey, groupAlgo, mergeAlgo, displayDefaultWidth);
     }
     else
     {
         if (metaColumn.Type == null)
         {
             metaColumn.Type = columnValueType;
         }
         else if (columnValueType != null && metaColumn.Type != columnValueType)
         {
             DebugUtility.LogError("Cannot redefine column type as '" + columnValueType + "'. Was already defined as '" + metaColumn.Type + "'");
         }
     }
     return(metaColumn);
 }
Exemplo n.º 21
0
        static void ControlPropertiesValid_01_OnLoad(Page p)
        {
            var dv = p.FindChild <PokerDynamicValidator> ("dynamicValidator1");

            Assert.IsNotNull(dv, "#A1");

            Assert.IsFalse(dv.CallControlPropertiesValid(), "#A2");
            Assert.IsNull(dv.Column, "#A2-1");
            Assert.IsNull(dv.ColumnName, "#A2-2");

            MetaModel  m  = Utils.CommonInitialize();
            MetaTable  t  = m.Tables[TestDataContext.TableBar];
            MetaColumn mc = t.GetColumn("Column1");

            dv.Column = mc;
            Assert.IsFalse(dv.CallControlPropertiesValid(), "#A3");
            Assert.IsNotNull(dv.Column, "#A3-1");
            Assert.IsNull(dv.ColumnName, "#A3-2");
        }
Exemplo n.º 22
0
        public void DisplayColumn()
        {
            MetaModel m = Utils.CommonInitialize();

            MetaTable  t  = m.Tables[TestDataContext.TableFooDisplayColumnAttribute];
            MetaColumn mc = t.DisplayColumn;

            Assert.IsNotNull(mc, "#A1");
            Assert.AreEqual("Column2", mc.Name, "#A2");

            t = m.Tables[TestDataContext.TableFooEmpty];
            AssertExtensions.Throws <ArgumentOutOfRangeException> (() => mc = t.DisplayColumn, "#B1");

            t  = m.Tables[TestDataContext.TableFooWithDefaults];
            mc = t.DisplayColumn;
            Assert.IsNotNull(mc, "#C1");
            Assert.AreEqual("Column1", mc.Name, "C2");

            t  = m.Tables[TestDataContext.TableBaz];
            mc = t.DisplayColumn;
            Assert.IsNotNull(mc, "#D1");
            Assert.AreEqual("CustomUIHintColumn", mc.Name, "#D2");

            t  = m.Tables[TestDataContext.TableBazNoStrings];
            mc = t.DisplayColumn;
            Assert.IsNotNull(mc, "#E1");
            Assert.AreEqual("PrimaryKeyColumn1", mc.Name, "#E2");

            t  = m.Tables[TestDataContext.TableBazNoStringsNoPrimary];
            mc = t.DisplayColumn;
            Assert.IsNotNull(mc, "#F1");
            Assert.AreEqual("Column1", mc.Name, "#F2");

            t = m.Tables[TestDataContext.TableFooInvalidDisplayColumnAttribute];
            AssertExtensions.Throws <InvalidOperationException> (() => mc = t.DisplayColumn, "#G1");
            t = m.Tables[TestDataContext.TableFooEmptyDisplayColumnAttribute];
            AssertExtensions.Throws <InvalidOperationException> (() => mc = t.DisplayColumn, "#G2");

            t  = m.Tables[TestDataContext.TableFooWithMetadataType];
            mc = t.DisplayColumn;
            Assert.IsNotNull(mc, "#E1");
            Assert.AreEqual("Column2", mc.Name, "#E2");
        }
Exemplo n.º 23
0
/// <summary>
/// Build the Grid fields for the PivotGridControl from the persisted Mobius view fields
/// </summary>

        void BuildGridFieldsFromViewFields()
        {
            PivotGridFieldMx gf, gf2;

            PivotGridCtl.Fields.Clear();
            PivotGridCtl.Groups.Clear();

            PivotGridPropertiesMx p = PivotGridPropertiesMx;

            for (int fi = 0; fi < p.PivotFields.Count; fi++)             // build grid fields from view fields
            {
                PivotGridFieldMx pf   = p.PivotFields[fi];
                ResultsField     rfld = pf.ResultsField as ResultsField;
                if (rfld == null)
                {
                    continue;
                }
                PivotGridControlMx.SetFieldCaption(pf);                 // be sure we have a caption

                Mobius.Data.QueryColumn qc = rfld.QueryColumn;
                MetaColumn mc = rfld.MetaColumn;

                gf = new PivotGridFieldMx();
                pf.CopyField(gf);
                pf.SyncDxAreaToMxRole();

                if (mc.IsKey)
                {
                    gf.ImageIndex = (int)Bitmaps16x16Enum.Key;
                }
                else
                {
                    gf.ImageIndex = (int)mc.DataTypeImageIndex;
                }

                gf.Options.AllowRunTimeSummaryChange = true;
                gf.Options.ShowUnboundExpressionMenu = true;

                PivotGridCtl.Fields.Add(gf);
            }

            return;
        }
Exemplo n.º 24
0
        /// <summary>
        /// Initialize internal match values for a single rule
        /// </summary>
        /// <param name="columnType"></param>

        public void InitializeInternalMatchValues(MetaColumnType columnType)
        {
            OpCode = ConvertOpNameToCode(Op);

            bool calculateEpsilonFromCfValue = false;             // if true use cf value (note: may not be same number of decimals as output format)

            Epsilon = 0;

            if (MetaColumn.IsNumericMetaColumnType(columnType) && !String.IsNullOrEmpty(Value))
            {
                double.TryParse(Value, out ValueNumber);

                if (calculateEpsilonFromCfValue)
                {
                    Epsilon = MobiusDataType.GetEpsilon(Value);
                }

                else
                {
                    int decimals = 10;                     // use default epsilon value
                    Epsilon = MobiusDataType.GetEpsilon(decimals);
                }
            }

            else if (columnType == MetaColumnType.Date && !String.IsNullOrEmpty(Value))
            {
                ValueNormalized = DateTimeMx.Normalize(Value);
            }

            if (MetaColumn.IsNumericMetaColumnType(columnType) && !String.IsNullOrEmpty(Value2))
            {
                double.TryParse(Value2, out Value2Number);
                double e2 = MobiusDataType.GetEpsilon(Value2);
                if (e2 < Epsilon)
                {
                    Epsilon = e2;
                }
            }
            else if (columnType == MetaColumnType.Date && !String.IsNullOrEmpty(Value2))
            {
                Value2Normalized = DateTimeMx.Normalize(Value2);
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// If the user selected a field from a non-summarized table, give them the option to replace it with the field from the
        /// summarized table (if available).  Performance is better. This will also avoid extra rows as well as a cartesian product.
        /// </summary>

        private void CheckForSummarizedVersionOfMetaColumn()
        {
            return;

#if false // disabled for now
            if (SelectedColumn == null || SelectedColumn.QueryColumn == null)
            {
                return;
            }

            QueryColumn qc = SelectedColumn.QueryColumn;
            MetaColumn  mc = qc.MetaColumn;
            MetaTable   mt = mc.MetaTable;
            QueryTable  qt = new QueryTable(mt);

            bool unsummarrizedVersionSelected = (!mt.UseSummarizedData && mt.SummarizedExists);
            if (!unsummarrizedVersionSelected)
            {
                return;
            }

            QueryTable  summarizedQt = qt.AdjustSummarizationLevel(useSummarized: true);
            QueryColumn summarizedQc = summarizedQt.GetQueryColumnByName(qc.ActiveLabel);
            if (summarizedQc == null)
            {
                return;
            }

            string msg =
                "You have selected the un-summarized version of " + qc.ActiveLabel + ".\n" +
                "Using the summarized version will result in better performance and avoid unwanted extra rows.\n" +
                "It is recommended that the summarized version be used for calculated fields.\n\n" +
                "Would you like to use the summarized version instead?\n";

            DialogResult dialogResult = MessageBoxMx.Show(msg, "Summarized Data Available!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dialogResult == DialogResult.Yes)
            {
                SelectedColumn = null                 //summarizedQc.MetaColumn;

                                 return;
            }
#endif
        }
Exemplo n.º 26
0
        /// <summary>
        /// Add a new field associated with specified ResultsField
        /// </summary>
        /// <param name="rfld"></param>
        /// <param name="Fields"></param>
        /// <param name="area"></param>
        /// <param name="visible"></param>
        /// <param name="pgi"></param>
        /// <returns></returns>

        internal static PivotGridFieldMx AddField(
            ResultsField rfld,
            List <PivotGridFieldMx> Fields,
            PivotArea area,
            bool visible,
            PivotGridGroup group,
            GroupingTypeEnum pgi)
        {
            QueryColumn qc = rfld.QueryColumn;
            MetaColumn  mc = qc.MetaColumn;
            QueryTable  qt = qc.QueryTable;

            PivotGridFieldMx f = new PivotGridFieldMx();

            if (mc.IsKey)
            {
                f.ImageIndex = (int)Bitmaps16x16Enum.Key;
            }
            else
            {
                f.ImageIndex = (int)mc.DataTypeImageIndex;
            }

            f.UnboundFieldName = qt.Alias + "." + mc.Name +       // identify by tableAlias.mcName (allows multiple instances of same metatable in query)
                                 "." + (UnboundFieldNameCount++); // and make unique in case used in multiple PivotGroupIntervals (needed?)

            f.ResultsField             = rfld;                    // store associated results field
            f.SummaryTypeMx            = SummaryTypeEnum.Count;
            f.Area                     = area;
            f.Visible                  = visible; // if not visible then put in list of unused fields
            f.Aggregation.GroupingType = pgi;

            PivotGridControlMx.SetFieldCaption(f);

            Fields.Add(f);

            if (group != null)
            {
                group.Add(f);                            // add to group
            }
            return(f);
        }
Exemplo n.º 27
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destType)
        {
            if (context != null)
            {
                MetaColumn column = context.Instance as MetaColumn;
                if (column != null && column.Source != null)
                {
                    if (value != null)
                    {
                        if (value.ToString() == ReportElement.kClearEnumGUID)
                        {
                            return(noEnumLabel);
                        }
                        MetaEnum enumItem = column.Source.MetaData.Enums.FirstOrDefault(i => i.GUID == value.ToString());
                        if (enumItem != null)
                        {
                            return(enumItem.Name);
                        }
                    }
                }
                else
                { //For input values
                    var element = context.Instance as ReportElement;
                    if (element != null && element.Report != null)
                    {
                        if (value != null)
                        {
                            foreach (var source in element.Report.Sources)
                            {
                                MetaEnum enumItem = source.MetaData.Enums.FirstOrDefault(i => i.GUID == value.ToString());
                                if (enumItem != null)
                                {
                                    return(enumItem.Name);
                                }
                            }
                        }
                    }
                }
            }

            return(base.ConvertTo(context, culture, value, destType));
        }
Exemplo n.º 28
0
/// <summary>
/// Get the shared result type id associated with the supplied metacolumn (e.g. AssayMetadata result type id)
/// </summary>
/// <param name="mc"></param>
/// <returns></returns>

        static int GetAssayResultTypeId(MetaColumn mc)
        {
            string[] sa;
            int      typeId  = -1;
            bool     parseOk = false;

            MetaBrokerType mbt = mc.MetaTable.MetaBrokerType;

            if (mbt == MetaBrokerType.Assay)
            {
                typeId = AssayMetaFactory.GetAssayMetadataResultTypeId(mc);
            }

            else
            {
                LogMessage("Unexpected MetaBrokerType: " + mbt + " for " + mc.MetaTable.Name + "." + mc.Name);
            }

            return(typeId);
        }
Exemplo n.º 29
0
        /// <summary>
        /// Get Spotfire SBdf (Binary Data Format) column type
        /// </summary>
        /// <param name="mc"></param>
        /// <returns></returns>
        SpotfireDataFileValueType GetSpotfireDataFileType(MetaColumn mc)
        {
            StdfValueType tt;
            SbdfValueType bt;

            GetSpotfireDataTypes(mc, out tt, out bt);

            SpotfireDataFileValueType vt = new SpotfireDataFileValueType();

            if (TextFormat)
            {
                vt.StdfValueType = tt;
            }
            else
            {
                vt.SbdfValueType = bt;
            }

            return(vt);
        }
Exemplo n.º 30
0
        private void restrictionsTextBox_DragDrop(object sender, DragEventArgs e)
        {
            if (!Helper.CanDragAndDrop(e)) return;

            //This clean unused restrictions
            RestrictionTextToModel();

            MetaColumn column = null;
            if (e.Data.GetDataPresent(typeof(TreeNode)))
            {
                TreeNode elementNode = (TreeNode)e.Data.GetData(typeof(TreeNode));
                column = (MetaColumn)elementNode.Tag;
            }
            if (e.Data.GetDataPresent(typeof(Button)))
            {
                Button button = (Button)e.Data.GetData(typeof(Button));
                column = ((ReportElement)button.Tag).MetaColumn;
            }
            AddRestriction(column, false);
        }
Exemplo n.º 31
0
        public void IsReadOnly()
        {
            MetaModel m = Utils.CommonInitialize();

            MetaTable  t  = m.Tables[TestDataContext.TableBaz];
            MetaColumn mc = t.GetColumn("ReadOnlyColumn");

            Assert.IsNotNull(mc, "#A1");
            Assert.AreEqual(true, mc.IsReadOnly, "#A1-1");

            // Apparently it value passed to ReadOnlyAttribute's constructor doesn't matter.
            // The only presence of it marks the column as read-only
            mc = t.GetColumn("ReadWriteColumn");
            Assert.IsNotNull(mc, "#B1");
            Assert.AreEqual(true, mc.IsReadOnly, "#B1-1");

            mc = t.GetColumn("Column1");
            Assert.IsNotNull(mc, "#C1");
            Assert.AreEqual(false, mc.IsReadOnly, "#C1-1");
        }
Exemplo n.º 32
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destType)
        {
            if (context != null)
            {
                MetaColumn column = context.Instance as MetaColumn;
                if (column != null)
                {
                    if (value != null)
                    {
                        MetaEnum enumItem = column.Source.MetaData.Enums.FirstOrDefault(i => i.GUID == value.ToString());
                        if (enumItem != null)
                        {
                            return(enumItem.Name);
                        }
                    }
                }
            }

            return(base.ConvertTo(context, culture, value, destType));
        }
 public bool Contains(MetaColumn column) {
     Debug.Assert(_defaultValues != null);
     return Misc.IsColumnInDictionary(column, _defaultValues);
 }