protected void ButtonSubmit_Click(object sender, EventArgs e) { string InstanceName = TextBoxSource.Text; //List Catalogs(DBs) string strMDX = "select * from $system.DBSCHEMA_CATALOGS"; string strConnString = "Datasource=" + InstanceName; System.Data.DataTable dtDB = GetDataTable(strConnString, strMDX); //returns data table with DB details //Enumerate cubes in each database ArrayList DBList = ReturnValueFromDataTable(dtDB, 0); //Get DB Name (Catalog_Name) from data table dtDB.Dispose(); System.Data.DataTable dtCubes = new System.Data.DataTable(); System.Data.DataTable dtPartial = new System.Data.DataTable(); foreach (string DBName in DBList) { strMDX = "SELECT * FROM $system.MDSchema_Cubes WHERE CUBE_SOURCE=1"; strConnString = "Datasource=" + TextBoxSource.Text + ";Catalog=" + DBName; dtPartial = GetDataTable(strConnString, strMDX); //get all Cubes for the DB DBName DataColumn CubeLink = dtPartial.Columns.Add("Link"); // Add a column "Link" in the data table CubeLink.SetOrdinal(0); //make new column as first column in table dtCubes.Merge(dtPartial); dtPartial.Dispose(); } GridViewResults.AutoGenerateColumns = true; GridViewResults.DataSource = dtCubes; //returns data table with DB details GridViewResults.DataBind(); dtCubes.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { ValidationSettings.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None; GridViewResults.PageSize = int.Parse(DDListNumberResults.SelectedValue); ButtonExportBibtex.Visible = false; PanelChangeName.Visible = false; if (searchedTable == "publications") { GridViewResults.DataKeyNames = new string[] { "Klucz" }; GridViewResults.DataSource = PublicationsSearched; if (PublicationsSearched.Count != 0) { ButtonExportBibtex.Visible = true; } if (PublicationsSearched.Count > 100) { LabelExportBibtex.Visible = true; } else { LabelExportBibtex.Visible = false; } } else { GridViewResults.DataKeyNames = new string[] { "Id" }; GridViewResults.DataSource = AuthorsSearched; LabelExportBibtex.Visible = false; } GridViewResults.DataBind(); PanelFields.Visible = false; }
protected void GridViewResults_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridViewResults.PageIndex = e.NewPageIndex; GridViewResults.SelectedIndex = -1; PanelPublicationInfo.Visible = false; PanelPublications.Visible = false; PanelEditDelete.Visible = false; PanelEdit.Visible = false; ButtonExportBibtex.Visible = false; if (searchedTable == "publications") { GridViewResults.DataKeyNames = new string[] { "Klucz" }; GridViewResults.DataSource = PublicationsSearched; if (PublicationsSearched.Count != 0) { ButtonExportBibtex.Visible = true; } if (PublicationsSearched.Count > 100) { LabelExportBibtex.Visible = true; } else { LabelExportBibtex.Visible = false; } } else { GridViewResults.DataKeyNames = new string[] { "Id" }; GridViewResults.DataSource = AuthorsSearched; LabelExportBibtex.Visible = false; } GridViewResults.DataBind(); }
/* * Execute custom query */ private void InitDataTable(string sQuery) { SQLMiningManager objMiningManager = new SQLMiningManager(); // clear node table GridViewDistribution.DataSource = null; GridViewDistribution.DataBind(); // display results Microsoft.AnalysisServices.AdomdClient.AdomdDataReader objMiningData = objMiningManager.GetMiningResults(sQuery); if (objMiningData == null) { return; } DataTable objTable = new DataTable(); DataColumn myColumn = new DataColumn(); DataRow myRow = null; DataTable objSchemaTable = objMiningData.GetSchemaTable(); List <string> lMeta = new List <string>(); // init meta values for (int i = 0; i < objSchemaTable.Rows.Count; i++) { lMeta.Add(objSchemaTable.Rows[i][0].ToString()); } // add columns and column captions for (int i = 0; i < objMiningData.FieldCount; i++) { myColumn = new DataColumn(lMeta[i]); objTable.Columns.Add(myColumn); } // output the rows in the DataReader while (objMiningData.Read()) { // new row myRow = objTable.NewRow(); // set the row values for (int i = 0; i < objMiningData.FieldCount; i++) { myRow[i] = objMiningData[i]; } // add row to the table objTable.Rows.Add(myRow); } // close reader objMiningData.Close(); GridViewResults.DataSource = objTable; GridViewResults.DataBind(); // load the main table data Session.Add("queryMining", objTable); }
//private const string sServer = "localhost"; protected void Page_Load(object sender, EventArgs e) { try { // load existing mining structures if (!Page.IsPostBack) { LoadCustomization(); LoadExistingStructures(); InitCubes(); InitDimensionNames(); InitAttributes(); } // get from session if (Session != null) { // initial query data DataTable objTable = new DataTable(); if (Session["queryData"] != null) { objTable = (DataTable)Session["queryData"]; //GridViewData.DataSource = objTable; //GridViewData.DataBind(); // initialize column list //InitializeColumns(objTable); } // mining query data if (Session["queryMining"] != null) { objTable = (DataTable)Session["queryMining"]; GridViewResults.DataSource = objTable; GridViewResults.DataBind(); // load viewer for the current model LoadViewer(); } // node query data if (Session["queryNode"] != null) { objTable = (DataTable)Session["queryNode"]; GridViewDistribution.DataSource = objTable; GridViewDistribution.DataBind(); } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } // register event DropDownListCubes.SelectedIndexChanged += new EventHandler(DropDownListCubes_SelectedIndexChanged); DropDownListDimensions.SelectedIndexChanged += new EventHandler(DropDownListDimensions_SelectedIndexChanged); DropDownListKey.SelectedIndexChanged += new EventHandler(DropDownListKey_SelectedIndexChanged); DropDownListAlgorithm.SelectedIndexChanged += new EventHandler(DropDownListAlgorithm_SelectedIndexChanged); }
protected void BtnSearch_Click(object sender, EventArgs e) { List <String> streetAddresses = new List <String>(TxtStreetAddresses.Text.Split('\n')); //streetAddresses.Add("13 Royal Crest Dr, Pueblo, CO 81005"); Dictionary <int, DTOs.PropertyInfo> properties = PropertySearch.SearchForProperties(streetAddresses); GridViewResults.DataSource = properties.Values.ToList(); GridViewResults.DataBind(); }
protected void ButtonSaveName_Click(object sender, EventArgs e) { if (selectedAuthor.Id != 0 && TextBoxName.Text != selectedAuthor.Autor) //if something has changed { PublicationsDAL.UpdateAuthor(selectedAuthor.Id, TextBoxName.Text); //update view GridViewResults.DataSource = PublicationsDAL.AuthorsAll = PublicationsDAL.GetAuthors(); GridViewResults.DataBind(); foreach (var author in PublicationsDAL.AuthorsAll) { if (author.Id == (int)GridViewResults.SelectedValue) { selectedAuthor = new Author(author.Id, author.Autor); ShowPublications(selectedAuthor); break; } } Response.Write("<script>alert('Imię i nazwisko autora zaktualizowane')</script>"); } }
private void Find() { searchPhrase = TextBoxSearch.Text; GridViewResults.EmptyDataText = "Przykro mi, nie znaleziono pasujących wyników."; GridViewResults.PageIndex = 0; GridViewResults.SelectedIndex = -1; searchedTable = DDListTable.SelectedValue; PanelPublicationInfo.Visible = false; PanelPublications.Visible = false; ButtonExportBibtex.Visible = false; PanelEditDelete.Visible = false; PanelEdit.Visible = false; int numberResults = 0; string word = ""; listWords.Clear(); foreach (char ch in searchPhrase) { if (!char.IsWhiteSpace(ch)) { word += ch; } else { if (word != " ") { listWords.Add(word); } word = ""; } } if (word != "") { listWords.Add(word); } if (searchedTable == "publications") { GridViewResults.DataKeyNames = new string[] { "Klucz" }; PublicationsSearched = PublicationsDAL.GetPublications(listWords, order); GridViewResults.DataSource = PublicationsSearched; if (PublicationsSearched.Count != 0) { ButtonExportBibtex.Visible = true; } numberResults = PublicationsSearched.Count; if (numberResults > 100) { LabelExportBibtex.Visible = true; } else { LabelExportBibtex.Visible = false; } } else { GridViewResults.DataKeyNames = new string[] { "Id" }; AuthorsSearched = PublicationsDAL.GetAuthors(listWords); GridViewResults.DataSource = AuthorsSearched; numberResults = AuthorsSearched.Count; LabelExportBibtex.Visible = false; } GridViewResults.DataBind(); LabelResults.Text = $"Wyniki wyszukiwania dla: <strong>{searchPhrase}</strong><br/>Znaleziono <strong>{numberResults}</strong> pasujących wyników."; }