protected override object SaveControlState() { object[] controlState = new object[4]; controlState[0] = base.SaveControlState(); controlState[1] = new Olap.DimensionFieldInfoCollection(lbSelectedFields.Items); controlState[2] = new Olap.MeasureFieldInfoCollection(lbSelectedMetricFields.Items); controlState[3] = m_Filters; return(controlState); }
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); } }
protected void FieldRemove_Click(object sender, EventArgs e) { Olap.DimensionFieldInfoCollection selectedItems = new Olap.DimensionFieldInfoCollection(lbSelectedFields.Items); ListEditItem item = lbSelectedFields.SelectedItem; if (item != null && item.GetValue("UniqueName") != null) { selectedItems.Remove(item.GetValue("UniqueName").ToString()); Helpers.SetDataSource(lbSelectedFields, selectedItems, "UniqueName", "Caption"); lbSelectedFields.SelectedIndex = -1; } if (FieldRemoveButtonClicked != null) { FieldRemoveButtonClicked(sender, e); } }
protected override void LoadControlState(object savedState) { object[] controlState = (object[])savedState; base.LoadControlState(controlState[0]); // Fields Olap.DimensionFieldInfoCollection list = (Olap.DimensionFieldInfoCollection)controlState[1]; Helpers.SetDataSource(lbSelectedFields, list, "UniqueName", "Caption"); // Metrics Olap.MeasureFieldInfoCollection list1 = (Olap.MeasureFieldInfoCollection)controlState[2]; Helpers.SetDataSource(lbSelectedMetricFields, list1, "UniqueName", "Caption"); // Filters m_Filters = (FilterControlInfoCollection)controlState[3]; foreach (FilterControlInfo ctlFilter in m_Filters.Collection) { GenerateFilterControl(ctlFilter.Type, ctlFilter.ID); } }
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 override object SaveControlState() { object[] controlState = new object[4]; controlState[0] = base.SaveControlState(); controlState[1] = new Olap.DimensionFieldInfoCollection(lbSelectedFields.Items); controlState[2] = new Olap.MeasureFieldInfoCollection(lbSelectedMetricFields.Items); controlState[3] = m_Filters; return controlState; }
protected void FieldRemove_Click(object sender, EventArgs e) { Olap.DimensionFieldInfoCollection selectedItems = new Olap.DimensionFieldInfoCollection(lbSelectedFields.Items); ListEditItem item = lbSelectedFields.SelectedItem; if (item != null && item.GetValue("UniqueName") != null) { selectedItems.Remove(item.GetValue("UniqueName").ToString()); Helpers.SetDataSource(lbSelectedFields, selectedItems, "UniqueName", "Caption"); lbSelectedFields.SelectedIndex = -1; } if (FieldRemoveButtonClicked != null) { FieldRemoveButtonClicked(sender, e); } }
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); } }