void item_Click(object sender, EventArgs e) { try { ToolStripMenuItem item = (ToolStripMenuItem)sender; dimension = dimension.Parent.Dimensions.GetByName(item.Text); foreach (ToolStripItem item2 in dimensionsToolStripMenuItem.DropDownItems) { if (item2 is ToolStripMenuItem) { ToolStripMenuItem menuItem = (ToolStripMenuItem)item2; if (item2.Text == dimension.Name) { menuItem.Checked = true; } else { menuItem.Checked = false; } } } LayoutImage(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } }
/// <summary> /// Add dimension into Cube dataBase, instead of cube /// </summary> /// <param name="cubedb">Cube dataBase</param> /// <param name="datasourcename">dataSourceName</param> /// <param name="dimensionid">dimension id</param> /// <param name="dimensionname">dimension id</param> /// <param name="dim_type">dimension type, eg..time、regular</param> /// <returns></returns> public static Microsoft.AnalysisServices.Dimension ADD_DIMENSION( Microsoft.AnalysisServices.Database cubedb, String datasourcename, String dimensionid, String dimensionname, String dim_type) { Microsoft.AnalysisServices.Dimension dim = cubedb.Dimensions.FindByName(dimensionname); try { String[] nullvalue = new String[] { "null" }; if (!nullvalue.Contains(dimensionname)) { dim = cubedb.Dimensions.Add(dimensionid); dim.Name = dimensionname; dim.Type = Microsoft.AnalysisServices.DimensionType.Regular; if (dim_type.ToLower() == "time") { dim.Type = Microsoft.AnalysisServices.DimensionType.Time; } dim.Source = new Microsoft.AnalysisServices.DataSourceViewBinding(datasourcename); dim.StorageMode = Microsoft.AnalysisServices.DimensionStorageMode.Molap; dim.ProcessingGroup = Microsoft.AnalysisServices.ProcessingGroup.ByAttribute; } //module_helper.helper.print_message_to_client( u"Added dimension ["+dimensionname+"]") } finally { } return(dim); }
public static void ADD_ATTRIBUTE_TO_DIMENSION( Microsoft.AnalysisServices.DataSourceView cubeDSV, Microsoft.AnalysisServices.Dimension dim, String tableID, String colName, String attribID, String attribName, System.Data.OleDb.OleDbType type, Microsoft.AnalysisServices.AttributeUsage usage, String nameColumn, bool visible = true, bool AttHierEnabled = true, Microsoft.AnalysisServices.OrderBy orderby = Microsoft.AnalysisServices.OrderBy.Name, String attDisplayFolder = "", String orderByAttName = null, String attType = "Regular", String valueColumn = null, System.Data.OleDb.OleDbType valueColtype = System.Data.OleDb.OleDbType.Integer) { Microsoft.AnalysisServices.DimensionAttribute attr = dim.Attributes.FindByName(attribName); if (attr == null) { attr = dim.Attributes.Add(attribID); attr.Name = attribName; attr.Usage = usage; attr.Type = Microsoft.AnalysisServices.AttributeType.Regular; attr.AttributeHierarchyEnabled = AttHierEnabled; Microsoft.AnalysisServices.DataItem dataItem = CREATE_COLUMN_BINDING_DATA_ITEM(cubeDSV, tableID, colName, type); attr.KeyColumns.Add(dataItem); attr.KeyColumns[0].DataType = type; attr.AttributeHierarchyVisible = visible; attr.OrderBy = orderby; if (nameColumn != colName && nameColumn != "") { Microsoft.AnalysisServices.DataItem nameColDataItem = CREATE_COLUMN_BINDING_DATA_ITEM(cubeDSV, tableID, nameColumn, System.Data.OleDb.OleDbType.WChar); attr.NameColumn = nameColDataItem; } if (attDisplayFolder != null && attDisplayFolder != "") { attr.AttributeHierarchyDisplayFolder = attDisplayFolder; } if (orderByAttName != null && orderByAttName != "") { attr.OrderByAttributeID = orderByAttName; } if (valueColumn != null && valueColumn != "") { Microsoft.AnalysisServices.DataItem valueColDataItem = CREATE_COLUMN_BINDING_DATA_ITEM(cubeDSV, tableID, valueColumn, valueColtype); attr.ValueColumn = valueColDataItem; } //module_helper.helper.print_message_to_client( "Added attribute ["+attribName+"] to dimension ["+dim.Name+"]") } }
public static void ADD_CUBE_DIMENSION( Microsoft.AnalysisServices.Database cubedb, Microsoft.AnalysisServices.Cube cube, String dimID, String dimension_type, String cube_dimName = "", bool visible = true) { Microsoft.AnalysisServices.Dimension dim = cubedb.Dimensions.Find(dimID); if (dim == null) { // module_helper.helper.print_message_to_client( "Dimension name ["+dimName+"] is not existed in current cube","warning"); } Microsoft.AnalysisServices.CubeDimension cube_dim = cube.Dimensions.Add(dim.ID); cube_dim.Visible = visible; cube_dim.Name = dim.Name; //module_helper.helper.print_message_to_client( "Added dimension ["+cube.Dimensions.FindByName(dim.Name).Name+"] to cube"); }
private void nextAltRightArrowToolStripMenuItem_Click(object sender, EventArgs e) { try { lock (dimensionsToolStripMenuItem) { int oldIndex = dimension.Parent.Dimensions.IndexOf(dimension); if (oldIndex == dimension.Parent.Dimensions.Count - 1) { dimension = dimension.Parent.Dimensions[0]; } else { dimension = dimension.Parent.Dimensions[oldIndex + 1]; } foreach (ToolStripItem item in dimensionsToolStripMenuItem.DropDownItems) { if (item is ToolStripMenuItem) { ToolStripMenuItem menuItem = (ToolStripMenuItem)item; if (item.Text == dimension.Name) { menuItem.Checked = true; } else { menuItem.Checked = false; } } } LayoutImage(); } } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } }
void item_Click(object sender, EventArgs e) { try { ToolStripMenuItem item = (ToolStripMenuItem)sender; dimension = dimension.Parent.Dimensions.GetByName(item.Text); foreach (ToolStripItem item2 in dimensionsToolStripMenuItem.DropDownItems) { if (item2 is ToolStripMenuItem) { ToolStripMenuItem menuItem = (ToolStripMenuItem)item2; if (item2.Text == dimension.Name) menuItem.Checked = true; else menuItem.Checked = false; } } LayoutImage(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } }
private void nextAltRightArrowToolStripMenuItem_Click(object sender, EventArgs e) { try { lock (dimensionsToolStripMenuItem) { int oldIndex = dimension.Parent.Dimensions.IndexOf(dimension); if (oldIndex == dimension.Parent.Dimensions.Count - 1) { dimension = dimension.Parent.Dimensions[0]; } else { dimension = dimension.Parent.Dimensions[oldIndex + 1]; } foreach (ToolStripItem item in dimensionsToolStripMenuItem.DropDownItems) { if (item is ToolStripMenuItem) { ToolStripMenuItem menuItem = (ToolStripMenuItem)item; if (item.Text == dimension.Name) menuItem.Checked = true; else menuItem.Checked = false; } } LayoutImage(); } } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } }