Exemple #1
0
        public LevelPropertyItemControl(LevelPropertyInfo info)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }

            m_Info = info;
            Text   = info.Caption;

            Icon = UriResources.Images.LevelProperty16;
        }
Exemple #2
0
        public Dictionary <String, LevelPropertyInfo> GetLevelProperties(string cubeName, string dimensionUniqueName, string hierarchyUniqueName, String levelUniqueName)
        {
            try
            {
                System.Diagnostics.Trace.TraceInformation("{0} Ranet.Olap.Core.Providers.OlapMetadataProvider Get Level '{1}' Properties Started \r\n cubeName: '{2}' \r\n dimensionUniqueName: '{3}' \r\n hierarchyUniqueName: '{4}' ",
                                                          DateTime.Now.ToString(), levelUniqueName, cubeName, dimensionUniqueName, hierarchyUniqueName);

                Dictionary <String, LevelPropertyInfo> list = new Dictionary <String, LevelPropertyInfo>();
                // Ищем уровень
                Level level = FindLevel(cubeName, dimensionUniqueName, hierarchyUniqueName, levelUniqueName);
                if (level != null)
                {
                    // Свойства уровня - атрибуты
                    AdomdConnection conn = GetConnection();

                    AdomdRestrictionCollection restrictions = new AdomdRestrictionCollection();
                    restrictions.Add("CATALOG_NAME", conn.Database);
                    restrictions.Add("CUBE_NAME", OlapHelper.ConvertToNormalStyle(cubeName));
                    restrictions.Add("DIMENSION_UNIQUE_NAME", dimensionUniqueName);
                    restrictions.Add("HIERARCHY_UNIQUE_NAME", hierarchyUniqueName);
                    restrictions.Add("LEVEL_UNIQUE_NAME", level.UniqueName);

                    DataSet ds = conn.GetSchemaDataSet("MDSCHEMA_PROPERTIES", restrictions);
                    if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        DataTable table = ds.Tables[0];

                        if (ds.Tables[0].Columns.Count > 0)
                        {
                            object obj = null;
                            foreach (DataRow row in ds.Tables[0].Rows)
                            {
                                Type type = null;
                                if (table.Columns.Contains("DATA_TYPE"))
                                {
                                    obj = row["DATA_TYPE"];
                                    System.Data.OleDb.OleDbType oleDbType = (System.Data.OleDb.OleDbType)(Convert.ToInt32(obj));
                                    type = OleDbTypeConverter.Convert(oleDbType);
                                }

                                String name = String.Empty;
                                if (table.Columns.Contains("PROPERTY_NAME"))
                                {
                                    obj = row["PROPERTY_NAME"];
                                    if (obj != null)
                                    {
                                        name = obj.ToString();
                                    }
                                }

                                String caption = String.Empty;
                                if (table.Columns.Contains("PROPERTY_CAPTION"))
                                {
                                    obj = row["PROPERTY_CAPTION"];
                                    if (obj != null)
                                    {
                                        caption = obj.ToString();
                                    }
                                }

                                String description = String.Empty;
                                if (table.Columns.Contains("DESCRIPTION"))
                                {
                                    obj = row["DESCRIPTION"];
                                    if (obj != null)
                                    {
                                        description = obj.ToString();
                                    }
                                }

                                int propertyType = 0;
                                if (table.Columns.Contains("PROPERTY_TYPE"))
                                {
                                    obj = row["PROPERTY_TYPE"];
                                    if (obj != null)
                                    {
                                        propertyType = Convert.ToInt32(obj);
                                    }
                                }

                                LevelPropertyInfo lpi = new LevelPropertyInfo();
                                lpi.Caption       = caption;
                                lpi.Description   = description;
                                lpi.Name          = name;
                                lpi.ParentLevelId = level.UniqueName;
                                //lpi.DataType = type;
                                if ((propertyType & 0x04) == 0x04)
                                {
                                    lpi.IsSystem = true;
                                }

                                lpi.PropertyType = propertyType;

                                //info.LevelProperties.Add(lpi);
                                list.Add(lpi.Name, lpi);
                            }
                        }
                    }

                    //list.Add(info);
                }
                return(list);
            }
            finally {
                System.Diagnostics.Trace.TraceInformation("{0} Ranet.Olap.Core.Providers.OlapMetadataProvider Get Level '{1}' Properties Completed ", DateTime.Now.ToString(), levelUniqueName);
            }
        }