Esempio n. 1
0
        protected void FieldAdd_Click(object sender, EventArgs e)
        {
            Olap.DimensionFieldInfoCollection selectedItems = new Olap.DimensionFieldInfoCollection(lbSelectedFields.Items);
            ListEditItem item = lbFields.SelectedItem;

            if (item != null &&
                selectedItems.Find(item.Value.ToString()) == null)
            {
                selectedItems.Add(new Olap.DimensionFieldInfo(item));
                Helpers.SetDataSource(lbSelectedFields, selectedItems, "UniqueName", "Caption");
            }
            if (FieldAddButtonClicked != null)
            {
                FieldAddButtonClicked(sender, e);
            }
        }
Esempio n. 2
0
        private void LoadFields()
        {
            String connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["OLAPConnection"].ConnectionString;

            using (AdomdConnection conn = new AdomdConnection(connectionString))
            {
                conn.Open();
                CubeDef cubeDef = null;
                foreach (CubeDef cube in conn.Cubes)
                {
                    if (cube.Type == CubeType.Cube)
                    {
                        cubeDef = cube;
                        break;
                    }
                }
                if (cubeDef == null)
                {
                    m_DimFieldCollection.Clear();
                    m_MeasureFieldCollection.Clear();
                    return;
                }
                DimensionCollection dimCollection = cubeDef.Dimensions;
                foreach (Dimension dim in dimCollection)
                {
                    if (dim.DimensionType == DimensionTypeEnum.Measure)
                    {
                        continue;
                    }
                    HierarchyCollection hierarchyColl = dim.Hierarchies;
                    foreach (Hierarchy hier in hierarchyColl)
                    {
                        m_DimFieldCollection.Add(new Olap.DimensionFieldInfo(hier));
                    }
                }
                MeasureCollection measureCollection = cubeDef.Measures;
                foreach (Measure m in measureCollection)
                {
                    m_MeasureFieldCollection.Add(new Olap.MeasureFieldInfo(m));
                }
            }
        }
Esempio n. 3
0
        public override void Load_InitData()
        {
            if (Mode != ControlMode.New)
            {
                return;
            }
            ASPxComboBox cbbKeyField;
            try
            {
                cbbKeyField = (ASPxComboBox)this.FindControl("cbbKeyField");
                if (cbbKeyField == null) { return; }
            }
            #if DEBUG
            catch (Exception ex)
            {
                throw ex;
            }
            #else
            catch ()
            {
                return;
            }
            #endif
            // Load fields
            String connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["OLAPConnection"].ConnectionString;
            using (AdomdConnection conn = new AdomdConnection(connectionString))
            {
                conn.Open();
                // Find a cube
                CubeDef cubeDef = null;
                CubeCollection cubeCollection = conn.Cubes;
                int numOfCube = cubeCollection.Count - 1;
                for (; numOfCube > 0; numOfCube--)
                {
                    cubeDef = cubeCollection[numOfCube];
                    if (cubeDef.Type == CubeType.Cube) { break; }
                }
                if (this is wcNormalFilter
                    || this is wcTimeFilter)
                {
                    Olap.DimensionFieldInfoCollection fields = new Olap.DimensionFieldInfoCollection();
                    // Load dimension field
                    DimensionCollection dimCollection = cubeDef.Dimensions;
                    int numOfDim = dimCollection.Count;
                    for (int dimIndex = 0; dimIndex < numOfDim; dimIndex++)
                    {
                        Dimension dim = dimCollection[dimIndex];
                        if (this is wcNormalFilter)
                        {
                            if (dim.UniqueName == "[ARDimTime]"
                                || dim.DimensionType == DimensionTypeEnum.Measure)
                            {
                                continue;
                            }
                        }
                        else if (this is wcNumFilter)
                        {
                            if (dim.DimensionType != DimensionTypeEnum.Measure)
                            {
                                continue;
                            }
                        }
                        else // Date
                        {
                            if (dim.UniqueName != "[ARDimTime]")
                            {
                                continue;
                            }
                        }

                        foreach (Hierarchy hier in dim.Hierarchies)
                        {
                            fields.Add(new Olap.DimensionFieldInfo(hier));
                        }
                    }
                    Helpers.SetDataSource(cbbKeyField, fields, "UniqueName", "Caption");
                }
                else // wcNumFilter
                {
                    Olap.MeasureFieldInfoCollection fields = new Olap.MeasureFieldInfoCollection();
                    MeasureCollection measureCollection = cubeDef.Measures;
                    int numOfMeasure = measureCollection.Count;
                    for (int mIndex = 0; mIndex < numOfMeasure; mIndex++)
                    {
                        Measure m = measureCollection[mIndex];
                        fields.Add(new Olap.MeasureFieldInfo(m));
                    }
                    Helpers.SetDataSource(cbbKeyField, fields, "UniqueName", "Caption");
                }
            }
        }
 protected void FieldAdd_Click(object sender, EventArgs e)
 {
     Olap.DimensionFieldInfoCollection selectedItems = new Olap.DimensionFieldInfoCollection(lbSelectedFields.Items);
     ListEditItem item = lbFields.SelectedItem;
     if (item != null
         && selectedItems.Find(item.Value.ToString()) == null)
     {
         selectedItems.Add(new Olap.DimensionFieldInfo(item));
         Helpers.SetDataSource(lbSelectedFields, selectedItems, "UniqueName", "Caption");
     }
     if (FieldAddButtonClicked != null)
     {
         FieldAddButtonClicked(sender, e);
     }
 }